Class: FluxFlex::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- FluxFlex::Generators::InstallGenerator
- Defined in:
- lib/generators/flux_flex/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #application_name ⇒ Object
- #copy_config_database ⇒ Object
- #copy_dispatch_fcgi ⇒ Object
- #copy_dot_flx ⇒ Object
- #copy_dot_htaccess ⇒ Object
- #copy_sh_files ⇒ Object
- #insert_gems ⇒ Object
Class Method Details
.source_root ⇒ Object
10 11 12 |
# File 'lib/generators/flux_flex/install_generator.rb', line 10 def self.source_root @_flx_tools_source_root ||= File.(File.join(File.dirname(__FILE__), 'templates')) end |
Instance Method Details
#application_name ⇒ Object
50 51 52 |
# File 'lib/generators/flux_flex/install_generator.rb', line 50 def application_name Rails.application.class.name end |
#copy_config_database ⇒ Object
32 33 34 |
# File 'lib/generators/flux_flex/install_generator.rb', line 32 def copy_config_database template 'database.yml', File.join('config', 'database.yml') end |
#copy_dispatch_fcgi ⇒ Object
24 25 26 |
# File 'lib/generators/flux_flex/install_generator.rb', line 24 def copy_dispatch_fcgi template 'flx_dispatch.fcgi', File.join('public', 'flx_dispatch.fcgi') end |
#copy_dot_flx ⇒ Object
14 15 16 |
# File 'lib/generators/flux_flex/install_generator.rb', line 14 def copy_dot_flx template '.flx' end |
#copy_dot_htaccess ⇒ Object
28 29 30 |
# File 'lib/generators/flux_flex/install_generator.rb', line 28 def copy_dot_htaccess template '.htaccess', File.join('public', '.htaccess') end |
#copy_sh_files ⇒ Object
18 19 20 21 22 |
# File 'lib/generators/flux_flex/install_generator.rb', line 18 def copy_sh_files template 'fluxflex_deploy.sh' template 'fluxflex_rake.sh' template 'fluxflex_setup.sh' end |
#insert_gems ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/generators/flux_flex/install_generator.rb', line 36 def insert_gems gemfile = 'Gemfile' if File.exists?(gemfile) body = File.read(gemfile) File.open(gemfile, 'a') do |f| f.puts "gem 'mysql2'" unless body.match(/mysql/) f.puts "gem 'fcgi'" unless body.match(/fcgi/) end else raise Rails::Generators::Error, "Gemfile not found." end end |