Class: FluxFlex::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/flux_flex/install_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



10
11
12
# File 'lib/generators/flux_flex/install_generator.rb', line 10

def self.source_root
  @_flx_tools_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
end

Instance Method Details

#application_nameObject



50
51
52
# File 'lib/generators/flux_flex/install_generator.rb', line 50

def application_name
  Rails.application.class.name
end

#copy_config_databaseObject



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_fcgiObject



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_flxObject



14
15
16
# File 'lib/generators/flux_flex/install_generator.rb', line 14

def copy_dot_flx
  template '.flx'
end

#copy_dot_htaccessObject



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_filesObject



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_gemsObject



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