horatio 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +24 -0
  3. data/.rubocop.yml +169 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +25 -0
  6. data/Gemfile +10 -0
  7. data/Guardfile +10 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +73 -0
  10. data/Rakefile +13 -0
  11. data/bin/horatio +33 -0
  12. data/horatio.gemspec +30 -0
  13. data/lib/horatio.rb +64 -0
  14. data/lib/horatio/detector.rb +14 -0
  15. data/lib/horatio/detector/docker.rb +39 -0
  16. data/lib/horatio/detector/dynamic.rb +33 -0
  17. data/lib/horatio/detector/io_handler.rb +44 -0
  18. data/lib/horatio/detector/json_reader.rb +15 -0
  19. data/lib/horatio/detector/json_writer.rb +26 -0
  20. data/lib/horatio/detector/maven.rb +48 -0
  21. data/lib/horatio/detector/node_package.rb +30 -0
  22. data/lib/horatio/detector/null_writer.rb +11 -0
  23. data/lib/horatio/detector/rubygem.rb +32 -0
  24. data/lib/horatio/detector/validator.rb +20 -0
  25. data/lib/horatio/helper/vcs.rb +12 -0
  26. data/lib/horatio/releaser.rb +45 -0
  27. data/lib/horatio/vcs.rb +11 -0
  28. data/lib/horatio/vcs/git.rb +41 -0
  29. data/lib/horatio/vcs/subversion.rb +23 -0
  30. data/lib/horatio/version.rb +3 -0
  31. data/spec/fixtures/dynamic +10 -0
  32. data/spec/fixtures/package.json +105 -0
  33. data/spec/fixtures/pom.xml +822 -0
  34. data/spec/fixtures/test.gemspec +32 -0
  35. data/spec/horatio/detector/docker_spec.rb +30 -0
  36. data/spec/horatio/detector/dynamic_spec.rb +19 -0
  37. data/spec/horatio/detector/maven_spec.rb +27 -0
  38. data/spec/horatio/detector/node_package_spec.rb +19 -0
  39. data/spec/horatio/detector/rubygem_spec.rb +28 -0
  40. data/spec/horatio/releaser_spec.rb +25 -0
  41. data/spec/horatio/vcs/git_spec.rb +22 -0
  42. data/spec/horatio/vcs/subversion_spec.rb +15 -0
  43. data/spec/spec_helper.rb +12 -0
  44. data/spec/support/fixture_copy.rb +28 -0
  45. data/spec/support/reporters.rb +3 -0
  46. metadata +232 -0
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'horatio/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'test-gem'
8
+ spec.version = Horatio::VERSION
9
+ spec.authors = ["Test"]
10
+ spec.email = ["test@example.com"]
11
+ spec.summary = %q{Horatio, shipping your Docker images}
12
+ spec.description = %q{Horatio, shipping your Docker images}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "guard"
24
+ spec.add_development_dependency "guard-minitest"
25
+ spec.add_development_dependency "pry"
26
+ spec.add_development_dependency "minitest", "~> 4"
27
+ spec.add_development_dependency "minitest-reporters"
28
+ spec.add_development_dependency "fakefs"
29
+ spec.add_dependency "nokogiri"
30
+ spec.add_dependency "nori"
31
+ spec.add_dependency "gemnasium-parser"
32
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+ require 'json'
3
+
4
+ describe Horatio::Detector::Docker do
5
+ before do
6
+ FakeFS.activate!
7
+ create_horatio_json
8
+ @detector = Horatio::Detector::Docker.new
9
+ end
10
+
11
+ it "correctly implements the name method" do
12
+ @detector.name.must_equal 'docker-project'
13
+ end
14
+
15
+ it "correctly implements the version method" do
16
+ @detector.version.must_equal '0.0.1'
17
+ end
18
+
19
+ it "correctly increments the version number" do
20
+ @detector.increment_version.must_equal '0.0.2'
21
+ end
22
+
23
+ # Fix this valuable test
24
+ #it "correctly increments the version number" do
25
+ # @detector.increment
26
+ # JSON.parse(File.open('horatio.json').read)['version'].must_equal '0.0.2'
27
+ #end
28
+
29
+ after { FakeFS.deactivate! }
30
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+ require 'json'
3
+
4
+ describe Horatio::Detector::Dynamic do
5
+ before do
6
+ FakeFS.activate!
7
+ @detector = Horatio::Detector::Dynamic.new(input: 'spec/fixtures/dynamic')
8
+ end
9
+
10
+ it "correctly implements the name method" do
11
+ assert_equal('docker-project', @detector.name)
12
+ end
13
+
14
+ it "correctly implements the version method" do
15
+ assert_equal('0.0.1', @detector.version)
16
+ end
17
+
18
+ after { FakeFS.deactivate! }
19
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe Horatio::Detector::Maven do
4
+ before do
5
+ FakeFS.activate!
6
+ create_maven_pom
7
+ @detector = Horatio::Detector::Maven.new
8
+ end
9
+
10
+ it "correctly implements the name method" do
11
+ @detector.name.must_equal 'test-maven-project'
12
+ end
13
+
14
+ it "correctly implements the version method" do
15
+ @detector.version.must_equal '1403.0.0.1'
16
+ end
17
+
18
+ it "correctly validates the test name" do
19
+ @detector.validate_name.must_equal true
20
+ end
21
+
22
+ it "correctly validates the version" do
23
+ @detector.validate_version.must_equal true
24
+ end
25
+
26
+ after { FakeFS.deactivate! }
27
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe Horatio::Detector::NodePackage do
4
+ before do
5
+ FakeFS.activate!
6
+ create_package_json
7
+ @detector = Horatio::Detector::NodePackage.new
8
+ end
9
+
10
+ it "correctly implements the name method" do
11
+ @detector.name.must_equal 'less'
12
+ end
13
+
14
+ it "correctly implements the version method" do
15
+ @detector.version.must_equal '1.7.0'
16
+ end
17
+
18
+ after { FakeFS.deactivate! }
19
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe Horatio::Detector::RubyGem do
4
+ before do
5
+ FakeFS.activate!
6
+ create_ruby_gemspec
7
+ create_gem_version
8
+ @detector = Horatio::Detector::RubyGem.new
9
+ end
10
+
11
+ it "correctly implements the name method" do
12
+ @detector.name.must_equal 'test-gem'
13
+ end
14
+
15
+ it "correctly implements the version method" do
16
+ @detector.version.must_equal '0.0.5'
17
+ end
18
+ #
19
+ # it "correctly validates the test name" do
20
+ # @detector.validate_name.must_equal true
21
+ # end
22
+ #
23
+ # it "correctly validates the version" do
24
+ # @detector.validate_version.must_equal true
25
+ # end
26
+
27
+ after { FakeFS.deactivate! }
28
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+ require 'json'
3
+
4
+ describe Horatio::Releaser, "from docker" do
5
+ before do
6
+ FakeFS.activate!
7
+ create_horatio_json
8
+ @releaser = Horatio::Releaser.new({'git-repo-url' => 'https://test.com/git.git'})
9
+ end
10
+
11
+ it "performs a dryrun" do
12
+ ENV['DRY_RUN'] = 'true'
13
+ @releaser.run.must_equal true
14
+ end
15
+
16
+ #TODO Fix this test it is awesome but it fails randomly, have a feeling the
17
+ #fakefs gets cleaned up before all tests can pass
18
+ #it "must create a build artifact" do
19
+ # json = JSON.parse(File.open('docker-image.json').read)
20
+ # json['name'].must_equal "docker-project"
21
+ # json['version'].must_equal "0.0.2"
22
+ #end
23
+
24
+ after { FakeFS.deactivate! }
25
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe Horatio::VCS::Git do
4
+
5
+ before do
6
+ @git = Horatio::VCS::Git.new({'git-repo-url' => 'https://github.com/git.git'})
7
+ end
8
+
9
+ #TODO create a proper git repo to test against
10
+ it "correctly implements the detect method" do
11
+ Horatio::VCS::Git.detect.instance_of? Horatio::VCS::Git
12
+ end
13
+
14
+ #TODO Test against real sha1sum
15
+ it "correctly implements the latest revision method" do
16
+ Horatio::VCS::Git.new.latest_revision.must_match(/^\w+$/i)
17
+ end
18
+
19
+ it "should correct read arguments passed into it" do
20
+ @git.remote_url.must_equal 'https://github.com/git.git'
21
+ end
22
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe Horatio::VCS::Subversion do
4
+
5
+ before do
6
+ FakeFS.activate!
7
+ Dir.mkdir('.subversion')
8
+ end
9
+
10
+ it "correctly implements the detect method" do
11
+ Horatio::VCS::Subversion.detect.must_equal true
12
+ end
13
+
14
+ after { FakeFS.deactivate! }
15
+ end
@@ -0,0 +1,12 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/spec'
3
+ require 'fakefs/safe'
4
+ require 'json'
5
+ require 'horatio'
6
+ require 'logger'
7
+ require 'pry'
8
+
9
+ Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each {|f| require f}
10
+
11
+ # Log to null for tests
12
+ Log = Logger.new(File::NULL)
@@ -0,0 +1,28 @@
1
+ def read_fixture_file(filename)
2
+ IO.read(File.join(File.dirname(__FILE__), '../fixtures', filename))
3
+ end
4
+
5
+ def write_fixture_file(filename, content)
6
+ File.open(filename, 'w') { |f| f.write(content) }
7
+ end
8
+
9
+ def create_horatio_json
10
+ File.open('horatio.json', 'w') { |f| f.write({name: 'docker-project', version: '0.0.1'}.to_json) }
11
+ end
12
+
13
+ def create_maven_pom
14
+ write_fixture_file('pom.xml', read_fixture_file('pom.xml'))
15
+ end
16
+
17
+ def create_ruby_gemspec
18
+ write_fixture_file('test.gemspec', read_fixture_file('test.gemspec'))
19
+ end
20
+
21
+ def create_package_json
22
+ write_fixture_file('package.json', read_fixture_file('package.json'))
23
+ end
24
+
25
+ def create_gem_version
26
+ FileUtils.mkdir_p('lib/test')
27
+ File.open('lib/test/version.rb', 'w') { |f| f.write("module\n0.0.5\nend") }
28
+ end
@@ -0,0 +1,3 @@
1
+ require 'minitest/reporters'
2
+
3
+ Minitest::Reporters.use! Minitest::Reporters::DefaultReporter.new
metadata ADDED
@@ -0,0 +1,232 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: horatio
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.7
5
+ platform: ruby
6
+ authors:
7
+ - Pauly Myjavec
8
+ - Rufus Post
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2016-05-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: nokogiri
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: nori
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: bundler
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '1.5'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '1.5'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: pry
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: minitest
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '4'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '4'
98
+ - !ruby/object:Gem::Dependency
99
+ name: minitest-reporters
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: fakefs
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: rubocop
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ description: Horatio, shipping your Docker images from a CI server
141
+ email:
142
+ - pauly@buzbox.net
143
+ - rufuspost@gmail.com
144
+ executables:
145
+ - horatio
146
+ extensions: []
147
+ extra_rdoc_files: []
148
+ files:
149
+ - ".gitignore"
150
+ - ".rubocop.yml"
151
+ - ".ruby-version"
152
+ - ".travis.yml"
153
+ - Gemfile
154
+ - Guardfile
155
+ - LICENSE.txt
156
+ - README.md
157
+ - Rakefile
158
+ - bin/horatio
159
+ - horatio.gemspec
160
+ - lib/horatio.rb
161
+ - lib/horatio/detector.rb
162
+ - lib/horatio/detector/docker.rb
163
+ - lib/horatio/detector/dynamic.rb
164
+ - lib/horatio/detector/io_handler.rb
165
+ - lib/horatio/detector/json_reader.rb
166
+ - lib/horatio/detector/json_writer.rb
167
+ - lib/horatio/detector/maven.rb
168
+ - lib/horatio/detector/node_package.rb
169
+ - lib/horatio/detector/null_writer.rb
170
+ - lib/horatio/detector/rubygem.rb
171
+ - lib/horatio/detector/validator.rb
172
+ - lib/horatio/helper/vcs.rb
173
+ - lib/horatio/releaser.rb
174
+ - lib/horatio/vcs.rb
175
+ - lib/horatio/vcs/git.rb
176
+ - lib/horatio/vcs/subversion.rb
177
+ - lib/horatio/version.rb
178
+ - spec/fixtures/dynamic
179
+ - spec/fixtures/package.json
180
+ - spec/fixtures/pom.xml
181
+ - spec/fixtures/test.gemspec
182
+ - spec/horatio/detector/docker_spec.rb
183
+ - spec/horatio/detector/dynamic_spec.rb
184
+ - spec/horatio/detector/maven_spec.rb
185
+ - spec/horatio/detector/node_package_spec.rb
186
+ - spec/horatio/detector/rubygem_spec.rb
187
+ - spec/horatio/releaser_spec.rb
188
+ - spec/horatio/vcs/git_spec.rb
189
+ - spec/horatio/vcs/subversion_spec.rb
190
+ - spec/spec_helper.rb
191
+ - spec/support/fixture_copy.rb
192
+ - spec/support/reporters.rb
193
+ homepage:
194
+ licenses:
195
+ - MIT
196
+ metadata: {}
197
+ post_install_message:
198
+ rdoc_options: []
199
+ require_paths:
200
+ - lib
201
+ required_ruby_version: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ required_rubygems_version: !ruby/object:Gem::Requirement
207
+ requirements:
208
+ - - ">="
209
+ - !ruby/object:Gem::Version
210
+ version: '0'
211
+ requirements: []
212
+ rubyforge_project:
213
+ rubygems_version: 2.4.5.1
214
+ signing_key:
215
+ specification_version: 4
216
+ summary: Horatio, shipping your Docker images
217
+ test_files:
218
+ - spec/fixtures/dynamic
219
+ - spec/fixtures/package.json
220
+ - spec/fixtures/pom.xml
221
+ - spec/fixtures/test.gemspec
222
+ - spec/horatio/detector/docker_spec.rb
223
+ - spec/horatio/detector/dynamic_spec.rb
224
+ - spec/horatio/detector/maven_spec.rb
225
+ - spec/horatio/detector/node_package_spec.rb
226
+ - spec/horatio/detector/rubygem_spec.rb
227
+ - spec/horatio/releaser_spec.rb
228
+ - spec/horatio/vcs/git_spec.rb
229
+ - spec/horatio/vcs/subversion_spec.rb
230
+ - spec/spec_helper.rb
231
+ - spec/support/fixture_copy.rb
232
+ - spec/support/reporters.rb