yes_ship_it 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rspec +1 -0
  4. data/CHANGELOG.md +14 -0
  5. data/README.md +9 -1
  6. data/USERS.md +13 -0
  7. data/assertions/built_gem.rb +0 -6
  8. data/assertions/change_log.rb +0 -6
  9. data/assertions/published_gem.rb +1 -7
  10. data/assertions/release_archive.rb +43 -0
  11. data/assertions/release_branch.rb +37 -0
  12. data/assertions/submitted_rpm.rb +134 -0
  13. data/assertions/version.rb +22 -11
  14. data/assertions/working_directory.rb +42 -0
  15. data/bin/yes_ship_it +22 -5
  16. data/configs/ruby_gem.conf +2 -0
  17. data/lib/version.rb +1 -1
  18. data/lib/yes_ship_it.rb +3 -0
  19. data/lib/yes_ship_it/assertion.rb +26 -0
  20. data/lib/yes_ship_it/engine.rb +25 -5
  21. data/spec/data/obs/mycroft.spec.erb +11 -0
  22. data/spec/data/obs/oscrc +8 -0
  23. data/spec/data/red_herring-006.tar.gz +0 -0
  24. data/spec/data/version/version.go +5 -0
  25. data/spec/data/version/version.rb +3 -0
  26. data/spec/integration/cli_spec.rb +74 -0
  27. data/spec/system/data/red_herring-checkout-build.tar.gz +0 -0
  28. data/spec/system/data/red_herring-checkout-not-push.tar.gz +0 -0
  29. data/spec/system/data/red_herring-checkout-push.tar.gz +0 -0
  30. data/spec/system/data/red_herring-remote.tar.gz +0 -0
  31. data/spec/system/ruby_gem_spec.rb +119 -0
  32. data/spec/system/spec_helper.rb +1 -0
  33. data/spec/unit/assertion_spec.rb +46 -0
  34. data/spec/unit/assertions/release_archive_spec.rb +13 -0
  35. data/spec/unit/assertions/release_branch_spec.rb +29 -0
  36. data/spec/unit/assertions/submitted_rpm_spec.rb +48 -0
  37. data/spec/unit/assertions/version_spec.rb +44 -0
  38. data/spec/unit/assertions/working_directory_spec.rb +79 -0
  39. data/spec/unit/engine_spec.rb +14 -0
  40. data/yes_ship_it.gemspec +7 -1
  41. metadata +78 -15
