git-lead-time 0.0.2 → 0.0.3

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: ca4d1acb0055545b95803f223fe78bfe42504173
4
- data.tar.gz: e09ac3a073fb2796a6569f2d72a2c7f4e97121f6
3
+ metadata.gz: bcfb5c614ffcd5563a78959b809db7d8f2a5eecc
4
+ data.tar.gz: e4828df586ef5745d824c6ca70068de7d17708de
5
5
  SHA512:
6
- metadata.gz: cfc91dafae1c5447a630ee6e4658d33bf0265bb4eaa628c655144378beedbe3a0aa692b0529414634992ab5f5362cfbf28d38b673f4903ab11e685629f40b13b
7
- data.tar.gz: 5fdd4a18bf65d7daebcf75b0514db48eda07c325e03c2bd1bd6e524a5b65aada316e298453f6669b09fcdf3fc68defa8a10de372131271c084fd096d2dedc7ad
6
+ metadata.gz: 846df02ae574988b48e9381481aae89d18998f207e3adc43a81018514790e1b3e3355ca0e6d9a2112885c7558ff394608b54a0802c5013356257719a01719a97
7
+ data.tar.gz: aa6ed022f7396a273bf2b410b86805ce4f4f0a3bda76b8cee9db5adf8a72835fa468620c6aa98b0cca41b977b68ea9989d45c42e03b6b9136ddde3a000051c17
@@ -1,6 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.1.1
4
+ env:
5
+ - TZ=US/Pacific
4
6
  before_script:
5
7
  - "git config --global user.email 'me@example.com'"
6
8
  - "git config --global user.name 'John Doe'"
@@ -1,3 +1,9 @@
1
+ ## 0.0.3
2
+
3
+ * Print all lines, one at a time, deal with being piped to `head`.
4
+ * Relax `business_time` version requirement.
5
+ * Deal with multiple timezones, everything is converted to local.
6
+
1
7
  ## 0.0.2
2
8
 
3
9
  * Take nights and weekends into account when calculating lead time.
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "business_time", "~>0.7.2"
21
+ spec.add_dependency "business_time", ">= 0.6.0"
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.5"
24
24
  spec.add_development_dependency "rake"
@@ -5,7 +5,7 @@ require_relative 'git_lead_time/calculator'
5
5
 
6
6
  module GitLeadTime
7
7
  def self.run
8
- puts LeadTimeCommand.new.run
8
+ LeadTimeCommand.new.run
9
9
  end
10
10
 
11
11
  def self.calculator
@@ -4,7 +4,7 @@ module GitLeadTime
4
4
  format = {
5
5
  subject: "%s",
6
6
  abbreviated_hash: "%h",
7
- date: "%cd",
7
+ date: "%ci",
8
8
  }.values_at(*fields).join("\n")
9
9
 
10
10
  `git show -s --format='#{format}' #{ref}`.lines.map(&:strip)
@@ -4,13 +4,18 @@ require_relative 'lead_time_format'
4
4
 
5
5
  module GitLeadTime
6
6
  class LeadTimeCommand
7
- attr_reader :branch, :ref
8
- def initialize(ref="HEAD")
7
+ attr_reader :branch, :output
8
+ def initialize(ref="HEAD", output: $stdout)
9
9
  @branch = Branch.new(ref)
10
+ @output = output
10
11
  end
11
12
 
12
13
  def run
13
- branch.each_merge.map { |merge| format_merge(merge) }
14
+ branch.each_merge do |merge|
15
+ output.puts format_merge(merge)
16
+ end
17
+ rescue Errno::EPIPE
18
+ # Our buffer got closed by `head` or the like.
14
19
  end
15
20
 
16
21
  def format_merge(merge)
@@ -8,7 +8,7 @@ module GitLeadTime
8
8
  end
9
9
 
10
10
  def each
11
- `git rev-list --merges --first-parent HEAD | head -10`.each_line do |rev|
11
+ `git rev-list --merges --first-parent HEAD`.each_line do |rev|
12
12
  yield rev.strip
13
13
  end
14
14
  end
@@ -1,3 +1,3 @@
1
1
  module GitLeadTime
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -31,5 +31,14 @@ module GitLeadTime
31
31
 
32
32
  expect(lead_time).to eq 1.0 / 8.0
33
33
  end
34
+
35
+ it "should deal with time zones" do
36
+ start_date = Time.parse "2014-03-20 17:36:27 -0400"
37
+ end_date = Time.parse "2014-03-20 16:18:37 -0700"
38
+
39
+ lead_time = calculator.lead_time(start_date: start_date, end_date: end_date)
40
+
41
+ expect(lead_time).to be > 0.2
42
+ end
34
43
  end
35
44
  end
@@ -5,7 +5,7 @@ module Support
5
5
  end
6
6
 
7
7
  def git_date(str)
8
- date(str).strftime("%a %b %-e %k:%M:%S %Y %z")
8
+ date(str).strftime("%Y-%m-%d %k:%M:%S %z")
9
9
  end
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-lead-time
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Jensen
@@ -14,16 +14,16 @@ dependencies:
14
14
  name: business_time
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.7.2
19
+ version: 0.6.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.7.2
26
+ version: 0.6.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement