Class: Ruby::App
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Ruby::App
- Includes:
- Thor::Actions
- Defined in:
- lib/ruby_app.rb
Instance Attribute Summary collapse
-
#project_options ⇒ Object
Returns the value of attribute project_options.
Class Method Summary collapse
Instance Method Summary collapse
- #create_root ⇒ Object
- #default_settings ⇒ Object
- #install_gems ⇒ Object
- #load_local_settings ⇒ Object
- #main_runner ⇒ Object
Instance Attribute Details
#project_options ⇒ Object
Returns the value of attribute project_options.
45 46 47 |
# File 'lib/ruby_app.rb', line 45 def @project_options end |
Class Method Details
.source_root ⇒ Object
47 48 49 50 |
# File 'lib/ruby_app.rb', line 47 def self.source_root # template_path(__FILE__) File.join(File.dirname(__FILE__), '..', 'templates') end |
Instance Method Details
#create_root ⇒ Object
78 79 80 81 82 |
# File 'lib/ruby_app.rb', line 78 def create_root self.destination_root = File.(app_name, destination_root) empty_directory '.' FileUtils.cd(destination_root) end |
#default_settings ⇒ Object
71 72 73 74 75 76 |
# File 'lib/ruby_app.rb', line 71 def default_settings @project_options ||= .dup [:rspec2, :cucumber, :license, :autotest, :bundler].each{|key| [key] ||= true} [:mock_lib] ||= 'mocha' [:readme] ||= 'markdown' end |
#install_gems ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/ruby_app.rb', line 84 def install_gems return nil if ![:install_gems] gems = [] gems << "heckle" if [:heckle] gems << "rcov" if [:rcov] gems << "fakefs" if [:fakefs] gems << "cucumber" if [:cucumber] gems << "ZenTest autotest-growl autotest-fsevent" if [:autotest] gems << "#{[:mock_lib]}" gems << "require-me" if [:require_me] gems << "bundler" if [:bundler] gems << "shoulda" if [:shoulda] gems << "test-unit" if [:test_unit] gems << "rake" if [:rake] gems << "jeweler" if [:jeweler] gems << "timecop" if [:timecop] gems << "#{[:factory_lib]}" run "gem install rspec --pre" if [:rspec] run "gem install #{gems.join(' ')}" end |
#load_local_settings ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/ruby_app.rb', line 52 def load_local_settings local_settings_file = File.join(ENV['HOME'], '.rubyapp') if File.exist? local_settings_file str = File.open(local_settings_file).read arr = str.split(/\n|,|:/).map{|s| s.strip}.map do |n| case n when "true" true when "false" false else n end end local_settings = Hash[*arr] @project_options = local_settings.merge() end end |
#main_runner ⇒ Object
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/ruby_app.rb', line 106 def main_runner say "rubyapp v.0.1.1" if [:jeweler] run "jeweler #{appname}" else create_app end create_gemfile if !skip? :bundler, 'Use Bundler?' create_binaries if !skip? :binaries, 'Create binaries?' configure_cucumber if !skip? :cucumber, 'Use Cucumber?' configure_rspec2 if [:rspec2] configure_autotest if !skip? :autotest, 'Use autotest?' configure_shoulda if [:shoulda] configure_test_unit if [:test_unit] create_gitignore create_readme create_signatures if [:signatures] copy_licence if !skip? :license, 'Use MIT license?' autotest_feature_notice if [:cucumber] end |