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



82
83
84
# File 'lib/generators/asset_sync/install_generator.rb', line 82

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



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

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

#aws_secret_access_keyObject



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

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

#aws_session_tokenObject



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

def aws_session_token
  "<%= ENV['AWS_SESSION_TOKEN'] %>"
end

#azure_rm?Boolean

Returns:

  • (Boolean)


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

def azure_rm?
  options[:provider] == 'AzureRM'
end

#azure_storage_access_keyObject



66
67
68
# File 'lib/generators/asset_sync/install_generator.rb', line 66

def azure_storage_access_key
  "<%= ENV['AZURE_STORAGE_ACCESS_KEY'] %>"
end

#azure_storage_account_nameObject



62
63
64
# File 'lib/generators/asset_sync/install_generator.rb', line 62

def 
  "<%= ENV['AZURE_STORAGE_ACCOUNT_NAME'] %>"
end

#b2_bucket_idObject



78
79
80
# File 'lib/generators/asset_sync/install_generator.rb', line 78

def b2_bucket_id
  "<%= ENV['B2_BUCKET_ID'] %>"
end

#b2_key_idObject



70
71
72
# File 'lib/generators/asset_sync/install_generator.rb', line 70

def b2_key_id
  "<%= ENV['B2_KEY_ID'] %>"
end

#b2_key_tokenObject



74
75
76
# File 'lib/generators/asset_sync/install_generator.rb', line 74

def b2_key_token
  "<%= ENV['B2_KEY_TOKEN'] %>"
end

#backblaze?Boolean

Returns:

  • (Boolean)


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

def backblaze?
  options[:provider] == 'Backblaze'
end

#generate_configObject



86
87
88
89
90
# File 'lib/generators/asset_sync/install_generator.rb', line 86

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

#generate_initializerObject



92
93
94
95
96
# File 'lib/generators/asset_sync/install_generator.rb', line 92

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

#google?Boolean

Returns:

  • (Boolean)


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

def google?
  options[:provider] == 'Google'
end

#google_storage_access_key_idObject



46
47
48
# File 'lib/generators/asset_sync/install_generator.rb', line 46

def google_storage_access_key_id
  "<%= ENV['GOOGLE_STORAGE_ACCESS_KEY_ID'] %>"
end

#google_storage_secret_access_keyObject



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

def google_storage_secret_access_key
  "<%= ENV['GOOGLE_STORAGE_SECRET_ACCESS_KEY'] %>"
end

#rackspace?Boolean

Returns:

  • (Boolean)


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

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

#rackspace_api_keyObject



58
59
60
# File 'lib/generators/asset_sync/install_generator.rb', line 58

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

#rackspace_usernameObject



54
55
56
# File 'lib/generators/asset_sync/install_generator.rb', line 54

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