pkgwat 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +8 -0
- data/LICENSE +20 -0
- data/README.md +49 -1
- data/Rakefile +9 -0
- data/lib/pkgwat.rb +8 -2
- data/lib/pkgwat/railtie.rb +1 -1
- data/lib/pkgwat/version.rb +1 -1
- data/pkgwat.gemspec +4 -1
- data/test/fixtures/vcr/pkgwat_check_gem.yml +136 -0
- data/test/pkgwat_test.rb +36 -0
- data/test/test_helper.rb +14 -0
- metadata +63 -11
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
pkgwat
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-1.9.3-p448
|
data/.travis.yml
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 David Davis
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
pkgwat
|
1
|
+
pkgwat [![Build Status](https://travis-ci.org/daviddavis/pkgwat.png)](http://travis-ci.org/daviddavis/pkgwat)
|
2
2
|
======
|
3
3
|
|
4
4
|
Pkgwat is a gem for querying gem versions from RPM repos. It's based off of
|
@@ -39,3 +39,51 @@ To check your gems in bundler against Fedora repos, run:
|
|
39
39
|
```bash
|
40
40
|
rake pkgwat:check
|
41
41
|
```
|
42
|
+
|
43
|
+
Developing pkgwat
|
44
|
+
-----------------
|
45
|
+
|
46
|
+
### Requirements
|
47
|
+
|
48
|
+
* ruby 1.9.3
|
49
|
+
* rvm (optional but recommended)
|
50
|
+
* rubygems
|
51
|
+
* bundler (`gem install bundler`)
|
52
|
+
|
53
|
+
### Getting started
|
54
|
+
|
55
|
+
To develop pkgwat, check out the git repo and bundle:
|
56
|
+
|
57
|
+
```bash
|
58
|
+
git clone git@github.com:daviddavis/pkgwat.git pkgwat
|
59
|
+
cd pkgwat # accept the rvmrc file
|
60
|
+
bundle install # run bundler
|
61
|
+
```
|
62
|
+
|
63
|
+
Then just fire up irb:
|
64
|
+
|
65
|
+
```
|
66
|
+
irb -Ilib -rpkgwat
|
67
|
+
>> Pkgwat::F16
|
68
|
+
=> "Fedora 16"
|
69
|
+
```
|
70
|
+
|
71
|
+
### Testing
|
72
|
+
|
73
|
+
To run the pkgwat test suite execute via rake:
|
74
|
+
|
75
|
+
```bash
|
76
|
+
rake test
|
77
|
+
```
|
78
|
+
|
79
|
+
Also you can run an individual test:
|
80
|
+
|
81
|
+
```bash
|
82
|
+
ruby -Itest test/pkgwat_test.rb
|
83
|
+
```
|
84
|
+
|
85
|
+
To record your interactions via VCR and use the actual web APIs:
|
86
|
+
|
87
|
+
```bash
|
88
|
+
rake test mode=all
|
89
|
+
```
|
data/Rakefile
CHANGED
data/lib/pkgwat.rb
CHANGED
@@ -25,8 +25,12 @@ module Pkgwat
|
|
25
25
|
BODHI_REALEASE = ["all", "f17", "f16", "f15", "e16", "e15"]
|
26
26
|
BODHI_ARCH = ["x86_64", "i686"]
|
27
27
|
|
28
|
+
class << self
|
29
|
+
attr_accessor :debug
|
30
|
+
end
|
31
|
+
|
28
32
|
def self.check_gem(name, version, distros = DEFAULT_DISTROS, throw_ex = false)
|
29
|
-
puts "Checking #{name} #{version}...\n"
|
33
|
+
puts "Checking #{name} #{version}...\n" if self.debug
|
30
34
|
versions = get_versions(name)
|
31
35
|
matches = []
|
32
36
|
distros.each do |distro|
|
@@ -34,7 +38,9 @@ module Pkgwat
|
|
34
38
|
match = compare_versions(version, dv["stable_version"])
|
35
39
|
matches << dv["release"] if match
|
36
40
|
end
|
37
|
-
puts "#{name} is available in the following distros: #{matches.join(",")}"
|
41
|
+
puts "#{name} is available in the following distros: #{matches.join(",")}" if self.debug
|
42
|
+
|
43
|
+
matches.any?
|
38
44
|
end
|
39
45
|
|
40
46
|
def self.compare_versions(version, distro)
|
data/lib/pkgwat/railtie.rb
CHANGED
data/lib/pkgwat/version.rb
CHANGED
data/pkgwat.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = Pkgwat::VERSION
|
8
8
|
s.authors = ["David Davis"]
|
9
9
|
s.email = ["daviddavis@redhat.com"]
|
10
|
-
s.homepage = ""
|
10
|
+
s.homepage = "https://github.com/daviddavis/pkgwat"
|
11
11
|
s.summary = %q{pkgwat checks your gems to against Fedora/EPEL.}
|
12
12
|
s.description = %q{pkgwat checks your Gemfile.lock to make sure all your gems
|
13
13
|
are packaged in Fedora/EPEL. Eventually we hope to support
|
@@ -21,6 +21,9 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.add_dependency("json", "1.6.5")
|
22
22
|
s.add_dependency("sanitize")
|
23
23
|
|
24
|
+
s.add_development_dependency("vcr", "~> 2.4.0")
|
25
|
+
s.add_development_dependency("webmock", "~> 1.9.0")
|
26
|
+
s.add_development_dependency("minitest", "~> 4.4.0")
|
24
27
|
if RUBY_VERSION >= "1.9"
|
25
28
|
s.add_development_dependency("debugger")
|
26
29
|
else
|
@@ -0,0 +1,136 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://apps.fedoraproject.org/packages/fcomm_connector/bodhi/query/query_active_releases/%7B%22filters%22:%7B%22package%22:%22rubygem-rails%22%7D%7D
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Ruby
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
Date:
|
20
|
+
- Sun, 20 Jan 2013 17:10:05 GMT
|
21
|
+
Server:
|
22
|
+
- Apache/2.2.15 (Red Hat)
|
23
|
+
Content-Length:
|
24
|
+
- '577'
|
25
|
+
Apptime:
|
26
|
+
- D=5932
|
27
|
+
Appserver:
|
28
|
+
- packages02.phx2.fedoraproject.org
|
29
|
+
Vary:
|
30
|
+
- Accept-Encoding
|
31
|
+
Content-Type:
|
32
|
+
- text/html; charset=UTF-8
|
33
|
+
Proxytime:
|
34
|
+
- D=35750
|
35
|
+
Proxyserver:
|
36
|
+
- proxy08.fedoraproject.org
|
37
|
+
body:
|
38
|
+
encoding: US-ASCII
|
39
|
+
string: ! '{"start_row":0,"total_rows":6,"rows":[{"stable_version":"3.2.8-1.fc18","release":"Rawhide","testing_version":"<i>Not
|
40
|
+
Applicable</i>"},{"stable_version":"3.2.8-1.fc18","release":"Fedora 18","testing_version":"None"},{"stable_version":"3.0.11-1.fc17","release":"Fedora
|
41
|
+
17","testing_version":"None"},{"stable_version":"3.0.10-1.fc16","release":"Fedora
|
42
|
+
16","testing_version":"None"},{"stable_version":"None","release":"Fedora EPEL
|
43
|
+
6","testing_version":"None"},{"stable_version":"2.1.1-2.el5","release":"Fedora
|
44
|
+
EPEL 5","testing_version":"None"}],"rows_per_page":10,"visible_rows":6}'
|
45
|
+
http_version:
|
46
|
+
recorded_at: Sun, 20 Jan 2013 17:10:03 GMT
|
47
|
+
- request:
|
48
|
+
method: get
|
49
|
+
uri: https://apps.fedoraproject.org/packages/fcomm_connector/bodhi/query/query_active_releases/%7B%22filters%22:%7B%22package%22:%22rubygem-rails%22%7D%7D
|
50
|
+
body:
|
51
|
+
encoding: US-ASCII
|
52
|
+
string: ''
|
53
|
+
headers:
|
54
|
+
Accept:
|
55
|
+
- ! '*/*'
|
56
|
+
User-Agent:
|
57
|
+
- Ruby
|
58
|
+
response:
|
59
|
+
status:
|
60
|
+
code: 200
|
61
|
+
message: OK
|
62
|
+
headers:
|
63
|
+
Date:
|
64
|
+
- Sun, 20 Jan 2013 17:10:05 GMT
|
65
|
+
Server:
|
66
|
+
- Apache/2.2.15 (Red Hat)
|
67
|
+
Content-Length:
|
68
|
+
- '577'
|
69
|
+
Apptime:
|
70
|
+
- D=6254
|
71
|
+
Appserver:
|
72
|
+
- packages02.phx2.fedoraproject.org
|
73
|
+
Vary:
|
74
|
+
- Accept-Encoding
|
75
|
+
Content-Type:
|
76
|
+
- text/html; charset=UTF-8
|
77
|
+
Proxytime:
|
78
|
+
- D=142563
|
79
|
+
Proxyserver:
|
80
|
+
- proxy04.fedoraproject.org
|
81
|
+
body:
|
82
|
+
encoding: US-ASCII
|
83
|
+
string: ! '{"visible_rows":6,"total_rows":6,"start_row":0,"rows":[{"stable_version":"3.2.8-1.fc18","testing_version":"<i>Not
|
84
|
+
Applicable</i>","release":"Rawhide"},{"stable_version":"3.2.8-1.fc18","testing_version":"None","release":"Fedora
|
85
|
+
18"},{"stable_version":"3.0.11-1.fc17","testing_version":"None","release":"Fedora
|
86
|
+
17"},{"stable_version":"3.0.10-1.fc16","testing_version":"None","release":"Fedora
|
87
|
+
16"},{"stable_version":"None","testing_version":"None","release":"Fedora EPEL
|
88
|
+
6"},{"stable_version":"2.1.1-2.el5","testing_version":"None","release":"Fedora
|
89
|
+
EPEL 5"}],"rows_per_page":10}'
|
90
|
+
http_version:
|
91
|
+
recorded_at: Sun, 20 Jan 2013 17:10:04 GMT
|
92
|
+
- request:
|
93
|
+
method: get
|
94
|
+
uri: https://apps.fedoraproject.org/packages/fcomm_connector/bodhi/query/query_active_releases/%7B%22filters%22:%7B%22package%22:%22rubygem-this-gem-doesnt-exist%22%7D%7D
|
95
|
+
body:
|
96
|
+
encoding: US-ASCII
|
97
|
+
string: ''
|
98
|
+
headers:
|
99
|
+
Accept:
|
100
|
+
- ! '*/*'
|
101
|
+
User-Agent:
|
102
|
+
- Ruby
|
103
|
+
response:
|
104
|
+
status:
|
105
|
+
code: 200
|
106
|
+
message: OK
|
107
|
+
headers:
|
108
|
+
Date:
|
109
|
+
- Sun, 20 Jan 2013 17:10:03 GMT
|
110
|
+
Server:
|
111
|
+
- Apache/2.2.15 (Red Hat)
|
112
|
+
Content-Length:
|
113
|
+
- '566'
|
114
|
+
Apptime:
|
115
|
+
- D=6904
|
116
|
+
Appserver:
|
117
|
+
- packages01.phx2.fedoraproject.org
|
118
|
+
Vary:
|
119
|
+
- Accept-Encoding
|
120
|
+
Content-Type:
|
121
|
+
- text/html; charset=UTF-8
|
122
|
+
Proxytime:
|
123
|
+
- D=137898
|
124
|
+
Proxyserver:
|
125
|
+
- proxy04.fedoraproject.org
|
126
|
+
body:
|
127
|
+
encoding: US-ASCII
|
128
|
+
string: ! '{"total_rows":6,"rows_per_page":10,"start_row":0,"visible_rows":6,"rows":[{"testing_version":"<i>Not
|
129
|
+
Applicable</i>","stable_version":"No builds tagged with dist-5E-epel","release":"Rawhide"},{"testing_version":"None","stable_version":"None","release":"Fedora
|
130
|
+
18"},{"testing_version":"None","stable_version":"None","release":"Fedora 17"},{"testing_version":"None","stable_version":"None","release":"Fedora
|
131
|
+
16"},{"testing_version":"None","stable_version":"None","release":"Fedora EPEL
|
132
|
+
6"},{"testing_version":"None","stable_version":"None","release":"Fedora EPEL
|
133
|
+
5"}]}'
|
134
|
+
http_version:
|
135
|
+
recorded_at: Sun, 20 Jan 2013 17:10:04 GMT
|
136
|
+
recorded_with: VCR 2.4.0
|
data/test/pkgwat_test.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe "Pkgwat" do
|
4
|
+
|
5
|
+
it "has a Fedora 17 constant" do
|
6
|
+
Pkgwat::F17.must_equal "Fedora 17"
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "#check_gem" do
|
10
|
+
before do
|
11
|
+
VCR.insert_cassette('pkgwat_check_gem')
|
12
|
+
end
|
13
|
+
|
14
|
+
after do
|
15
|
+
VCR.eject_cassette
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns false for a non-existing gem" do
|
19
|
+
Pkgwat.check_gem("this-gem-doesnt-exist", "0.0.1").must_equal false
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns true for existing gem" do
|
23
|
+
Pkgwat.check_gem("rails", "3.2.8", [Pkgwat::F18]).must_equal true
|
24
|
+
end
|
25
|
+
|
26
|
+
it "returns false for non-existing version" do
|
27
|
+
Pkgwat.check_gem("rails", "3.2.8", [Pkgwat::F17]).must_equal false
|
28
|
+
Pkgwat.check_gem("rails", "3.2.7", [Pkgwat::F18]).must_equal false
|
29
|
+
end
|
30
|
+
|
31
|
+
it "returns false for an incomplete match" do
|
32
|
+
skip "Need to fix this" # TODO: remove this line
|
33
|
+
Pkgwat.check_gem("rails", "3.2.8", [Pkgwat::F17, Pkgwat::F18]).must_equal false
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
ENV['RACK_ENV'] = 'test'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
require 'pkgwat'
|
4
|
+
require 'vcr'
|
5
|
+
|
6
|
+
mode = ENV['mode'] ? ENV['mode'] : :none
|
7
|
+
|
8
|
+
VCR.configure do |c|
|
9
|
+
c.cassette_library_dir = 'test/fixtures/vcr'
|
10
|
+
c.hook_into :webmock
|
11
|
+
c.default_cassette_options = {
|
12
|
+
:record => mode.to_sym
|
13
|
+
}
|
14
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pkgwat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -91,6 +91,54 @@ dependencies:
|
|
91
91
|
- - ! '>='
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: vcr
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 2.4.0
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.4.0
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: webmock
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.9.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 1.9.0
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: minitest
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ~>
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 4.4.0
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ~>
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 4.4.0
|
94
142
|
- !ruby/object:Gem::Dependency
|
95
143
|
name: debugger
|
96
144
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,7 +165,11 @@ extensions: []
|
|
117
165
|
extra_rdoc_files: []
|
118
166
|
files:
|
119
167
|
- .gitignore
|
168
|
+
- .ruby-gemset
|
169
|
+
- .ruby-version
|
170
|
+
- .travis.yml
|
120
171
|
- Gemfile
|
172
|
+
- LICENSE
|
121
173
|
- README.md
|
122
174
|
- Rakefile
|
123
175
|
- lib/pkgwat.rb
|
@@ -125,7 +177,10 @@ files:
|
|
125
177
|
- lib/pkgwat/tasks.rb
|
126
178
|
- lib/pkgwat/version.rb
|
127
179
|
- pkgwat.gemspec
|
128
|
-
|
180
|
+
- test/fixtures/vcr/pkgwat_check_gem.yml
|
181
|
+
- test/pkgwat_test.rb
|
182
|
+
- test/test_helper.rb
|
183
|
+
homepage: https://github.com/daviddavis/pkgwat
|
129
184
|
licenses: []
|
130
185
|
post_install_message:
|
131
186
|
rdoc_options: []
|
@@ -137,22 +192,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
137
192
|
- - ! '>='
|
138
193
|
- !ruby/object:Gem::Version
|
139
194
|
version: '0'
|
140
|
-
segments:
|
141
|
-
- 0
|
142
|
-
hash: 2352334897922640855
|
143
195
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
196
|
none: false
|
145
197
|
requirements:
|
146
198
|
- - ! '>='
|
147
199
|
- !ruby/object:Gem::Version
|
148
200
|
version: '0'
|
149
|
-
segments:
|
150
|
-
- 0
|
151
|
-
hash: 2352334897922640855
|
152
201
|
requirements: []
|
153
202
|
rubyforge_project: pkgwat
|
154
|
-
rubygems_version: 1.8.
|
203
|
+
rubygems_version: 1.8.25
|
155
204
|
signing_key:
|
156
205
|
specification_version: 3
|
157
206
|
summary: pkgwat checks your gems to against Fedora/EPEL.
|
158
|
-
test_files:
|
207
|
+
test_files:
|
208
|
+
- test/fixtures/vcr/pkgwat_check_gem.yml
|
209
|
+
- test/pkgwat_test.rb
|
210
|
+
- test/test_helper.rb
|