@@ -0,0 +1,29 @@
1
+ require_relative "../spec_helper.rb"
2
+
3
+ describe YSI::ReleaseBranch do
4
+ describe "#current_branch" do
5
+ it "finds current non-master branch" do
6
+ a = YSI::ReleaseBranch.new(YSI::Engine)
7
+
8
+ allow(a).to receive(:git_branch).and_return(" master\n* otherone\n")
9
+
10
+ expect(a.current_branch).to eq("otherone")
11
+ end
12
+
13
+ it "finds current master branch" do
14
+ a = YSI::ReleaseBranch.new(YSI::Engine)
15
+
16
+ allow(a).to receive(:git_branch).and_return("* master\n otherone\n")
17
+
18
+ expect(a.current_branch).to eq("master")
19
+ end
20
+
21
+ it "finds current master branch if it's the only branch" do
22
+ a = YSI::ReleaseBranch.new(YSI::Engine)
23
+
24
+ allow(a).to receive(:git_branch).and_return("* master\n")
25
+
26
+ expect(a.current_branch).to eq("master")
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,48 @@
1
+ require_relative "../spec_helper.rb"
2
+
3
+ include GivenFilesystemSpecHelpers
4
+
5
+ describe YSI::SubmittedRpm do
6
+ use_given_filesystem
7
+
8
+ describe "#read_obs_credentials" do
9
+ it "reads OBS credentials" do
10
+ engine = YSI::Engine.new
11
+ a = YSI::SubmittedRpm.new(engine)
12
+
13
+ a.read_obs_credentials(given_file("obs/oscrc"))
14
+
15
+ expect(a.obs_user).to eq("myuser")
16
+ expect(a.obs_password).to eq("mypassword")
17
+ end
18
+ end
19
+
20
+ describe "#create_spec_file" do
21
+ it "processes template" do
22
+ engine = YSI::Engine.new
23
+ a = YSI::SubmittedRpm.new(engine)
24
+
25
+ allow(engine).to receive(:project_name).and_return("mycroft")
26
+
27
+ engine.version = "0.0.2"
28
+ engine.release_archive = "mycroft-0.0.2.tar.gz"
29
+
30
+ expected_spec = <<EOT
31
+ # Header of artificial RPM spec file snippet
32
+
33
+ Name: go-mycroft
34
+ Version: 0.0.2
35
+ Release: 0
36
+ Source: mycroft-0.0.2.tar.gz
37
+
38
+ %prep
39
+ %setup -q -n mycroft-0.0.2
40
+
41
+ %changelog
42
+ EOT
43
+ spec = a.create_spec_file(given_file("obs/mycroft.spec.erb"))
44
+
45
+ expect(spec).to eq(expected_spec)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,44 @@
1
+ require_relative "../spec_helper.rb"
2
+
3
+ include GivenFilesystemSpecHelpers
4
+
5
+ describe YSI::Version do
6
+ it "has default path" do
7
+ config = <<EOT
8
+ assertions:
9
+ version:
10
+ EOT
11
+ engine = YSI::Engine.new
12
+ engine.read_config(config)
13
+
14
+ expect(engine.assertions.first.version_file).to eq("lib/version.rb")
15
+ end
16
+
17
+ it "reads path parameter" do
18
+ config = <<EOT
19
+ assertions:
20
+ version:
21
+ version_file: version.go
22
+ EOT
23
+ engine = YSI::Engine.new
24
+ engine.read_config(config)
25
+
26
+ expect(engine.assertions.first.version_file).to eq("version.go")
27
+ end
28
+
29
+ describe "parses version" do
30
+ use_given_filesystem
31
+
32
+ let(:subject) { YSI::Version.new(YSI::Engine.new) }
33
+
34
+ it "in ruby" do
35
+ file = given_file("version/version.rb")
36
+ expect(subject.parse_version(file)).to eq("0.0.2")
37
+ end
38
+
39
+ it "in go" do
40
+ file = given_file("version/version.go")
41
+ expect(subject.parse_version(file)).to eq("0.0.1")
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,79 @@
1
+ require_relative "../spec_helper.rb"
2
+
3
+ describe YSI::WorkingDirectory do
4
+ describe "#status" do
5
+ it "clean" do
6
+ a = YSI::WorkingDirectory.new(YSI::Engine)
7
+
8
+ git_output = <<EOT
9
+ # On branch master
10
+ # Your branch is ahead of 'origin/master' by 4 commits.
11
+ # (use "git push" to publish your local commits)
12
+ #
13
+ nothing to commit, working directory clean
14
+ EOT
15
+ allow(a).to receive(:git_status).and_return(git_output)
16
+
17
+ expect(a.status).to eq("clean")
18
+ end
19
+
20
+ it "untracked files" do
21
+ a = YSI::WorkingDirectory.new(YSI::Engine)
22
+
23
+ git_output = <<EOT
24
+ # On branch master
25
+ # Your branch is ahead of 'origin/master' by 4 commits.
26
+ # (use "git push" to publish your local commits)
27
+ #
28
+ # Untracked files:
29
+ # (use "git add <file>..." to include in what will be committed)
30
+ #
31
+ # hello
32
+ nothing added to commit but untracked files present (use "git add" to track)
33
+ EOT
34
+ allow(a).to receive(:git_status).and_return(git_output)
35
+
36
+ expect(a.status).to eq("untracked files")
37
+ end
38
+
39
+ it "uncommitted changes" do
40
+ a = YSI::WorkingDirectory.new(YSI::Engine)
41
+
42
+ git_output = <<EOT
43
+ # On branch master
44
+ # Your branch is ahead of 'origin/master' by 4 commits.
45
+ # (use "git push" to publish your local commits)
46
+ #
47
+ # Changes to be committed:
48
+ # (use "git reset HEAD <file>..." to unstage)
49
+ #
50
+ # new file: hello
51
+ #
52
+ EOT
53
+ allow(a).to receive(:git_status).and_return(git_output)
54
+
55
+ expect(a.status).to eq("uncommitted changes")
56
+ end
57
+
58
+ it "unstaged changes" do
59
+ a = YSI::WorkingDirectory.new(YSI::Engine)
60
+
61
+ git_output = <<EOT
62
+ # On branch master
63
+ # Your branch is ahead of 'origin/master' by 4 commits.
64
+ # (use "git push" to publish your local commits)
65
+ #
66
+ # Changes not staged for commit:
67
+ # (use "git add <file>..." to update what will be committed)
68
+ # (use "git checkout -- <file>..." to discard changes in working directory)
69
+ #
70
+ # modified: README.md
71
+ #
72
+ no changes added to commit (use "git add" and/or "git commit -a")
73
+ EOT
74
+ allow(a).to receive(:git_status).and_return(git_output)
75
+
76
+ expect(a.status).to eq("unstaged changes")
77
+ end
78
+ end
79
+ end
@@ -5,6 +5,20 @@ include GivenFilesystemSpecHelpers
5
5
  describe YSI::Engine do
