Class: BranchableCDNAssets::Config
- Inherits:
-
Object
- Object
- BranchableCDNAssets::Config
- Extended by:
- EnvironmentAttributeReader::ClassMethods
- Includes:
- EnvironmentAttributeReader
- Defined in:
- lib/branchable_cdn_assets/config.rb,
lib/branchable_cdn_assets/config/environment_attribute_reader.rb
Defined Under Namespace
Modules: EnvironmentAttributeReader Classes: Remote
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#cdn_dir ⇒ Object
readonly
Returns the value of attribute cdn_dir.
-
#cloudfront ⇒ Object
readonly
Returns the value of attribute cloudfront.
-
#dir_permissions ⇒ Object
readonly
Returns the value of attribute dir_permissions.
-
#file_permissions ⇒ Object
readonly
Returns the value of attribute file_permissions.
-
#production_branch ⇒ Object
readonly
Returns the value of attribute production_branch.
-
#raw_data ⇒ Object
readonly
Returns the value of attribute raw_data.
-
#rsync_flags ⇒ Object
readonly
Returns the value of attribute rsync_flags.
Instance Method Summary collapse
- #env ⇒ Object
- #environments ⇒ Object
-
#initialize(data, branch = Asgit.current_branch) ⇒ Config
constructor
A new instance of Config.
- #remotes ⇒ Object
Methods included from EnvironmentAttributeReader::ClassMethods
Methods included from EnvironmentAttributeReader
Constructor Details
#initialize(data, branch = Asgit.current_branch) ⇒ Config
Returns a new instance of Config.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/branchable_cdn_assets/config.rb', line 13 def initialize data, branch=Asgit.current_branch @raw_data = normalize_data data @branch = branch @production_branch = raw_data.fetch :production_branch, 'master' @cloudfront = raw_data.fetch :cloudfront, {} @cdn_dir = raw_data.fetch :dir, 'cdn' @dir_permissions = env_attr(:dir_permissions) || 755 @file_permissions = env_attr(:file_permissions) || 644 @rsync_flags = env_attr(:rsync_flags) || '-aviz' end |
Instance Attribute Details
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
8 9 10 |
# File 'lib/branchable_cdn_assets/config.rb', line 8 def branch @branch end |
#cdn_dir ⇒ Object (readonly)
Returns the value of attribute cdn_dir.
8 9 10 |
# File 'lib/branchable_cdn_assets/config.rb', line 8 def cdn_dir @cdn_dir end |
#cloudfront ⇒ Object (readonly)
Returns the value of attribute cloudfront.
8 9 10 |
# File 'lib/branchable_cdn_assets/config.rb', line 8 def cloudfront @cloudfront end |
#dir_permissions ⇒ Object (readonly)
Returns the value of attribute dir_permissions.
8 9 10 |
# File 'lib/branchable_cdn_assets/config.rb', line 8 def @dir_permissions end |
#file_permissions ⇒ Object (readonly)
Returns the value of attribute file_permissions.
8 9 10 |
# File 'lib/branchable_cdn_assets/config.rb', line 8 def @file_permissions end |
#production_branch ⇒ Object (readonly)
Returns the value of attribute production_branch.
8 9 10 |
# File 'lib/branchable_cdn_assets/config.rb', line 8 def production_branch @production_branch end |
#raw_data ⇒ Object (readonly)
Returns the value of attribute raw_data.
8 9 10 |
# File 'lib/branchable_cdn_assets/config.rb', line 8 def raw_data @raw_data end |
#rsync_flags ⇒ Object (readonly)
Returns the value of attribute rsync_flags.
8 9 10 |
# File 'lib/branchable_cdn_assets/config.rb', line 8 def rsync_flags @rsync_flags end |
Instance Method Details
#env ⇒ Object
25 26 27 |
# File 'lib/branchable_cdn_assets/config.rb', line 25 def env @env ||= env_for_branch end |
#environments ⇒ Object
29 30 31 |
# File 'lib/branchable_cdn_assets/config.rb', line 29 def environments @environments ||= add_env_path_modifications_to_env_data raw_data.fetch(:environments, {}) end |
#remotes ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/branchable_cdn_assets/config.rb', line 33 def remotes return @_remotes if @_remotes @_remotes = environments[env.to_sym].fetch(:remotes, [default_remote]).map do |r| remote = Remote.new default_remote.merge( normalize_data(r) ).each do |k, v| remote.public_send "#{k}=", v end remote end end |