Class: Jax::Generators::App::AppGenerator
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Jax::Generators::App::AppGenerator
- Includes:
- Thor::Actions
- Defined in:
- lib/jax/generators/app/app_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #app ⇒ Object
- #config ⇒ Object
- #create_root ⇒ Object
- #done ⇒ Object
- #gemfile ⇒ Object
- #git ⇒ Object
- #public ⇒ Object
- #rakefile ⇒ Object
- #script_jax ⇒ Object
- #script_permissions ⇒ Object
- #spec ⇒ Object
Class Method Details
.source_root ⇒ Object
12 13 14 |
# File 'lib/jax/generators/app/app_generator.rb', line 12 def self.source_root File.("templates", File.dirname(__FILE__)) end |
Instance Method Details
#app ⇒ Object
21 22 23 |
# File 'lib/jax/generators/app/app_generator.rb', line 21 def app directory 'app' end |
#config ⇒ Object
25 26 27 |
# File 'lib/jax/generators/app/app_generator.rb', line 25 def config directory 'config' end |
#create_root ⇒ Object
16 17 18 19 |
# File 'lib/jax/generators/app/app_generator.rb', line 16 def create_root self.destination_root = File.(path_to_app, destination_root) empty_directory '.' end |
#done ⇒ Object
72 73 74 75 |
# File 'lib/jax/generators/app/app_generator.rb', line 72 def done # to clarify that everything is fine, just in case the user got warnings about git say_status :complete, "Done!", :green end |
#gemfile ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/jax/generators/app/app_generator.rb', line 49 def gemfile if ENV['gemdev'] create_file "Gemfile", "gem 'jax', :path => '../'" else template 'Gemfile.tt', 'Gemfile' end end |
#git ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/jax/generators/app/app_generator.rb', line 57 def git void = RbConfig::CONFIG['host_os'] =~ /msdos|mswin|djgpp|mingw/ ? 'NUL' : '/dev/null' if system "git --version >>#{void} 2>&1" if File.exist? '.git' say_status :exist, 'git', :blue else `git init` `git add *` say_status :init, 'git', :green end else say_status :warn, "Git does not seem to be installed. Skipping...", :yellow end end |
#public ⇒ Object
29 30 31 |
# File 'lib/jax/generators/app/app_generator.rb', line 29 def public directory 'public' end |
#rakefile ⇒ Object
37 38 39 |
# File 'lib/jax/generators/app/app_generator.rb', line 37 def rakefile copy_file 'Rakefile' end |
#script_jax ⇒ Object
41 42 43 |
# File 'lib/jax/generators/app/app_generator.rb', line 41 def script_jax copy_file "script/jax", "script/jax" end |
#script_permissions ⇒ Object
45 46 47 |
# File 'lib/jax/generators/app/app_generator.rb', line 45 def chmod("script/jax", 0755) end |
#spec ⇒ Object
33 34 35 |
# File 'lib/jax/generators/app/app_generator.rb', line 33 def spec directory 'spec' end |