Class: AssetSync::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- AssetSync::InstallGenerator
- Defined in:
- lib/generators/asset_sync/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #app_name ⇒ Object
- #aws? ⇒ Boolean
- #aws_access_key_id ⇒ Object
- #aws_secret_access_key ⇒ Object
- #aws_session_token ⇒ Object
- #azure_rm? ⇒ Boolean
- #azure_storage_access_key ⇒ Object
- #azure_storage_account_name ⇒ Object
- #b2_bucket_id ⇒ Object
- #b2_key_id ⇒ Object
- #b2_key_token ⇒ Object
- #backblaze? ⇒ Boolean
- #generate_config ⇒ Object
- #generate_initializer ⇒ Object
- #google? ⇒ Boolean
- #google_storage_access_key_id ⇒ Object
- #google_storage_secret_access_key ⇒ Object
- #rackspace? ⇒ Boolean
- #rackspace_api_key ⇒ Object
- #rackspace_username ⇒ Object
Class Method Details
.source_root ⇒ Object
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_name ⇒ Object
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
14 15 16 |
# File 'lib/generators/asset_sync/install_generator.rb', line 14 def aws? [:provider] == 'AWS' end |
#aws_access_key_id ⇒ Object
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_key ⇒ Object
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_token ⇒ Object
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
26 27 28 |
# File 'lib/generators/asset_sync/install_generator.rb', line 26 def azure_rm? [:provider] == 'AzureRM' end |
#azure_storage_access_key ⇒ Object
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_name ⇒ Object
62 63 64 |
# File 'lib/generators/asset_sync/install_generator.rb', line 62 def azure_storage_account_name "<%= ENV['AZURE_STORAGE_ACCOUNT_NAME'] %>" end |
#b2_bucket_id ⇒ Object
78 79 80 |
# File 'lib/generators/asset_sync/install_generator.rb', line 78 def b2_bucket_id "<%= ENV['B2_BUCKET_ID'] %>" end |
#b2_key_id ⇒ Object
70 71 72 |
# File 'lib/generators/asset_sync/install_generator.rb', line 70 def b2_key_id "<%= ENV['B2_KEY_ID'] %>" end |
#b2_key_token ⇒ Object
74 75 76 |
# File 'lib/generators/asset_sync/install_generator.rb', line 74 def b2_key_token "<%= ENV['B2_KEY_TOKEN'] %>" end |
#backblaze? ⇒ Boolean
30 31 32 |
# File 'lib/generators/asset_sync/install_generator.rb', line 30 def backblaze? [:provider] == 'Backblaze' end |
#generate_config ⇒ Object
86 87 88 89 90 |
# File 'lib/generators/asset_sync/install_generator.rb', line 86 def generate_config if [:use_yml] template "asset_sync.yml", "config/asset_sync.yml" end end |
#generate_initializer ⇒ Object
92 93 94 95 96 |
# File 'lib/generators/asset_sync/install_generator.rb', line 92 def generate_initializer unless [:use_yml] template "asset_sync.rb", "config/initializers/asset_sync.rb" end end |
#google? ⇒ Boolean
18 19 20 |
# File 'lib/generators/asset_sync/install_generator.rb', line 18 def google? [:provider] == 'Google' end |
#google_storage_access_key_id ⇒ Object
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_key ⇒ Object
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
22 23 24 |
# File 'lib/generators/asset_sync/install_generator.rb', line 22 def rackspace? [:provider] == 'Rackspace' end |
#rackspace_api_key ⇒ Object
58 59 60 |
# File 'lib/generators/asset_sync/install_generator.rb', line 58 def rackspace_api_key "<%= ENV['RACKSPACE_API_KEY'] %>" end |
#rackspace_username ⇒ Object
54 55 56 |
# File 'lib/generators/asset_sync/install_generator.rb', line 54 def rackspace_username "<%= ENV['RACKSPACE_USERNAME'] %>" end |