6
6
  use_given_filesystem
7
7
 
8
+ describe "#read_config" do
9
+ it "reads valid configuration" do
10
+ config = <<EOT
11
+ assertions:
12
+ version:
13
+ EOT
14
+
15
+ ysi = YSI::Engine.new
16
+ ysi.read_config(config)
17
+ expect(ysi.assertions.count).to eq(1)
18
+ expect(ysi.assertions.first.class).to eq(YSI::Version)
19
+ end
20
+ end
21
+
8
22
  describe "#read" do
9
23
  it "reads valid configuration" do
10
24
  path = nil
data/yes_ship_it.gemspec CHANGED
@@ -15,10 +15,16 @@ Gem::Specification.new do |s|
15
15
  s.required_rubygems_version = ">= 1.3.6"
16
16
  s.rubyforge_project = "yes_ship_it"
17
17
 
18
+ s.add_runtime_dependency "inifile"
19
+ s.add_runtime_dependency "rest-client"
20
+
18
21
  s.add_development_dependency "rspec", "~>3"
19
22
  s.add_development_dependency "given_filesystem"
20
- s.add_development_dependency "cli_tester"
23
+ s.add_development_dependency "cli_tester", ">= 0.0.2"
24
+ s.add_development_dependency "httpotemkin"
21
25
 
22
26
  s.files = `git ls-files`.split("\n")
23
27
  s.require_path = 'lib'
28
+
29
+ s.executables = ["yes_ship_it"]
24
30
  end
metadata CHANGED
@@ -1,76 +1,124 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yes_ship_it
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
  - Cornelius Schumacher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-13 00:00:00.000000000 Z
11
+ date: 2015-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: inifile
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rest-client
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: rspec
15
43
  requirement: !ruby/object:Gem::Requirement
16
44
  requirements:
17
- - - ~>
45
+ - - "~>"
18
46
  - !ruby/object:Gem::Version
19
47
  version: '3'
20
48
  type: :development
21
49
  prerelease: false
22
50
  version_requirements: !ruby/object:Gem::Requirement
23
51
  requirements:
24
- - - ~>
52
+ - - "~>"
25
53
  - !ruby/object:Gem::Version
26
54
  version: '3'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: given_filesystem
29
57
  requirement: !ruby/object:Gem::Requirement
30
58
  requirements:
31
- - - '>='
59
+ - - ">="
32
60
  - !ruby/object:Gem::Version
33
61
  version: '0'
34
62
  type: :development
35
63
  prerelease: false
36
64
  version_requirements: !ruby/object:Gem::Requirement
37
65
  requirements:
38
- - - '>='
66
+ - - ">="
39
67
  - !ruby/object:Gem::Version
40
68
  version: '0'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: cli_tester
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
- - - '>='
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.0.2
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 0.0.2
83
+ - !ruby/object:Gem::Dependency
84
+ name: httpotemkin
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
46
88
  - !ruby/object:Gem::Version
47
89
  version: '0'
48
90
  type: :development
49
91
  prerelease: false
50
92
  version_requirements: !ruby/object:Gem::Requirement
51
93
  requirements:
52
- - - '>='
94
+ - - ">="
53
95
  - !ruby/object:Gem::Version
54
96
  version: '0'
