ruby_fly 0.22.0.pre.1 → 0.26.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02aacdb7d522ae012be3b184467363d8e79b465d97cde5435e1ebd3ad8b6b70a
4
- data.tar.gz: 686badf9bf8a842165f6ebc8f83d2c9ce206b09c17f40c95fff3eb6a79364c7e
3
+ metadata.gz: f9009ca11dd23325ac48457a3e328ebbea4238b740a45c4d1eb632e77e7cf056
4
+ data.tar.gz: f88791482aa8f5e21b16ae05c829679898258ce09cc33eb757fd35099cc3ffcf
5
5
  SHA512:
6
- metadata.gz: 2103ce38418548a2e4db3a309be0bbe37f9670eea98e366862faae11c9c5b8e5ed914d3dd4810207173c37f117d48e529da59b977cfdd80b7f51ec13665be7cd
7
- data.tar.gz: 800e196b5efb033bdb6401437750e3bc6a756cf4dc7d55aa4849c94f66d3fba7b67230187a7e64e73618a785d572b571d4cbbb7ad959911ed04f36bd4eefdadd
6
+ metadata.gz: 7514713d9964c05883b85f4aaa09fff06d5508cb142ac6049ef435c413f029e50fbb05674d048be0b8b130fe0207c965e28b1afa0cedf21b0f5e9e793afd0952
7
+ data.tar.gz: 7b652df06e8441359f38fbb2513f06ee3d8d25effd293147cdf1b16ee1bfcfeefcc2d52d6f0f487e1cf4036955d577a6b6605fedfeb72f38bd57230ab1040d50
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby_fly (0.22.0.pre.1)
4
+ ruby_fly (0.26.0.pre.1)
5
5
  lino (>= 1.5)
6
6
 
7
7
  GEM
@@ -20,6 +20,10 @@ module RubyFly
20
20
  end
21
21
 
22
22
  module ClassMethods
23
+ def login(opts = {})
24
+ Commands::Login.new.execute(opts)
25
+ end
26
+
23
27
  def get_pipeline(opts = {})
24
28
  Commands::GetPipeline.new.execute(opts)
25
29
  end
@@ -1,3 +1,4 @@
1
+ require_relative 'commands/login'
1
2
  require_relative 'commands/get_pipeline'
2
3
  require_relative 'commands/set_pipeline'
3
4
  require_relative 'commands/unpause_pipeline'
@@ -44,6 +44,7 @@ module RubyFly
44
44
  end
45
45
 
46
46
  def configure_command(builder, opts)
47
+ builder
47
48
  end
48
49
 
49
50
  def do_after(opts)
@@ -1,10 +1,15 @@
1
1
  require 'lino'
2
2
  require_relative 'base'
3
+ require_relative 'mixins/environment'
3
4
 
4
5
  module RubyFly
5
6
  module Commands
6
7
  class GetPipeline < Base
8
+ include Mixins::Environment
9
+
7
10
  def configure_command(builder, opts)
11
+ builder = super(builder, opts)
12
+
8
13
  missing_params = [
9
14
  :target,
10
15
  :pipeline
@@ -0,0 +1,42 @@
1
+ require 'lino'
2
+ require_relative 'base'
3
+ require_relative 'mixins/environment'
4
+
5
+ module RubyFly
6
+ module Commands
7
+ class Login < Base
8
+ include Mixins::Environment
9
+
10
+ def configure_command(builder, opts)
11
+ builder = super(builder, opts)
12
+
13
+ missing_params = [
14
+ :target
15
+ ].select { |param| opts[param].nil? }
16
+
17
+ unless missing_params.empty?
18
+ description = missing_params.map { |p| "'#{p}'" }.join(', ')
19
+ raise(
20
+ ArgumentError,
21
+ "Error: #{description} required but not provided.")
22
+ end
23
+
24
+ target = opts[:target]
25
+ concourse_url = opts[:concourse_url]
26
+ username = opts[:username]
27
+ password = opts[:password]
28
+ team = opts[:team]
29
+
30
+ builder
31
+ .with_subcommand('login') do |sub|
32
+ sub = sub.with_option('-t', target)
33
+ sub = sub.with_option('-c', concourse_url) if concourse_url
34
+ sub = sub.with_option('-u', username) if username
35
+ sub = sub.with_option('-p', password) if password
36
+ sub = sub.with_option('-n', team) if team
37
+ sub
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,29 @@
1
+ module RubyFly
2
+ module Commands
3
+ module Mixins
4
+ module Environment
5
+ def initialize(opts={})
6
+ super(opts)
7
+ @environment = opts[:environment]
8
+ end
9
+
10
+ def for_environment(environment)
11
+ @environment = environment
12
+ self
13
+ end
14
+
15
+ def configure_command(builder, opts)
16
+ builder = super(builder, opts)
17
+ environment = opts[:environment] || @environment
18
+ if environment
19
+ builder = environment.to_a
20
+ .inject(builder) do |b, environment_variable|
21
+ b.with_environment_variable(*environment_variable)
22
+ end
23
+ end
24
+ builder
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -1,10 +1,15 @@
1
1
  require 'lino'
2
2
  require_relative 'base'
3
+ require_relative 'mixins/environment'
3
4
 
4
5
  module RubyFly
5
6
  module Commands
6
7
  class SetPipeline < Base
8
+ include Mixins::Environment
9
+
7
10
  def configure_command(builder, opts)
11
+ builder = super(builder, opts)
12
+
8
13
  missing_params = [
9
14
  :target,
10
15
  :pipeline,
@@ -1,10 +1,15 @@
1
1
  require 'lino'
2
2
  require_relative 'base'
3
+ require_relative 'mixins/environment'
3
4
 
4
5
  module RubyFly
5
6
  module Commands
6
7
  class UnpausePipeline < Base
8
+ include Mixins::Environment
9
+
7
10
  def configure_command(builder, opts)
11
+ builder = super(builder, opts)
12
+
8
13
  missing_params = [
9
14
  :target,
10
15
  :pipeline
@@ -174,6 +174,15 @@ module RubyFly
174
174
  @targets[target_name] = updated_target
175
175
  end
176
176
 
177
+ def add_or_update_target(target_name, &block)
178
+ mutable_target = has_target?(target_name) ?
179
+ find_target(target_name) :
180
+ Target.new({name: target_name})
181
+ block.call(mutable_target)
182
+ updated_target = Target.clone(mutable_target, name: target_name)
183
+ @targets[target_name] = updated_target
184
+ end
185
+
177
186
  def rename_target(old_target_name, new_target_name)
178
187
  old_target = find_target(old_target_name)
179
188
  new_target = Target.clone(old_target, name: new_target_name)
@@ -1,3 +1,3 @@
1
1
  module RubyFly
2
- VERSION = '0.22.0.pre.1'
2
+ VERSION = '0.26.0.pre.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_fly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.0.pre.1
4
+ version: 0.26.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toby Clemson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-03 00:00:00.000000000 Z
11
+ date: 2021-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lino
@@ -184,6 +184,8 @@ files:
184
184
  - lib/ruby_fly/commands.rb
185
185
  - lib/ruby_fly/commands/base.rb
186
186
  - lib/ruby_fly/commands/get_pipeline.rb
187
+ - lib/ruby_fly/commands/login.rb
188
+ - lib/ruby_fly/commands/mixins/environment.rb
187
189
  - lib/ruby_fly/commands/set_pipeline.rb
188
190
  - lib/ruby_fly/commands/unpause_pipeline.rb
189
191
  - lib/ruby_fly/commands/version.rb