ruby_fly 0.23.0 → 0.28.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/ruby_fly.rb +12 -1
- data/lib/ruby_fly/commands.rb +2 -0
- data/lib/ruby_fly/commands/base.rb +5 -13
- data/lib/ruby_fly/commands/get_pipeline.rb +5 -0
- data/lib/ruby_fly/commands/login.rb +42 -0
- data/lib/ruby_fly/commands/mixins/environment.rb +29 -0
- data/lib/ruby_fly/commands/set_pipeline.rb +5 -0
- data/lib/ruby_fly/commands/status.rb +54 -0
- data/lib/ruby_fly/commands/unpause_pipeline.rb +5 -0
- data/lib/ruby_fly/version.rb +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df53a98dc14d09cb09532166d5b4284041a12626c7e5006c7bee75984b63d517
|
4
|
+
data.tar.gz: 3aa60fd2315ceb3459672cc372037a5b9790cb88d18ed25a24480518f0dd17ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b10280580120e377d99182136649fc1f0c2ea4cded7255b2d10b4310f869711c373d7a8634a3239e1c8c670b3df95d040b098802e374cefc5e5fb3fe9c1f3b4
|
7
|
+
data.tar.gz: 8c85b694601460932878fd86aeb98a02cf1769b3d1d70294423ae154508ee369d9d1d141165cc5dc4f9a123384e2cc23a904ae824b3295856a079202788a5808
|
data/Gemfile.lock
CHANGED
data/lib/ruby_fly.rb
CHANGED
@@ -20,6 +20,14 @@ module RubyFly
|
|
20
20
|
end
|
21
21
|
|
22
22
|
module ClassMethods
|
23
|
+
def login(opts = {})
|
24
|
+
Commands::Login.new.execute(opts)
|
25
|
+
end
|
26
|
+
|
27
|
+
def status(opts = {})
|
28
|
+
Commands::Status.new.execute(opts)
|
29
|
+
end
|
30
|
+
|
23
31
|
def get_pipeline(opts = {})
|
24
32
|
Commands::GetPipeline.new.execute(opts)
|
25
33
|
end
|
@@ -43,10 +51,13 @@ module RubyFly
|
|
43
51
|
end
|
44
52
|
|
45
53
|
class Configuration
|
46
|
-
attr_accessor :binary
|
54
|
+
attr_accessor :binary, :stdin, :stdout, :stderr
|
47
55
|
|
48
56
|
def initialize
|
49
57
|
@binary = 'fly'
|
58
|
+
@stdin = ''
|
59
|
+
@stdout = $stdout
|
60
|
+
@stderr = $stderr
|
50
61
|
end
|
51
62
|
end
|
52
63
|
end
|
data/lib/ruby_fly/commands.rb
CHANGED
@@ -3,22 +3,13 @@ require 'lino'
|
|
3
3
|
module RubyFly
|
4
4
|
module Commands
|
5
5
|
class Base
|
6
|
-
attr_reader :binary
|
6
|
+
attr_reader :binary, :stdin, :stdout, :stderr
|
7
7
|
|
8
8
|
def initialize(binary: nil)
|
9
9
|
@binary = binary || RubyFly.configuration.binary
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
''
|
14
|
-
end
|
15
|
-
|
16
|
-
def stdout
|
17
|
-
STDOUT
|
18
|
-
end
|
19
|
-
|
20
|
-
def stderr
|
21
|
-
STDERR
|
10
|
+
@stdin = stdin || RubyFly.configuration.stdin
|
11
|
+
@stdout = stdout || RubyFly.configuration.stdout
|
12
|
+
@stderr = stderr || RubyFly.configuration.stderr
|
22
13
|
end
|
23
14
|
|
24
15
|
def execute(opts = {})
|
@@ -44,6 +35,7 @@ module RubyFly
|
|
44
35
|
end
|
45
36
|
|
46
37
|
def configure_command(builder, opts)
|
38
|
+
builder
|
47
39
|
end
|
48
40
|
|
49
41
|
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,
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'lino'
|
2
|
+
require_relative 'base'
|
3
|
+
require_relative 'mixins/environment'
|
4
|
+
|
5
|
+
module RubyFly
|
6
|
+
module Commands
|
7
|
+
class Status < Base
|
8
|
+
include Mixins::Environment
|
9
|
+
|
10
|
+
def initialize(*args)
|
11
|
+
super(*args)
|
12
|
+
@stdout = StringIO.new unless
|
13
|
+
(defined?(@stdout) && @stdout.respond_to?(:string))
|
14
|
+
@stderr = StringIO.new unless
|
15
|
+
(defined?(@stderr) && @stderr.respond_to?(:string))
|
16
|
+
end
|
17
|
+
|
18
|
+
def configure_command(builder, opts)
|
19
|
+
builder = super(builder, opts)
|
20
|
+
|
21
|
+
missing_params = [
|
22
|
+
:target
|
23
|
+
].select { |param| opts[param].nil? }
|
24
|
+
|
25
|
+
unless missing_params.empty?
|
26
|
+
description = missing_params.map { |p| "'#{p}'" }.join(', ')
|
27
|
+
raise(
|
28
|
+
ArgumentError,
|
29
|
+
"Error: #{description} required but not provided.")
|
30
|
+
end
|
31
|
+
|
32
|
+
target = opts[:target]
|
33
|
+
|
34
|
+
builder
|
35
|
+
.with_subcommand('status') do |sub|
|
36
|
+
sub = sub.with_option('-t', target)
|
37
|
+
sub
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def do_after(opts)
|
42
|
+
output = stdout.string
|
43
|
+
error = stderr.string
|
44
|
+
|
45
|
+
return :logged_in if output =~ /logged in successfully/
|
46
|
+
return :logged_out if error =~ /logged out/
|
47
|
+
return :session_expired if error =~ /please login again/
|
48
|
+
return :unknown_target if error =~ /error: unknown target/
|
49
|
+
|
50
|
+
:unknown_status
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
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 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
|
data/lib/ruby_fly/version.rb
CHANGED
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.
|
4
|
+
version: 0.28.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-
|
11
|
+
date: 2021-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lino
|
@@ -184,7 +184,10 @@ 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
|
190
|
+
- lib/ruby_fly/commands/status.rb
|
188
191
|
- lib/ruby_fly/commands/unpause_pipeline.rb
|
189
192
|
- lib/ruby_fly/commands/version.rb
|
190
193
|
- lib/ruby_fly/rc.rb
|
@@ -204,9 +207,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
204
207
|
version: '2.6'
|
205
208
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
206
209
|
requirements:
|
207
|
-
- - "
|
210
|
+
- - ">"
|
208
211
|
- !ruby/object:Gem::Version
|
209
|
-
version:
|
212
|
+
version: 1.3.1
|
210
213
|
requirements: []
|
211
214
|
rubygems_version: 3.0.1
|
212
215
|
signing_key:
|