55
97
  description: Whenever the answer is 'Yes, ship it!' you will need yes_ship_it. It
56
98
  is the ultimate helper in releasing software..
57
99
  email:
58
100
  - schumacher@kde.org
59
- executables: []
101
+ executables:
102
+ - yes_ship_it
60
103
  extensions: []
61
104
  extra_rdoc_files: []
62
105
  files:
63
- - .gitignore
64
- - .rspec
106
+ - ".gitignore"
107
+ - ".rspec"
65
108
  - CHANGELOG.md
66
109
  - Gemfile
67
110
  - README.md
111
+ - USERS.md
68
112
  - assertions/built_gem.rb
69
113
  - assertions/change_log.rb
70
114
  - assertions/published_gem.rb
71
115
  - assertions/pushed_tag.rb
116
+ - assertions/release_archive.rb
117
+ - assertions/release_branch.rb
118
+ - assertions/submitted_rpm.rb
72
119
  - assertions/tag.rb
73
120
  - assertions/version.rb
121
+ - assertions/working_directory.rb
74
122
  - bin/yes_ship_it
75
123
  - configs/ruby_gem.conf
76
124
  - lib/version.rb
@@ -78,20 +126,36 @@ files:
78
126
  - lib/yes_ship_it/assertion.rb
79
127
  - lib/yes_ship_it/engine.rb
80
128
  - lib/yes_ship_it/exceptions.rb
129
+ - spec/data/obs/mycroft.spec.erb
130
+ - spec/data/obs/oscrc
81
131
  - spec/data/red_herring-000.tar.gz
82
132
  - spec/data/red_herring-001.tar.gz
83
133
  - spec/data/red_herring-002.tar.gz
84
134
  - spec/data/red_herring-003.tar.gz
85
135
  - spec/data/red_herring-004.tar.gz
86
136
  - spec/data/red_herring-005.tar.gz
137
+ - spec/data/red_herring-006.tar.gz
138
+ - spec/data/version/version.go
139
+ - spec/data/version/version.rb
87
140
  - spec/data/yes_ship_it.conf
88
141
  - spec/data/yes_ship_it.include.conf
89
142
  - spec/data/yes_ship_it.unknown.conf
90
143
  - spec/integration/cli_spec.rb
91
144
  - spec/integration/spec_helper.rb
145
+ - spec/system/data/red_herring-checkout-build.tar.gz
146
+ - spec/system/data/red_herring-checkout-not-push.tar.gz
147
+ - spec/system/data/red_herring-checkout-push.tar.gz
148
+ - spec/system/data/red_herring-remote.tar.gz
149
+ - spec/system/ruby_gem_spec.rb
150
+ - spec/system/spec_helper.rb
92
151
  - spec/unit/assertion_spec.rb
93
152
  - spec/unit/assertions/change_log_spec.rb
94
153
  - spec/unit/assertions/pushed_tag_spec.rb
154
+ - spec/unit/assertions/release_archive_spec.rb
155
+ - spec/unit/assertions/release_branch_spec.rb
156
+ - spec/unit/assertions/submitted_rpm_spec.rb
157
+ - spec/unit/assertions/version_spec.rb
158
+ - spec/unit/assertions/working_directory_spec.rb
95
159
  - spec/unit/assertions_spec.rb
96
160
  - spec/unit/engine_spec.rb
97
161
  - spec/unit/spec_helper.rb
@@ -109,19 +173,18 @@ require_paths:
109
173
  - lib
110
174
  required_ruby_version: !ruby/object:Gem::Requirement
111
175
  requirements:
112
- - - '>='
176
+ - - ">="
113
177
  - !ruby/object:Gem::Version
114
178
  version: '0'
115
179
  required_rubygems_version: !ruby/object:Gem::Requirement
116
180
  requirements:
117
- - - '>='
181
+ - - ">="
118
182
  - !ruby/object:Gem::Version
119
183
  version: 1.3.6
120
184
  requirements: []
121
185
  rubyforge_project: yes_ship_it
122
- rubygems_version: 2.0.3
186
+ rubygems_version: 2.4.5.1
123
187
  signing_key:
124
188
  specification_version: 4
125
189
  summary: The ultimate release script
126
190
  test_files: []
127
- has_rdoc: