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.
- #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
43 44 45 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 43 def cloudfront_distribution_config @config['cloudfront_distribution_config'] end |
#cloudfront_distribution_id ⇒ Object
47 48 49 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 47 def cloudfront_distribution_id @config['cloudfront_distribution_id'] end |
#cloudfront_distribution_id=(dist_id) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 51 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
39 40 41 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 39 def error_document @config['error_document'] end |
#index_document ⇒ Object
35 36 37 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 35 def index_document @config['index_document'] end |
#routing_rules ⇒ Object
31 32 33 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 31 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
23 24 25 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 23 def s3_bucket_name @config['s3_bucket'] end |
#s3_endpoint ⇒ Object
27 28 29 |
# File 'lib/configure-s3-website/config_source/file_config_source.rb', line 27 def s3_endpoint @config['s3_endpoint'] 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 |