Class: CloudStorageSync::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



6
7
8
# File 'lib/generators/cloud_storage_sync/install_generator.rb', line 6

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

Instance Method Details

#app_nameObject



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

def app_name
  @app_name ||= Rails.application.is_a?(Rails::Application) && 
    Rails.application.class.name.sub(/::Application$/, "").downcase
end

#generate_configObject



15
16
17
# File 'lib/generators/cloud_storage_sync/install_generator.rb', line 15

def generate_config
  template "cloud_storage_sync.yml", "config/cloud_storage_sync.yml"
end

#generate_initializerObject



13
14
15
16
17
# File 'lib/generators/cloud_storage_sync/install/install_generator.rb', line 13

def generate_initializer
  unless options[:use_yml]
    template "cloud_storage_sync.rb", "config/initializers/cloud_storage_sync.rb"
  end
end

#generate_rake_taskObject



19
20
21
# File 'lib/generators/cloud_storage_sync/install_generator.rb', line 19

def generate_rake_task
  template "cloud_storage_sync.rake", "lib/tasks/cloud_storage_sync.rake"
end