Class: Sudojs::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Sudojs::Generators::InstallGenerator
- Defined in:
- lib/generators/sudojs/install/install_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_dir_structure ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/generators/sudojs/install/install_generator.rb', line 26 def create_dir_structure %W{manifests models views}.each do |dir| directory = "app/assets/javascripts/#{dir}" css_directory = "app/assets/stylesheets/#{dir}" unless File.directory? directory empty_directory directory end unless [:skip_css] || dir == 'models' unless File.directory? css_directory empty_directory css_directory end end end # place the application/ in the views/ empty_directory 'app/assets/javascripts/views/application' empty_directory 'app/assets/stylesheets/views/application' end |
#create_yaml ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/generators/sudojs/install/install_generator.rb', line 17 def create_yaml if [:skip_css] @skip_css = 'true' else @skip_css = 'false' end template 'sudo_js.erb.yml', 'config/sudo_js.yml' end |
#place_install_files ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/generators/sudojs/install/install_generator.rb', line 45 def place_install_files copy_file 'app_manifest.js', 'app/assets/javascripts/manifests/application.js' unless [:skip_css] copy_file 'app_manifest.css', 'app/assets/stylesheets/manifests/application.css' end # TODO templates for other javascript pre-processors if [:js_extension] == '.coffee' copy_file 'namespace.coffee', "app/assets/javascripts/views/application/page.js.coffee" else # for now any other js flavor gets the baseline .js copy_file 'namespace.js', "app/assets/javascripts/views/application/page.js#{options[:js_extension] if options[:js_extension] != '.js'}" end end |