Class: ConfigureS3Website::FileConfigSource
- Inherits:
-
ConfigSource
- Object
- ConfigSource
- ConfigureS3Website::FileConfigSource
- Defined in:
- lib/configure-s3-website/config_source/file_config_source.rb
Instance Method Summary collapse
- #cloudfront_distribution_config ⇒ Object
- #cloudfront_distribution_id ⇒ Object
- #cloudfront_distribution_id=(dist_id) ⇒ Object
- #description ⇒ Object
- #error_document ⇒ Object
- #index_document ⇒ Object
-
#initialize(yaml_file_path) ⇒ FileConfigSource
constructor
A new instance of FileConfigSource.
- #profile ⇒ Object
- #routing_rules ⇒ Object
- #s3_access_key_id ⇒ Object
- #s3_bucket_name ⇒ Object
- #s3_endpoint ⇒ Object
- #s3_secret_access_key ⇒ Object
Constructor Details
#initialize(yaml_file_path) ⇒ FileConfigSource
Returns a new instance of FileConfigSource.
6 7 8 9 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 6 def initialize(yaml_file_path) @yaml_file_path = yaml_file_path @config = FileConfigSource.parse_config yaml_file_path end |
Instance Method Details
#cloudfront_distribution_config ⇒ Object
52 53 54 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 52 def cloudfront_distribution_config @config['cloudfront_distribution_config'] end |
#cloudfront_distribution_id ⇒ Object
56 57 58 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 56 def cloudfront_distribution_id @config['cloudfront_distribution_id'] end |
#cloudfront_distribution_id=(dist_id) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 60 def cloudfront_distribution_id=(dist_id) @config['cloudfront_distribution_id'] = dist_id file_contents = File.open(@yaml_file_path).read File.open(@yaml_file_path, 'w') do |file| result = file_contents.gsub( /(s3_bucket:.*$)/, "\\1\ncloudfront_distribution_id: #{dist_id}" ) file.write result end end |
#description ⇒ Object
11 12 13 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 11 def description @yaml_file_path end |
#error_document ⇒ Object
48 49 50 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 48 def error_document @config['error_document'] end |
#index_document ⇒ Object
44 45 46 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 44 def index_document @config['index_document'] end |
#profile ⇒ Object
23 24 25 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 23 def profile @config['profile'] end |
#routing_rules ⇒ Object
40 41 42 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 40 def routing_rules @config['routing_rules'] end |
#s3_access_key_id ⇒ Object
15 16 17 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 15 def s3_access_key_id @config['s3_id'] end |
#s3_bucket_name ⇒ Object
27 28 29 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 27 def s3_bucket_name @config['s3_bucket'] end |
#s3_endpoint ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 31 def s3_endpoint endpoint = @config['s3_endpoint'] || 'us-east-1' if endpoint == 'EU' 'eu-west-1' else endpoint end end |
#s3_secret_access_key ⇒ Object
19 20 21 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 19 def s3_secret_access_key @config['s3_secret'] end |