class RubyAppGenerator
Constants
- BASEDIRS
Installation skeleton. Intermediate directories are automatically created so don't sweat their absence here.
- DEFAULT_SHEBANG
Attributes
app_name[RW]
module_name[RW]
Public Class Methods
new(runtime_args, runtime_options = {})
click to toggle source
Calls superclass method
RubiGen::Base.new
# File app_generators/ruby_app/ruby_app_generator.rb, line 12 def initialize(runtime_args, runtime_options = {}) super usage if args.empty? @destination_root = args.shift self.app_name = File.basename(File.expand_path(@destination_root)) self.module_name = app_name.camelize end
Public Instance Methods
manifest()
click to toggle source
# File app_generators/ruby_app/ruby_app_generator.rb, line 20 def manifest # Use /usr/bin/env if no special shebang was specified script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] } windows = (RUBY_PLATFORM =~ /dos|win32|cygwin/i) || (RUBY_PLATFORM =~ /(:?mswin|mingw)/) record do |m| # Root directory and all subdirectories. m.directory '' BASEDIRS.each { |path| m.directory path } # Root # m.file "fresh_rakefile", "Rakefile" # m.file "README.txt", "README.txt" m.folder "" # Default module for app m.template "lib/module.rb", "lib/#{app_name}.rb" # Test helper m.template_copy_each %w(test_helper.rb.erb), "test" %w(debug).each { |file| m.file "configs/empty_log", "log/#{file}.log", :chmod => 0666 } m.dependency "install_rubigen_scripts", [destination_root, "rubygems"], :shebang => options[:shebang] end end
Protected Instance Methods
add_options!(opts)
click to toggle source
# File app_generators/ruby_app/ruby_app_generator.rb, line 54 def add_options!(opts) opts.separator '' opts.separator 'Options:' opts.on("-r", "--ruby=path", String, "Path to the Ruby binary of your choice (otherwise scripts use env, dispatchers current path).", "Default: #{DEFAULT_SHEBANG}") { |v| options[:shebang] = v } end