yes_ship_it 0.1.0 → 0.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: 78b481295a4a4a9ba607adb08eec58bac7f207a0
4
- data.tar.gz: c8b0e1378e39c261db0c58c6858bfbf7c9cca3fd
3
+ metadata.gz: 5ac91756b1bb840377155a902332884700512392
4
+ data.tar.gz: 8082dd501a30d1b6cc9957e2b138011b01e6e4a9
5
5
  SHA512:
6
- metadata.gz: 51adeca1f94982d83fe0f7f089b1e40630da8d7da5324a2907edf1cda869fc40b63abbee3f1bdf77be9710c8a9b08380d186c958347898d6691af094f69c4d02
7
- data.tar.gz: c6e49865aa4a412d8677326febf8ed07361b921569b04566a57fbd22d28cec6b511b0cbe43f8fcc2f1d7872b7efa71b03641e9ad58b3c35e0486dd581edfa6fe
6
+ metadata.gz: 7e1aed4610021735afbf02647af9d66c4580131b27d0da3ac2db3b686e405d56f4652688fd00d1632ae6784d97031ba9e20a0434de2e6a100fcaed5761176b71
7
+ data.tar.gz: a48fe139e07ad8d7ad333ec18f1806e84cc83c294fa7810058bbf9395ce7d91c661bb369c01d10becfbcd21afa8c99b4a746b63b565b3c24fbd52b2b8f1b6c55
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change log of yes_ship_it
2
2
 
3
+ ## Version 0.1.1
4
+
5
+ * Fix failure in `yes_it_shipped` assertion when parsing tag date
6
+
3
7
  ## Version 0.1.0
4
8
 
5
9
  yes_ship_it has reached a useful state, so it's going to a version scheme which
data/assertions/tag.rb CHANGED
@@ -10,14 +10,21 @@ module YSI
10
10
  @engine.tag
11
11
  end
12
12
 
13
+ def get_tag_date(executor)
14
+ output = executor.run_command(["git", "show", tag])
15
+ if output
16
+ output.each_line do |show_line|
17
+ if show_line =~ /Date:\s+(.*)/
18
+ @engine.tag_date = Time.parse($1)
19
+ end
20
+ end
21
+ end
22
+ end
23
+
13
24
  def check
14
25
  Executor.new.run_command(["git", "tag"]).each_line do |line|
15
26
  if line.chomp == tag
16
- Executor.new.run_command(["git", "show", tag]).each_line do |show_line|
17
- if show_line =~ /Date:\s+(.*)/
18
- @engine.tag_date = $1
19
- end
20
- end
27
+ get_tag_date(YSI::Executor.new)
21
28
  return tag
22
29
  end
23
30
  end
@@ -26,6 +33,7 @@ module YSI
26
33
 
27
34
  def assert(executor)
28
35
  executor.run_command(["git", "tag", "-a", tag, "-m", engine.version])
36
+ get_tag_date(executor)
29
37
  tag
30
38
  end
31
39
  end
@@ -18,7 +18,7 @@ module YSI
18
18
  def assert(executor)
19
19
  executor.http_post("https://yes-it-shipped.herokuapp.com/releases",
20
20
  project: engine.project_name, version: engine.version,
21
- release_date_time: engine.tag_date.utc, project_url: engine.project_url,
21
+ release_date_time: engine.tag_date, project_url: engine.project_url,
22
22
  release_url: engine.release_url, ysi_config_url: engine.config_url)
23
23
  "#{engine.project_name}-#{engine.version}"
24
24
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module YSI
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -2,7 +2,8 @@ module YSI
2
2
  class Engine
3
3
  attr_reader :assertions
4
4
  attr_reader :executor
5
- attr_accessor :version, :tag_date, :release_archive
5
+ attr_writer :tag_date
6
+ attr_accessor :version, :release_archive
6
7
  attr_accessor :out
7
8
  attr_accessor :data_dir
8
9
 
@@ -96,6 +97,10 @@ module YSI
96
97
  "v#{version}"
97
98
  end
98
99
 
100
+ def tag_date
101
+ @tag_date && @tag_date.utc
102
+ end
103
+
99
104
  def release_archive_file_name
100
105
  File.basename(release_archive)
101
106
  end
data/lib/yes_ship_it.rb CHANGED
@@ -5,6 +5,7 @@ require "inifile"
5
5
  require "rexml/document"
6
6
  require "erb"
7
7
  require "cheetah"
8
+ require "time"
8
9
 
9
10
  require_relative "yes_ship_it/assertion.rb"
10
11
  require_relative "yes_ship_it/engine.rb"
@@ -67,7 +67,7 @@ Checking version number: 0.0.1
67
67
  Checking change log: CHANGELOG.md
68
68
  Checking tag: v0.0.1
69
69
 
70
- red_herring 0.0.1 already shipped on Wed Jul 1 00:46:19 2015 +0200
70
+ red_herring 0.0.1 already shipped on 2015-06-30 22:46:19 UTC
71
71
  EOT
72
72
 
73
73
  expect(run_command(working_directory: File.join(dir, "red_herring"))).
@@ -0,0 +1,49 @@
1
+ require_relative "../spec_helper"
2
+
3
+ describe YSI::Tag do
4
+ describe "#get_tag_date" do
5
+ it "gets tag date" do
6
+ engine = YSI::Engine.new
7
+ engine.version = "0.0.2"
8
+ tag = YSI::Tag.new(engine)
9
+
10
+ executor = double
11
+ expect(executor).to receive(:run_command).with(["git", "show", "v0.0.2"]).
12
+ and_return("Date: Tue Jul 14 01:13:16 2015 +0200")
13
+
14
+ tag.get_tag_date(executor)
15
+
16
+ expect(engine.tag_date).to eq(Time.parse("20150713T231316Z"))
17
+ end
18
+ end
19
+
20
+ describe "#check" do
21
+ it "gets an existing tag" do
22
+ expect_any_instance_of(YSI::Executor).to receive(:run_command).
23
+ with(["git", "tag"]).and_return("v0.0.1\nv0.0.2\n")
24
+
25
+ engine = YSI::Engine.new
26
+ engine.version = "0.0.2"
27
+ tag = YSI::Tag.new(engine)
28
+
29
+ expect(tag).to receive(:get_tag_date)
30
+
31
+ tag.check
32
+ end
33
+ end
34
+
35
+ describe "#assert" do
36
+ it "creates a tag" do
37
+ engine = YSI::Engine.new
38
+ engine.version = "0.0.2"
39
+ tag = YSI::Tag.new(engine)
40
+
41
+ executor = double
42
+ expect(executor).to receive(:run_command).
43
+ with(["git", "tag", "-a", "v0.0.2", "-m", "0.0.2"])
44
+ expect(tag).to receive(:get_tag_date)
45
+
46
+ tag.assert(executor)
47
+ end
48
+ end
49
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yes_ship_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cornelius Schumacher
@@ -206,6 +206,7 @@ files:
206
206
  - spec/unit/assertions/release_archive_spec.rb
207
207
  - spec/unit/assertions/release_branch_spec.rb
208
208
  - spec/unit/assertions/submitted_rpm_spec.rb
209
+ - spec/unit/assertions/tag_spec.rb
209
210
  - spec/unit/assertions/version_spec.rb
210
211
  - spec/unit/assertions/working_directory_spec.rb
211
212
  - spec/unit/assertions/yes_it_shipped_spec.rb