right_git 1.0.2 → 1.1.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
  SHA1:
3
- metadata.gz: 6060a32522b3f9983de8c6e66290e28a3f0ff883
4
- data.tar.gz: 72b6679ef1fc9e57c1bd99ad1fa5a01ac58f9456
3
+ metadata.gz: c4536d2f26b3ecd60c9159828de9ca5f1d901846
4
+ data.tar.gz: 7e7076ee4adada10701aaab896a9d0cf40a5c27f
5
5
  SHA512:
6
- metadata.gz: 5f994c2e443278716b2341e79ee9d03c17b1df2b3f7f5ef2a1a806603b1576aee1b16a3fd22d1d9b3e8fb8da6007c57d18dfe0fc46f613c11e77b76d725c2ffc
7
- data.tar.gz: fc896ba323027a2d8993f36119f4f2acb2e2fcf221c7ca1cab2e5e00548dc1fa2499bc7b4f9011fa59dd00c76273be814a9a7ad843d5cb28a58ae2ee4fba2c31
6
+ metadata.gz: 81a3ae19ffc5d137846b36ec398dcb9f4ab217a40f4f24a68e9f32cbdd36723a956677e59f321f6685f6a1158eb9029be8ef73fae44fc749c92b9b9b08037199
7
+ data.tar.gz: 00786171049f4b81b81ed92299b770fc8ed6e9bb6335f035e5df4a8e5a0b873239a1febdd5cb6d77766a2cc3fc2ceca0a8641b850949c05fbdc87b123656e00b
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.1.1
@@ -26,6 +26,7 @@ require 'right_git/shell'
26
26
  # local
27
27
  require 'stringio'
28
28
  require 'singleton'
29
+ require 'right_support'
29
30
 
30
31
  module RightGit::Shell
31
32
 
@@ -42,18 +43,35 @@ module RightGit::Shell
42
43
  # Implements execute interface.
43
44
  def execute(cmd, options = {})
44
45
  options = {
45
- :directory => nil,
46
- :outstream => nil,
46
+ :directory => nil,
47
+ :outstream => nil,
47
48
  :raise_on_failure => true,
48
- :set_env_vars => nil,
49
- :clear_env_vars => nil,
50
- :logger => default_logger,
51
- :timeout => nil,
49
+ :set_env_vars => nil,
50
+ :clear_env_vars => nil,
51
+ :logger => default_logger,
52
+ :timeout => nil,
53
+ :keep_alive_interval => nil,
54
+ :keep_alive_timeout => nil
52
55
  }.merge(options)
53
- outstream = options[:outstream]
54
56
 
57
+ outstream = options[:outstream]
55
58
  logger = options[:logger]
56
59
 
60
+ if keep_alive_interval = options[:keep_alive_interval]
61
+ keep_alive_wake_time = ::Time.now + keep_alive_interval
62
+ else
63
+ keep_alive_wake_time = nil
64
+ end
65
+ if keep_alive_timeout = options[:keep_alive_timeout]
66
+ unless keep_alive_interval
67
+ raise ::ArgumentError,
68
+ ':keep_alive_interval is required when using :keep_alive_timeout'
69
+ end
70
+ keep_alive_stop_time = ::Time.now + keep_alive_timeout
71
+ else
72
+ keep_alive_stop_time = nil
73
+ end
74
+
57
75
  # build initial popener.
58
76
  exitstatus = nil
59
77
  popener = lambda do |output|
@@ -68,9 +86,24 @@ module RightGit::Shell
68
86
  data = data.strip
69
87
  logger.info(data) unless data.empty?
70
88
  end
89
+
90
+ # reset keep alive timer whenever we have normal output.
91
+ if keep_alive_wake_time
92
+ keep_alive_wake_time = ::Time.now + keep_alive_interval
93
+ end
71
94
  else
72
95
  break
73
96
  end
97
+ elsif keep_alive_wake_time
98
+ now = ::Time.now
99
+ if keep_alive_stop_time && now >= keep_alive_stop_time
100
+ keep_alive_wake_time = nil
101
+ elsif now >= keep_alive_wake_time
102
+ # keep-alives go to logger, not the outstream, if any.
103
+ logger.info('.')
104
+ keep_alive_wake_time = now + keep_alive_interval
105
+ end
106
+ now = nil
74
107
  end
75
108
  end
76
109
  end
@@ -43,12 +43,28 @@ module RightGit::Shell
43
43
  #
44
44
  # @param [String] cmd the shell command to run
45
45
  # @param [Hash] options for execution
46
- # @option options :directory [String] to use as working directory during command execution or nil
47
- # @option options :outstream [IO] output stream to receive STDOUT and STDERR from command (default = STDOUT)
48
- # @option options :raise_on_failure [TrueClass|FalseClass] if true, wil raise a RuntimeError if the command does not end successfully (default), false to ignore errors
49
- # @option options :set_env_vars [Hash] environment variables to set during execution (default = none set)
50
- # @option options :clear_env_vars [Hash] environment variables to clear during execution (default = none cleared but see :clean_bundler_env)
51
- # @option options :timeout [Numeric] to kill spawned process when time (in seconds) expires
46
+ # @option options :directory [String] to use as working directory during
47
+ # command execution or nil
48
+ # @option options :outstream [IO] output stream to receive STDOUT and
49
+ # STDERR from command (default = STDOUT)
50
+ # @option options :raise_on_failure [TrueClass|FalseClass] if true, will
51
+ # raise a RuntimeError if the command does not end successfully (default), false to ignore errors
52
+ # @option options :set_env_vars [Hash] environment variables to set during
53
+ # execution (default = none set)
54
+ # @option options :clear_env_vars [Hash] environment variables to clear
55
+ # during execution (default = none cleared but see :clean_bundler_env)
56
+ # @option options :timeout [Numeric] to kill spawned process when time
57
+ # (in seconds) expires
58
+ # @option options :keep_alive_interval [Numeric] as periodic timer, in
59
+ # seconds, for emitting output to keep travis ci from killing job or nil
60
+ # to remain silent (default). note that keep-alives are always written to
61
+ # the logger even if command output is being captured by :outstream
62
+ # @option options :keep_alive_timeout [Numeric] as overall timeout, in
63
+ # seconds, for periodically emitting shell output when child process is
64
+ # silent, which prevents travis ci from killing a silent job, or nil to
65
+ # remain silent (default). can be combined with :timeout to ensure child
66
+ # process is kept alive for a maximum amount of time before it will be
67
+ # abandoned.
52
68
  #
53
69
  # @return [Integer] exitstatus of the command
54
70
  #
data/right_git.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: right_git 1.0.2 ruby lib
5
+ # stub: right_git 1.1.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "right_git"
9
- s.version = "1.0.2"
9
+ s.version = "1.1.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Tony Spataro", "Scott Messier"]
14
- s.date = "2015-01-07"
14
+ s.date = "2015-10-16"
15
15
  s.description = "An assortment of git-related classes created by RightScale."
16
16
  s.email = "support@rightscale.com"
17
17
  s.extra_rdoc_files = [
@@ -40,7 +40,7 @@ Gem::Specification.new do |s|
40
40
  ]
41
41
  s.homepage = "https://github.com/rightscale/right_git"
42
42
  s.licenses = ["MIT"]
43
- s.rubygems_version = "2.2.2"
43
+ s.rubygems_version = "2.2.3"
44
44
  s.summary = "Reusable Git repository management code."
45
45
 
46
46
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_git
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Spataro
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-07 00:00:00.000000000 Z
12
+ date: 2015-10-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: right_support
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  version: '0'
142
142
  requirements: []
143
143
  rubyforge_project:
144
- rubygems_version: 2.2.2
144
+ rubygems_version: 2.2.3
145
145
  signing_key:
146
146
  specification_version: 4
147
147
  summary: Reusable Git repository management code.