Class: AssetSync::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



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

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

Instance Method Details

#app_nameObject



38
39
40
# File 'lib/generators/asset_sync/install_generator.rb', line 38

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

#aws?Boolean

Returns:

  • (Boolean)


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

def aws?
  options[:provider] == 'AWS'
end

#aws_access_key_idObject



22
23
24
# File 'lib/generators/asset_sync/install_generator.rb', line 22

def aws_access_key_id
  "<%= ENV['AWS_ACCESS_KEY_ID'] %>"
end

#aws_secret_access_keyObject



26
27
28
# File 'lib/generators/asset_sync/install_generator.rb', line 26

def aws_secret_access_key
  "<%= ENV['AWS_SECRET_ACCESS_KEY'] %>"
end

#generate_configObject



42
43
44
45
46
# File 'lib/generators/asset_sync/install_generator.rb', line 42

def generate_config
  if options[:use_yml]
    template "asset_sync.yml", "config/asset_sync.yml"
  end
end

#generate_initializerObject



48
49
50
51
52
# File 'lib/generators/asset_sync/install_generator.rb', line 48

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

#rackspace?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/generators/asset_sync/install_generator.rb', line 18

def rackspace?
  options[:provider] == 'Rackspace'
end

#rackspace_api_keyObject



34
35
36
# File 'lib/generators/asset_sync/install_generator.rb', line 34

def rackspace_api_key
  "<%= ENV['RACKSPACE_API_KEY'] %>"
end

#rackspace_usernameObject



30
31
32
# File 'lib/generators/asset_sync/install_generator.rb', line 30

def rackspace_username
  "<%= ENV['RACKSPACE_USERNAME'] %>"
end