Class: MakeItSo::SinatraAppGenerator
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- MakeItSo::SinatraAppGenerator
- Includes:
- Thor::Actions
- Defined in:
- lib/generators/sinatra_app_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #app_file ⇒ Object
- #asset_files ⇒ Object
- #directories ⇒ Object
- #gemfile ⇒ Object
- #gitignore ⇒ Object
- #rackup_file ⇒ Object
- #rakefile ⇒ Object
- #rspec ⇒ Object
- #view_files ⇒ Object
Class Method Details
.source_root ⇒ Object
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/generators/sinatra_app_generator.rb', line 80 def self.source_root template_path = File.join( File.dirname(__FILE__), "..", "..", "templates", "sinatra") File.(template_path) end |
Instance Method Details
#app_file ⇒ Object
26 27 28 29 |
# File 'lib/generators/sinatra_app_generator.rb', line 26 def app_file file_path = 'app.rb' template(file_path, File.join(app_path, file_path)) end |
#asset_files ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/generators/sinatra_app_generator.rb', line 45 def asset_files [ 'public/javascripts/app.js', 'public/stylesheets/app.css' ].each do |file_path| create_file(File.join(app_path, file_path)) end end |
#directories ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/generators/sinatra_app_generator.rb', line 15 def directories [ 'lib', 'views', 'public/stylesheets', 'public/javascripts' ].each do |dir| empty_directory File.join(app_path, dir) end end |
#gemfile ⇒ Object
59 60 61 62 |
# File 'lib/generators/sinatra_app_generator.rb', line 59 def gemfile file_path = 'Gemfile' template(file_path, File.join(app_path, file_path)) end |
#gitignore ⇒ Object
64 65 66 67 |
# File 'lib/generators/sinatra_app_generator.rb', line 64 def gitignore file_path = '.gitignore' template(file_path, File.join(app_path, file_path)) end |
#rackup_file ⇒ Object
54 55 56 57 |
# File 'lib/generators/sinatra_app_generator.rb', line 54 def rackup_file file_path = 'config.ru' template(file_path, File.join(app_path, file_path)) end |
#rakefile ⇒ Object
31 32 33 34 |
# File 'lib/generators/sinatra_app_generator.rb', line 31 def rakefile file_path = 'Rakefile' template(file_path, File.join(app_path, file_path)) end |
#rspec ⇒ Object
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/generators/sinatra_app_generator.rb', line 69 def rspec if .rspec? empty_directory File.join(app_path, 'spec/features') spec_helper = 'spec/spec_helper.rb' template(spec_helper, File.join(app_path, spec_helper)) dot_rspec = '.rspec' template(dot_rspec, File.join(app_path, dot_rspec)) end end |
#view_files ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/generators/sinatra_app_generator.rb', line 36 def view_files [ 'views/layout.erb', 'views/index.erb' ].each do |file_path| template(file_path, File.join(app_path, file_path)) end end |