beam_up 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55ab9d14c6fe9bb0bdb38f023f1242f174b538b117c5d0f95fabe6231ad6f745
4
- data.tar.gz: 3859429f3775c52781da38cf040ae2cbd4d246a7062255cd0aaee0dd79a8e0c9
3
+ metadata.gz: b10eded0c9811a845155eaaa6a83ccfc37d958ce58e59ec30a3b022f8fbc13b6
4
+ data.tar.gz: adc80ce6a37bf79bc0db5d055c574ab114968d8049eb3a7b9a27cf09596c0fda
5
5
  SHA512:
6
- metadata.gz: 5f4e221e74c4661c0df1cc5d1287ee69bb6e025762fd8a9e4df1e4739629219195e547cc7742e1b9420ac35d15fcb0208f060f5541a535198bc9eba9fdfb4530
7
- data.tar.gz: 4e51baca30f01370cdd292fd3f4ee0bd47dbb67c4800c7416f1b52a644bcd08a535afd0587cd075ccc7180c0fddba2c50c09789d71e37624c00e7bfa1e8bc8da
6
+ metadata.gz: 33588c7eca1e972fcb51ee9d0fa5356920d1551a0d16ba73498551b74dd3c6c6fbbdb164b8de7e15e95270d9950ed418ae50c68372b7fe70dacd378e3fad1645
7
+ data.tar.gz: aa8624dc95de22e7ad7e915b78c0cb9b994d7f5920723c4d24d0e1cf63b08bf03ad54d345dbfb3ace3af794d97d317b93e6762be3beb773e4bcf4b15a194607a
data/lib/beam_up/cli.rb CHANGED
@@ -10,6 +10,7 @@ module BeamUp
10
10
  def initialize(arguments)
11
11
  @arguments = arguments
12
12
  @provider = nil
13
+ @config_file = nil
13
14
  end
14
15
 
15
16
  def run
@@ -81,7 +82,7 @@ module BeamUp
81
82
  def deploy
82
83
  input = parse_options
83
84
 
84
- beamed = BeamUp.deploy! input, provider: @provider
85
+ beamed = BeamUp.deploy! input, provider: @provider, config_file: @config_file
85
86
 
86
87
  puts beamed.message
87
88
  puts "Deploy ID: #{beamed.deploy_id}" if beamed.deploy_id
@@ -150,11 +151,13 @@ module BeamUp
150
151
  beam_up [FOLDER] # Deploy using .beam_up.yml config
151
152
  beam_up [FOLDER] --to PROVIDER # Deploy with provider override
152
153
  beam_up [FOLDER] --provider PROVIDER # Alias for --to
154
+ beam_up [FOLDER] --config FILE # Use a specific config file
153
155
 
154
156
  Examples:
155
157
  beam_up init netlify
156
158
  beam_up ./output
157
159
  beam_up ./output --to aws_s3
160
+ beam_up ./output --config /path/to/config.yml
158
161
  HELP
159
162
 
160
163
  exit
@@ -174,6 +177,10 @@ module BeamUp
174
177
  @provider = value
175
178
  end
176
179
 
180
+ options.on("--config FILE", "Use a specific config file") do |value|
181
+ @config_file = value
182
+ end
183
+
177
184
  options.on("--help", "-h", "Show this help") do
178
185
  help
179
186
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module BeamUp
4
4
  class Configuration
5
- attr_accessor :provider, :path, :before_actions, :after_actions, :timeout
5
+ attr_accessor :provider, :path, :before_actions, :after_actions, :timeout, :config_file
6
6
 
7
7
  DEFAULT_TIMEOUT = 300 # 5 minutes
8
8
 
data/lib/beam_up/core.rb CHANGED
@@ -5,16 +5,23 @@ require "yaml"
5
5
  module BeamUp
6
6
  class Core
7
7
  class << self
8
- def configure
8
+ def configure(&block)
9
9
  yield(configuration)
10
10
  end
11
11
 
12
- def configuration
13
- @configuration ||= configuration_file || raise(ConfigurationError, "No .beam_up.yml found. Run `beam_up init PROVIDER` to create one.")
12
+ attr_writer :config_file
13
+
14
+ def configuration(config_file: nil)
15
+ @configuration ||= begin
16
+ custom_path = config_file || @config_file || ((@configuration&.config_file && File.exist?(@configuration.config_file)) ? @configuration.config_file : nil)
17
+ config = custom_path ? configuration_file(custom_path) : configuration_file
18
+
19
+ config || raise(ConfigurationError, "No .beam_up.yml found. Run `beam_up init PROVIDER` to create one.")
20
+ end
14
21
  end
15
22
 
16
- def deploy!(path = nil, provider: nil)
17
- config = configuration_file
23
+ def deploy!(path = nil, provider: nil, config_file: nil)
24
+ config = configuration(config_file: config_file)
18
25
  config.provider = provider if provider
19
26
 
20
27
  deploy_path = path || config.path || raise(ConfigurationError, "No path specified")
@@ -33,9 +40,10 @@ module BeamUp
33
40
 
34
41
  private
35
42
 
36
- def configuration_file
37
- file = ["config/beam_up.yml", ".beam_up.yml"].find { File.exist?(it) }
38
- return nil unless file
43
+ def configuration_file(custom_path = nil)
44
+ file = custom_path || ["config/beam_up.yml", ".beam_up.yml"].find { File.exist?(it) }
45
+
46
+ return nil unless file && File.exist?(file)
39
47
 
40
48
  data = YAML.safe_load_file(file)
41
49
 
@@ -1,3 +1,3 @@
1
1
  module BeamUp
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
data/lib/beam_up.rb CHANGED
@@ -24,8 +24,12 @@ module BeamUp
24
24
  class << self
25
25
  def configure(&block) = Core.configure(&block)
26
26
 
27
- def configuration = Core.configuration
27
+ def config_file=(path)
28
+ Core.config_file = path
29
+ end
28
30
 
29
- def deploy!(path = nil, provider: nil, to: nil) = Core.deploy!(path, provider: (to || provider)&.to_s)
31
+ def configuration(config_file: nil) = Core.configuration(config_file: config_file)
32
+
33
+ def deploy!(path = nil, provider: nil, to: nil, config_file: nil) = Core.deploy!(path, provider: (to || provider)&.to_s, config_file: config_file)
30
34
  end
31
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beam_up
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rails Designer