ruby_fly 0.27.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a51cab475fee762ba99cafe67c2e797d22c3d9f564b23e1b3e4ebb2fb133d13
4
- data.tar.gz: ce8399a8af389013f0836adf870fd04a34e13a82b27a2d3818cee6662473dc9f
3
+ metadata.gz: df53a98dc14d09cb09532166d5b4284041a12626c7e5006c7bee75984b63d517
4
+ data.tar.gz: 3aa60fd2315ceb3459672cc372037a5b9790cb88d18ed25a24480518f0dd17ad
5
5
  SHA512:
6
- metadata.gz: '0828f4b252f8b18337b63f46f287563caa83b8535af96d13bb9e73568f8b075f9ba3d70983fc01587dced3ff4c5e5da19268ce537663c00d03ff65256b7000eb'
7
- data.tar.gz: 863c71bc854bd329fd1735537d38cb23715a5463fdf03c1d9db71787a7ef73769ca4ad102c9d36032436a92bf340e72f440828bc5aa2ef0c159ea8a6912804dd
6
+ metadata.gz: 6b10280580120e377d99182136649fc1f0c2ea4cded7255b2d10b4310f869711c373d7a8634a3239e1c8c670b3df95d040b098802e374cefc5e5fb3fe9c1f3b4
7
+ data.tar.gz: 8c85b694601460932878fd86aeb98a02cf1769b3d1d70294423ae154508ee369d9d1d141165cc5dc4f9a123384e2cc23a904ae824b3295856a079202788a5808
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby_fly (0.27.0)
4
+ ruby_fly (0.28.0.pre.1)
5
5
  lino (>= 1.5)
6
6
 
7
7
  GEM
@@ -24,6 +24,10 @@ module RubyFly
24
24
  Commands::Login.new.execute(opts)
25
25
  end
26
26
 
27
+ def status(opts = {})
28
+ Commands::Status.new.execute(opts)
29
+ end
30
+
27
31
  def get_pipeline(opts = {})
28
32
  Commands::GetPipeline.new.execute(opts)
29
33
  end
@@ -47,10 +51,13 @@ module RubyFly
47
51
  end
48
52
 
49
53
  class Configuration
50
- attr_accessor :binary
54
+ attr_accessor :binary, :stdin, :stdout, :stderr
51
55
 
52
56
  def initialize
53
57
  @binary = 'fly'
58
+ @stdin = ''
59
+ @stdout = $stdout
60
+ @stderr = $stderr
54
61
  end
55
62
  end
56
63
  end
@@ -1,4 +1,5 @@
1
1
  require_relative 'commands/login'
2
+ require_relative 'commands/status'
2
3
  require_relative 'commands/get_pipeline'
3
4
  require_relative 'commands/set_pipeline'
4
5
  require_relative 'commands/unpause_pipeline'
@@ -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
- end
11
-
12
- def stdin
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 = {})
@@ -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,3 +1,3 @@
1
1
  module RubyFly
2
- VERSION = '0.27.0'
2
+ VERSION = '0.28.0.pre.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_fly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.0
4
+ version: 0.28.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toby Clemson
@@ -187,6 +187,7 @@ files:
187
187
  - lib/ruby_fly/commands/login.rb
188
188
  - lib/ruby_fly/commands/mixins/environment.rb
189
189
  - lib/ruby_fly/commands/set_pipeline.rb
190
+ - lib/ruby_fly/commands/status.rb
190
191
  - lib/ruby_fly/commands/unpause_pipeline.rb
191
192
  - lib/ruby_fly/commands/version.rb
192
193
  - lib/ruby_fly/rc.rb
@@ -206,9 +207,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
206
207
  version: '2.6'
207
208
  required_rubygems_version: !ruby/object:Gem::Requirement
208
209
  requirements:
209
- - - ">="
210
+ - - ">"
210
211
  - !ruby/object:Gem::Version
211
- version: '0'
212
+ version: 1.3.1
212
213
  requirements: []
213
214
  rubygems_version: 3.0.1
214
215
  signing_key: