gersion 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +77 -0
- data/Rakefile +2 -0
- data/gersion.gemspec +24 -0
- data/lib/gersion.rb +54 -0
- data/lib/gersion/bash.rb +7 -0
- data/lib/gersion/file.rb +7 -0
- data/lib/gersion/version.rb +3 -0
- data/spec/gersion_spec.rb +606 -0
- data/spec/spec_helper.rb +9 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f2ee4731823938e015af67d8d3d5d1a1f26d1f71
|
4
|
+
data.tar.gz: f2e534c513147d3e972eaa63a251620a893cab58
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b488330527a8a2cb6f6e3c0969b2344619fc0661c75b8447202c5f26e74490b81940795d794b08b7149f1f69e1c64e0545a3646b7e2258041b743538bc2e42ec
|
7
|
+
data.tar.gz: 4b5f2b1f11dd8908bfc594ce8ab1ae4aae2f8e3783d359e823b5bcc025c19b241bdeafb373bedebf4007c91c394763711ddfea122cbff408fe574c6327729d03
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Darren Cauthon
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# Gersion
|
2
|
+
|
3
|
+
Look up the version of your Ruby application and any Ruby gems.
|
4
|
+
|
5
|
+
This gem assumes and requires the common Ruby setup, like:
|
6
|
+
|
7
|
+
* Your project uses git,
|
8
|
+
* Your server has git installed (no Heroku?), and
|
9
|
+
* You use Bundler with a Gemfile.lock file in your app's root.
|
10
|
+
|
11
|
+
The idea is that you could create a way to report back this information in your application... like a SHA key in the footer of your web app's HTML.
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
### current_version
|
16
|
+
|
17
|
+
We'll consider the "current version" of your application as your git repo's HEAD. If it's tagged, the tag will be treated as the version.
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
# my git HEAD is tagged as 1.2.3
|
21
|
+
Gersion.current_version # <= 1.2.3
|
22
|
+
```
|
23
|
+
|
24
|
+
If there is no tag, then it will report back the HEAD sha key.
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
# my git HEAD is 9760260978ce5c68a319500509205654af4a6c9d
|
28
|
+
Gersion.current_version # <= 9760260978ce5c68a319500509205654af4a6c9d
|
29
|
+
```
|
30
|
+
|
31
|
+
### version_of
|
32
|
+
|
33
|
+
You may want to report back specific versions of gems that your application uses.
|
34
|
+
|
35
|
+
Say you want to see which version of Rails your web application runs:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
Gersion.version_of('rails') # <= 4.1.2
|
39
|
+
```
|
40
|
+
|
41
|
+
If your gem is pointed at a specific tag on a git repo, that will be reported:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
# my special gem is pointing at the 1.2.3 tag
|
45
|
+
Gersion.version_of('my_special_gem') # <= 1.2.3
|
46
|
+
```
|
47
|
+
|
48
|
+
If your gem is pointed at a git repo with no tag, that will be reported as well:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
# my special gem is pointing at the 87e7fae05aa289ab40326d0d162a7913f4a0ca59 sha
|
52
|
+
Gersion.version_of('my_special_gem') # <= 87e7fae05aa289ab40326d0d162a7913f4a0ca59
|
53
|
+
```
|
54
|
+
|
55
|
+
## Installation
|
56
|
+
|
57
|
+
Add this line to your application's Gemfile:
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
gem 'gersion'
|
61
|
+
```
|
62
|
+
|
63
|
+
And then execute:
|
64
|
+
|
65
|
+
$ bundle
|
66
|
+
|
67
|
+
Or install it yourself as:
|
68
|
+
|
69
|
+
$ gem install gersion
|
70
|
+
|
71
|
+
## Contributing
|
72
|
+
|
73
|
+
1. Fork it ( https://github.com/[my-github-username]/gersion/fork )
|
74
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
75
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
76
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
77
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/gersion.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'gersion/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "gersion"
|
8
|
+
spec.version = Gersion::VERSION
|
9
|
+
spec.authors = ["Darren Cauthon"]
|
10
|
+
spec.email = ["darren@cauthon.com"]
|
11
|
+
spec.summary = %q{Look up the version of your Ruby app and any related gems.}
|
12
|
+
spec.description = %q{Look up the version of your Ruby app and any related gems.}
|
13
|
+
spec.homepage = "http://github.com/darrencauthon/gersion"
|
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.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "mocha"
|
24
|
+
end
|
data/lib/gersion.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require_relative "gersion/bash"
|
2
|
+
require_relative "gersion/file"
|
3
|
+
require_relative "gersion/version"
|
4
|
+
|
5
|
+
module Gersion
|
6
|
+
|
7
|
+
def self.current_version
|
8
|
+
the_current_tag || the_current_sha
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.version_of gem
|
12
|
+
find_the_gem_in_the_git_repos_section(gem) || find_the_gem_in_the_rubygems_section(gem)
|
13
|
+
end
|
14
|
+
|
15
|
+
class << self
|
16
|
+
private
|
17
|
+
|
18
|
+
def find_the_gem_in_the_git_repos_section gem
|
19
|
+
if git_match = gemlock_content.split('GEM')[0].split('GIT').select { |c| find_gem_version_in_content(gem, c) }.first
|
20
|
+
find_the_match_between(git_match, /tag: (.*)/) || find_the_match_between(git_match, /revision: (.*)/)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def find_the_gem_in_the_rubygems_section gem
|
25
|
+
find_gem_version_in_content gem, gemlock_content
|
26
|
+
end
|
27
|
+
|
28
|
+
def find_gem_version_in_content gem, content
|
29
|
+
regex = Regexp.new(" #{gem} \\(([01234567890\.]*)\\)")
|
30
|
+
find_the_match_between content, regex
|
31
|
+
rescue
|
32
|
+
nil
|
33
|
+
end
|
34
|
+
|
35
|
+
def gemlock_content
|
36
|
+
@gemlock_content ||= Gersion::File.read('Gemfile.lock')
|
37
|
+
end
|
38
|
+
|
39
|
+
def find_the_match_between content, regex
|
40
|
+
content.scan(regex)[0][0]
|
41
|
+
rescue
|
42
|
+
nil
|
43
|
+
end
|
44
|
+
|
45
|
+
def the_current_tag
|
46
|
+
Gersion::Bash.run('git tag --points-at HEAD').split("\n")[0]
|
47
|
+
end
|
48
|
+
|
49
|
+
def the_current_sha
|
50
|
+
Gersion::Bash.run('git rev-list -1 HEAD').split("\n")[0]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
data/lib/gersion/bash.rb
ADDED
data/lib/gersion/file.rb
ADDED
@@ -0,0 +1,606 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
describe Gersion do
|
4
|
+
|
5
|
+
describe "current version" do
|
6
|
+
|
7
|
+
before do
|
8
|
+
Gersion::Bash.stubs(:run)
|
9
|
+
.with('git tag --points-at HEAD')
|
10
|
+
.returns head_tag_check_result
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "the current version is bound to a tag" do
|
14
|
+
|
15
|
+
let(:tag) { random_string }
|
16
|
+
|
17
|
+
let(:head_tag_check_result) { "#{tag}\n#{random_string}" }
|
18
|
+
|
19
|
+
it "should return the tag" do
|
20
|
+
Gersion.current_version.must_equal tag
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "the current version is NOT bound to a tag" do
|
26
|
+
|
27
|
+
let(:head_tag_check_result) { "" }
|
28
|
+
|
29
|
+
describe "but it has a current sha key" do
|
30
|
+
|
31
|
+
let(:sha) { random_string }
|
32
|
+
|
33
|
+
before do
|
34
|
+
Gersion::Bash.stubs(:run)
|
35
|
+
.with('git rev-list -1 HEAD')
|
36
|
+
.returns "#{sha}\n#{random_string}"
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should return the sha" do
|
40
|
+
Gersion.current_version.must_equal sha
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "version of" do
|
50
|
+
|
51
|
+
let(:gemlock_contents) do
|
52
|
+
<<EOF
|
53
|
+
|
54
|
+
GIT
|
55
|
+
remote: git@github.com:sdfsdlkfjs/abc.git
|
56
|
+
revision: 6eab6b7c3774ac63cc719c8af2ded6d447d0a378
|
57
|
+
specs:
|
58
|
+
abc (0.0.1)
|
59
|
+
json
|
60
|
+
pusher (~> 0.12.0)
|
61
|
+
ruby-hmac
|
62
|
+
|
63
|
+
GIT
|
64
|
+
remote: git@github.com:slkdjfslkj/oiu.git
|
65
|
+
revision: dadafa1c0acd8d734e9d9b95b13cf76d4ac52c1a
|
66
|
+
tag: 1.0.0
|
67
|
+
specs:
|
68
|
+
oiu (0.0.1)
|
69
|
+
activerecord-postgres-hstore
|
70
|
+
rails (>= 4.1.7)
|
71
|
+
|
72
|
+
GIT
|
73
|
+
remote: git@github.com:asdfsfwerwer/tyu.git
|
74
|
+
revision: 37415d2415a1119d4fcb225d222e25f4b709d74c
|
75
|
+
specs:
|
76
|
+
tyu (0.0.1)
|
77
|
+
activesupport
|
78
|
+
savon
|
79
|
+
xml_hate (>= 2.0.0)
|
80
|
+
|
81
|
+
GIT
|
82
|
+
remote: git@github.com:zsdfsfsdsdf/qwerty.git
|
83
|
+
revision: 94fb92ff25f149d089be3cc069ca93ac8410b624
|
84
|
+
tag: 4.0.1
|
85
|
+
specs:
|
86
|
+
qwerty (0.9.0)
|
87
|
+
browser
|
88
|
+
rails (~> 4.1.7)
|
89
|
+
sidekiq
|
90
|
+
|
91
|
+
GIT
|
92
|
+
remote: https://github.com/sdkfjsdlkfjsd/sdfe.git
|
93
|
+
revision: 0a083460751d6a7eac261ff03f9df17eceb5ce98
|
94
|
+
specs:
|
95
|
+
sdfe (1.2.2)
|
96
|
+
rack-mobile-detect
|
97
|
+
rails
|
98
|
+
|
99
|
+
GIT
|
100
|
+
remote: https://github.com/darrencauthon/bnm.git
|
101
|
+
revision: 2d26a805c09647ffae9d0d4272748ba369d009b1
|
102
|
+
specs:
|
103
|
+
bnm (0.7.7)
|
104
|
+
activerecord (>= 3.1)
|
105
|
+
pg-hstore (>= 1.1.5)
|
106
|
+
rake
|
107
|
+
|
108
|
+
GEM
|
109
|
+
remote: https://rubygems.org/
|
110
|
+
specs:
|
111
|
+
Ascii85 (1.0.2)
|
112
|
+
actionmailer (4.1.7)
|
113
|
+
actionpack (= 4.1.7)
|
114
|
+
actionview (= 4.1.7)
|
115
|
+
mail (~> 2.5, >= 2.5.4)
|
116
|
+
actionpack (4.1.7)
|
117
|
+
actionview (= 4.1.7)
|
118
|
+
activesupport (= 4.1.7)
|
119
|
+
rack (~> 1.5.2)
|
120
|
+
rack-test (~> 0.6.2)
|
121
|
+
actionview (4.1.7)
|
122
|
+
activesupport (= 4.1.7)
|
123
|
+
builder (~> 3.1)
|
124
|
+
erubis (~> 2.7.0)
|
125
|
+
activemodel (4.1.7)
|
126
|
+
activesupport (= 4.1.7)
|
127
|
+
builder (~> 3.1)
|
128
|
+
activerecord (4.1.7)
|
129
|
+
activemodel (= 4.1.7)
|
130
|
+
activesupport (= 4.1.7)
|
131
|
+
arel (~> 5.0.0)
|
132
|
+
activesupport (4.1.7)
|
133
|
+
i18n (~> 0.6, >= 0.6.9)
|
134
|
+
json (~> 1.7, >= 1.7.7)
|
135
|
+
minitest (~> 5.1)
|
136
|
+
thread_safe (~> 0.1)
|
137
|
+
tzinfo (~> 1.1)
|
138
|
+
addressable (2.3.8)
|
139
|
+
afm (0.2.2)
|
140
|
+
akami (1.2.2)
|
141
|
+
gyoku (>= 0.4.0)
|
142
|
+
nokogiri
|
143
|
+
amq-protocol (1.9.2)
|
144
|
+
ansi (1.4.3)
|
145
|
+
arel (5.0.1.20140414130214)
|
146
|
+
autoparse (0.3.3)
|
147
|
+
addressable (>= 2.3.1)
|
148
|
+
extlib (>= 0.9.15)
|
149
|
+
multi_json (>= 1.0.0)
|
150
|
+
awesome_print (1.2.0)
|
151
|
+
aws-sdk (1.58.0)
|
152
|
+
aws-sdk-v1 (= 1.58.0)
|
153
|
+
aws-sdk-v1 (1.58.0)
|
154
|
+
json (~> 1.4)
|
155
|
+
nokogiri (>= 1.4.4)
|
156
|
+
babosa (0.3.11)
|
157
|
+
bcrypt (3.1.7)
|
158
|
+
bcrypt-ruby (3.1.5)
|
159
|
+
bcrypt (>= 3.1.3)
|
160
|
+
better_errors (2.0.0)
|
161
|
+
coderay (>= 1.0.0)
|
162
|
+
erubis (>= 2.6.6)
|
163
|
+
rack (>= 0.9.0)
|
164
|
+
binding_of_caller (0.7.2)
|
165
|
+
debug_inspector (>= 0.0.1)
|
166
|
+
blankslate (3.1.3)
|
167
|
+
browser (1.0.1)
|
168
|
+
bson (2.3.0)
|
169
|
+
builder (3.2.2)
|
170
|
+
bunny (0.9.0.pre13)
|
171
|
+
amq-protocol (>= 1.6.0)
|
172
|
+
callsite (0.0.11)
|
173
|
+
celluloid (0.17.1.2)
|
174
|
+
bundler
|
175
|
+
celluloid-essentials
|
176
|
+
celluloid-extras
|
177
|
+
celluloid-fsm
|
178
|
+
celluloid-pool
|
179
|
+
celluloid-supervision
|
180
|
+
dotenv
|
181
|
+
nenv
|
182
|
+
rspec-logsplit (>= 0.1.2)
|
183
|
+
timers (>= 4.1.1)
|
184
|
+
celluloid-essentials (0.20.2.1)
|
185
|
+
bundler
|
186
|
+
dotenv
|
187
|
+
nenv
|
188
|
+
rspec-logsplit (>= 0.1.2)
|
189
|
+
timers (>= 4.1.1)
|
190
|
+
celluloid-extras (0.20.1)
|
191
|
+
bundler
|
192
|
+
dotenv
|
193
|
+
nenv
|
194
|
+
rspec-logsplit (>= 0.1.2)
|
195
|
+
timers (>= 4.1.1)
|
196
|
+
celluloid-fsm (0.20.1)
|
197
|
+
bundler
|
198
|
+
dotenv
|
199
|
+
nenv
|
200
|
+
rspec-logsplit (>= 0.1.2)
|
201
|
+
timers (>= 4.1.1)
|
202
|
+
celluloid-pool (0.20.1)
|
203
|
+
bundler
|
204
|
+
dotenv
|
205
|
+
nenv
|
206
|
+
rspec-logsplit (>= 0.1.2)
|
207
|
+
timers (>= 4.1.1)
|
208
|
+
celluloid-supervision (0.20.1.1)
|
209
|
+
bundler
|
210
|
+
dotenv
|
211
|
+
nenv
|
212
|
+
rspec-logsplit (>= 0.1.2)
|
213
|
+
timers (>= 4.1.1)
|
214
|
+
chronic (0.10.2)
|
215
|
+
coderay (1.1.0)
|
216
|
+
connection_pool (2.2.0)
|
217
|
+
contrast (1.1.0)
|
218
|
+
awesome_print
|
219
|
+
subtle
|
220
|
+
crack (0.4.2)
|
221
|
+
safe_yaml (~> 1.0.0)
|
222
|
+
daemons (1.1.9)
|
223
|
+
debug_inspector (0.0.2)
|
224
|
+
devise (3.4.1)
|
225
|
+
bcrypt (~> 3.0)
|
226
|
+
orm_adapter (~> 0.1)
|
227
|
+
railties (>= 3.2.6, < 5)
|
228
|
+
responders
|
229
|
+
thread_safe (~> 0.1)
|
230
|
+
warden (~> 1.2.3)
|
231
|
+
domain_name (0.5.24)
|
232
|
+
unf (>= 0.0.5, < 1.0.0)
|
233
|
+
dotenv (0.11.1)
|
234
|
+
dotenv-deployment (~> 0.0.2)
|
235
|
+
dotenv-deployment (0.0.2)
|
236
|
+
dragonfly (0.9.15)
|
237
|
+
multi_json (~> 1.0)
|
238
|
+
rack
|
239
|
+
ekg (1.1.1)
|
240
|
+
erubis (2.7.0)
|
241
|
+
ethon (0.7.1)
|
242
|
+
ffi (>= 1.3.0)
|
243
|
+
eventmachine (1.0.3)
|
244
|
+
excon (0.41.0)
|
245
|
+
extlib (0.9.16)
|
246
|
+
faraday (0.9.1)
|
247
|
+
multipart-post (>= 1.2, < 3)
|
248
|
+
ffi (1.9.6)
|
249
|
+
filepicker-rails (1.4.0)
|
250
|
+
rails (>= 3.2)
|
251
|
+
foreman (0.75.0)
|
252
|
+
dotenv (~> 0.11.1)
|
253
|
+
thor (~> 0.19.1)
|
254
|
+
friendly_id (5.0.4)
|
255
|
+
activerecord (>= 4.0.0)
|
256
|
+
google-api-client (0.8.2)
|
257
|
+
activesupport (>= 3.2)
|
258
|
+
addressable (~> 2.3)
|
259
|
+
autoparse (~> 0.3)
|
260
|
+
extlib (~> 0.9)
|
261
|
+
faraday (~> 0.9)
|
262
|
+
launchy (~> 2.4)
|
263
|
+
multi_json (~> 1.10)
|
264
|
+
retriable (~> 1.4)
|
265
|
+
signet (~> 0.6)
|
266
|
+
gyoku (0.4.6)
|
267
|
+
builder (>= 2.1.2)
|
268
|
+
haml (4.0.5)
|
269
|
+
tilt
|
270
|
+
hashery (2.1.1)
|
271
|
+
hashie (3.4.2)
|
272
|
+
hike (1.2.3)
|
273
|
+
hitimes (1.2.2)
|
274
|
+
htmlentities (4.3.2)
|
275
|
+
http-cookie (1.0.2)
|
276
|
+
domain_name (~> 0.5)
|
277
|
+
httparty (0.13.3)
|
278
|
+
json (~> 1.8)
|
279
|
+
multi_xml (>= 0.5.2)
|
280
|
+
httpclient (2.3.4.1)
|
281
|
+
httpi (1.1.1)
|
282
|
+
rack
|
283
|
+
i18n (0.7.0)
|
284
|
+
ice_cube (0.12.1)
|
285
|
+
interchangeable (0.0.6)
|
286
|
+
terminal-table
|
287
|
+
jquery-rails (2.0.3)
|
288
|
+
railties (>= 3.1.0, < 5.0)
|
289
|
+
thor (~> 0.14)
|
290
|
+
json (1.8.3)
|
291
|
+
jwt (1.0.0)
|
292
|
+
kgio (2.9.2)
|
293
|
+
launchy (2.4.3)
|
294
|
+
addressable (~> 2.3)
|
295
|
+
macaddr (1.7.1)
|
296
|
+
systemu (~> 2.6.2)
|
297
|
+
mail (2.6.3)
|
298
|
+
mime-types (>= 1.16, < 3)
|
299
|
+
mandrill-api (1.0.53)
|
300
|
+
excon (>= 0.16.0, < 1.0)
|
301
|
+
json (>= 1.7.7, < 2.0)
|
302
|
+
mandrill-rails (1.3.0)
|
303
|
+
activesupport (>= 3.0.3)
|
304
|
+
mechanize (2.7.3)
|
305
|
+
domain_name (~> 0.5, >= 0.5.1)
|
306
|
+
http-cookie (~> 1.0)
|
307
|
+
mime-types (~> 2.0)
|
308
|
+
net-http-digest_auth (~> 1.1, >= 1.1.1)
|
309
|
+
net-http-persistent (~> 2.5, >= 2.5.2)
|
310
|
+
nokogiri (~> 1.4)
|
311
|
+
ntlm-http (~> 0.1, >= 0.1.1)
|
312
|
+
webrobots (>= 0.0.9, < 0.2)
|
313
|
+
meta_request (0.3.4)
|
314
|
+
callsite (~> 0.0, >= 0.0.11)
|
315
|
+
rack-contrib (~> 1.1)
|
316
|
+
railties (>= 3.0.0, < 5.0.0)
|
317
|
+
metaclass (0.0.4)
|
318
|
+
mime-types (2.6.1)
|
319
|
+
mini_portile (0.6.2)
|
320
|
+
minitest (5.8.0)
|
321
|
+
minitest-focus (1.1.0)
|
322
|
+
minitest (>= 4, < 6)
|
323
|
+
minitest-rails (2.1.1)
|
324
|
+
minitest (~> 5.4)
|
325
|
+
railties (~> 4.1)
|
326
|
+
minitest-reporters (1.0.7)
|
327
|
+
ansi
|
328
|
+
builder
|
329
|
+
minitest (>= 5.0)
|
330
|
+
ruby-progressbar
|
331
|
+
mixpanel-ruby (1.6.0)
|
332
|
+
mixpanel_client (4.1.1)
|
333
|
+
typhoeus (~> 0.6.7)
|
334
|
+
mocha (1.1.0)
|
335
|
+
metaclass (~> 0.0.1)
|
336
|
+
mongoid (4.0.0)
|
337
|
+
activemodel (~> 4.0)
|
338
|
+
moped (~> 2.0.0)
|
339
|
+
origin (~> 2.1)
|
340
|
+
tzinfo (>= 0.3.37)
|
341
|
+
moped (2.0.1)
|
342
|
+
bson (~> 2.2)
|
343
|
+
connection_pool (~> 2.0)
|
344
|
+
optionable (~> 0.2.0)
|
345
|
+
multi_json (1.11.2)
|
346
|
+
multi_xml (0.5.5)
|
347
|
+
multipart-post (2.0.0)
|
348
|
+
nenv (0.2.0)
|
349
|
+
net-http-digest_auth (1.4)
|
350
|
+
net-http-persistent (2.9.4)
|
351
|
+
netrc (0.10.3)
|
352
|
+
nokogiri (1.6.6.2)
|
353
|
+
mini_portile (~> 0.6.0)
|
354
|
+
nori (1.1.5)
|
355
|
+
ntlm-http (0.1.1)
|
356
|
+
oauth2 (1.0.0)
|
357
|
+
faraday (>= 0.8, < 0.10)
|
358
|
+
jwt (~> 1.0)
|
359
|
+
multi_json (~> 1.3)
|
360
|
+
multi_xml (~> 0.5)
|
361
|
+
rack (~> 1.2)
|
362
|
+
omniauth (1.2.2)
|
363
|
+
hashie (>= 1.2, < 4)
|
364
|
+
rack (~> 1.0)
|
365
|
+
omniauth-google-oauth2 (0.2.6)
|
366
|
+
omniauth (> 1.0)
|
367
|
+
omniauth-oauth2 (~> 1.1)
|
368
|
+
omniauth-oauth2 (1.3.1)
|
369
|
+
oauth2 (~> 1.0)
|
370
|
+
omniauth (~> 1.2)
|
371
|
+
optionable (0.2.0)
|
372
|
+
origin (2.1.1)
|
373
|
+
orm_adapter (0.5.0)
|
374
|
+
panic_board_data (1.0.2)
|
375
|
+
json
|
376
|
+
pdf-reader (1.3.3)
|
377
|
+
Ascii85 (~> 1.0.0)
|
378
|
+
afm (~> 0.2.0)
|
379
|
+
hashery (~> 2.0)
|
380
|
+
ruby-rc4
|
381
|
+
ttfunk
|
382
|
+
pdfcrowd (2.6.0)
|
383
|
+
pg (0.17.1)
|
384
|
+
pg-hstore (1.2.0)
|
385
|
+
pusher (0.12.0)
|
386
|
+
httpclient (~> 2.3.0)
|
387
|
+
multi_json (~> 1.0)
|
388
|
+
signature (~> 0.1.6)
|
389
|
+
rack (1.5.5)
|
390
|
+
rack-contrib (1.2.0)
|
391
|
+
rack (>= 0.9.1)
|
392
|
+
rack-mobile-detect (0.4.0)
|
393
|
+
rack
|
394
|
+
rack-plastic (0.1.3)
|
395
|
+
nokogiri (~> 1.4)
|
396
|
+
rack (~> 1.0)
|
397
|
+
rack-protection (1.5.3)
|
398
|
+
rack
|
399
|
+
rack-rewrite (1.5.0)
|
400
|
+
rack-test (0.6.3)
|
401
|
+
rack (>= 1.0)
|
402
|
+
rails (4.1.7)
|
403
|
+
actionmailer (= 4.1.7)
|
404
|
+
actionpack (= 4.1.7)
|
405
|
+
actionview (= 4.1.7)
|
406
|
+
activemodel (= 4.1.7)
|
407
|
+
activerecord (= 4.1.7)
|
408
|
+
activesupport (= 4.1.7)
|
409
|
+
bundler (>= 1.3.0, < 2.0)
|
410
|
+
railties (= 4.1.7)
|
411
|
+
sprockets-rails (~> 2.0)
|
412
|
+
railties (4.1.7)
|
413
|
+
actionpack (= 4.1.7)
|
414
|
+
activesupport (= 4.1.7)
|
415
|
+
rake (>= 0.8.7)
|
416
|
+
thor (>= 0.18.1, < 2.0)
|
417
|
+
raindrops (0.13.0)
|
418
|
+
rake (10.4.2)
|
419
|
+
redis (3.2.1)
|
420
|
+
redis-namespace (1.5.2)
|
421
|
+
redis (~> 3.0, >= 3.0.4)
|
422
|
+
responders (1.1.2)
|
423
|
+
railties (>= 3.2, < 4.2)
|
424
|
+
rest-client (1.8.0)
|
425
|
+
http-cookie (>= 1.0.2, < 2.0)
|
426
|
+
mime-types (>= 1.16, < 3.0)
|
427
|
+
netrc (~> 0.7)
|
428
|
+
retriable (1.4.1)
|
429
|
+
routing-filter (0.3.1)
|
430
|
+
actionpack
|
431
|
+
rspec-logsplit (0.1.3)
|
432
|
+
ruby-hmac (0.4.0)
|
433
|
+
ruby-progressbar (1.7.0)
|
434
|
+
ruby-rc4 (0.1.5)
|
435
|
+
rubyXL (3.2.6)
|
436
|
+
nokogiri (>= 1.4.4)
|
437
|
+
rubyzip (>= 1.1.6)
|
438
|
+
rubyzip (1.1.6)
|
439
|
+
safe_yaml (1.0.4)
|
440
|
+
savon (1.2.0)
|
441
|
+
akami (~> 1.2.0)
|
442
|
+
builder (>= 2.1.2)
|
443
|
+
gyoku (~> 0.4.5)
|
444
|
+
httpi (~> 1.1.0)
|
445
|
+
nokogiri (>= 1.4.0)
|
446
|
+
nori (~> 1.1.0)
|
447
|
+
wasabi (~> 2.5.0)
|
448
|
+
seam (1.1.3)
|
449
|
+
activesupport
|
450
|
+
i18n
|
451
|
+
json
|
452
|
+
seam-active_record (1.1.0)
|
453
|
+
seam
|
454
|
+
seam-sidekiq (1.1.0)
|
455
|
+
seam
|
456
|
+
seo_meta (1.3.0)
|
457
|
+
railties (>= 3.0.0)
|
458
|
+
sidekiq (2.16.0)
|
459
|
+
celluloid (>= 0.15.2)
|
460
|
+
connection_pool (>= 1.0.0)
|
461
|
+
json
|
462
|
+
redis (>= 3.0.4)
|
463
|
+
redis-namespace (>= 1.3.1)
|
464
|
+
sidekiq-failures (0.4.3)
|
465
|
+
sidekiq (>= 2.16.0)
|
466
|
+
sidetiq (0.6.1)
|
467
|
+
celluloid (>= 0.14.1)
|
468
|
+
ice_cube (~> 0.12.0)
|
469
|
+
sidekiq (>= 2.16.0)
|
470
|
+
signature (0.1.7)
|
471
|
+
signet (0.6.0)
|
472
|
+
addressable (~> 2.3)
|
473
|
+
extlib (~> 0.9)
|
474
|
+
faraday (~> 0.9)
|
475
|
+
jwt (~> 1.0)
|
476
|
+
multi_json (~> 1.10)
|
477
|
+
sinatra (1.4.5)
|
478
|
+
rack (~> 1.4)
|
479
|
+
rack-protection (~> 1.4)
|
480
|
+
tilt (~> 1.3, >= 1.3.4)
|
481
|
+
slim (2.1.0)
|
482
|
+
temple (~> 0.6.9)
|
483
|
+
tilt (>= 1.3.3, < 2.1)
|
484
|
+
source_code (0.1.0)
|
485
|
+
sprockets (2.12.4)
|
486
|
+
hike (~> 1.2)
|
487
|
+
multi_json (~> 1.0)
|
488
|
+
rack (~> 1.0)
|
489
|
+
tilt (~> 1.1, != 1.3.0)
|
490
|
+
sprockets-rails (2.3.2)
|
491
|
+
actionpack (>= 3.0)
|
492
|
+
activesupport (>= 3.0)
|
493
|
+
sprockets (>= 2.8, < 4.0)
|
494
|
+
stripe (1.25.0)
|
495
|
+
json (~> 1.8.1)
|
496
|
+
rest-client (~> 1.4)
|
497
|
+
strong_password (0.0.4)
|
498
|
+
subtle (1.2.0)
|
499
|
+
blankslate
|
500
|
+
systemu (2.6.4)
|
501
|
+
temple (0.6.10)
|
502
|
+
terminal-table (1.4.5)
|
503
|
+
thor (0.19.1)
|
504
|
+
thread_safe (0.3.5)
|
505
|
+
three (1.1.0)
|
506
|
+
tilt (1.4.1)
|
507
|
+
timecop (0.7.1)
|
508
|
+
timers (4.1.1)
|
509
|
+
hitimes
|
510
|
+
tinymce-rails (4.2.4)
|
511
|
+
railties (>= 3.1.1)
|
512
|
+
tinymce-rails-imageupload (4.0.16.beta)
|
513
|
+
railties (>= 3.2, < 5)
|
514
|
+
tinymce-rails (~> 4.0)
|
515
|
+
truncate_html (0.5.5)
|
516
|
+
ttfunk (1.4.0)
|
517
|
+
twilio-ruby (3.13.1)
|
518
|
+
builder (>= 2.1.2)
|
519
|
+
jwt (~> 1.0.0)
|
520
|
+
multi_json (>= 1.3.0)
|
521
|
+
typhoeus (0.6.9)
|
522
|
+
ethon (>= 0.7.1)
|
523
|
+
tzinfo (1.2.2)
|
524
|
+
thread_safe (~> 0.1)
|
525
|
+
unf (0.1.4)
|
526
|
+
unf_ext
|
527
|
+
unf_ext (0.0.7.1)
|
528
|
+
unicorn (4.8.3)
|
529
|
+
kgio (~> 2.6)
|
530
|
+
rack
|
531
|
+
raindrops (~> 0.7)
|
532
|
+
uuid (2.3.7)
|
533
|
+
macaddr (~> 1.0)
|
534
|
+
valid_email2 (1.1.6)
|
535
|
+
activemodel (>= 3.2)
|
536
|
+
mail (~> 2.5)
|
537
|
+
venn (0.0.1)
|
538
|
+
warden (1.2.3)
|
539
|
+
rack (>= 1.0)
|
540
|
+
wasabi (2.5.1)
|
541
|
+
httpi (~> 1.0)
|
542
|
+
nokogiri (>= 1.4.0)
|
543
|
+
webmock (1.20.3)
|
544
|
+
addressable (>= 2.3.6)
|
545
|
+
crack (>= 0.3.2)
|
546
|
+
webrobots (0.1.1)
|
547
|
+
whenever (0.9.4)
|
548
|
+
chronic (>= 0.6.3)
|
549
|
+
will_paginate (3.0.7)
|
550
|
+
xml-simple (1.1.5)
|
551
|
+
xml_hate (2.0.0)
|
552
|
+
activesupport
|
553
|
+
hashie
|
554
|
+
xml-simple
|
555
|
+
yell (2.0.5)
|
556
|
+
zip (2.0.2)
|
557
|
+
|
558
|
+
PLATFORMS
|
559
|
+
ruby
|
560
|
+
|
561
|
+
DEPENDENCIES
|
562
|
+
activerecord-postgres-hstore!
|
563
|
+
ajax-datatables-rails!
|
564
|
+
aws-sdk
|
565
|
+
babosa (= 0.3.11)
|
566
|
+
bcrypt (= 3.1.7)
|
567
|
+
bcrypt-ruby (= 3.1.5)
|
568
|
+
better_errors
|
569
|
+
|
570
|
+
EOF
|
571
|
+
|
572
|
+
end
|
573
|
+
|
574
|
+
before do
|
575
|
+
Gersion::File.stubs(:read).with('Gemfile.lock').returns gemlock_contents
|
576
|
+
end
|
577
|
+
|
578
|
+
it "should be able to pick out the version of rails" do
|
579
|
+
Gersion.version_of('rails').must_equal '4.1.7'
|
580
|
+
end
|
581
|
+
|
582
|
+
it "should be able to pick out the version of zip" do
|
583
|
+
Gersion.version_of('zip').must_equal '2.0.2'
|
584
|
+
end
|
585
|
+
|
586
|
+
describe "picking out the tag as a version" do
|
587
|
+
it "should be able to pick out the tag for oiu" do
|
588
|
+
Gersion.version_of('oiu').must_equal '1.0.0'
|
589
|
+
end
|
590
|
+
end
|
591
|
+
|
592
|
+
describe "using the revision when there is no tag" do
|
593
|
+
it "should be able to pick out the revision for abc" do
|
594
|
+
Gersion.version_of('abc').must_equal '6eab6b7c3774ac63cc719c8af2ded6d447d0a378'
|
595
|
+
end
|
596
|
+
end
|
597
|
+
|
598
|
+
describe "a gem it cannot find" do
|
599
|
+
it "should return nil" do
|
600
|
+
Gersion.version_of('lskdjflskdjflksdjflksdjflksdjf').nil?.must_equal true
|
601
|
+
end
|
602
|
+
end
|
603
|
+
|
604
|
+
end
|
605
|
+
|
606
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gersion
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Darren Cauthon
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mocha
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Look up the version of your Ruby app and any related gems.
|
56
|
+
email:
|
57
|
+
- darren@cauthon.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- gersion.gemspec
|
68
|
+
- lib/gersion.rb
|
69
|
+
- lib/gersion/bash.rb
|
70
|
+
- lib/gersion/file.rb
|
71
|
+
- lib/gersion/version.rb
|
72
|
+
- spec/gersion_spec.rb
|
73
|
+
- spec/spec_helper.rb
|
74
|
+
homepage: http://github.com/darrencauthon/gersion
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.4.5
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: Look up the version of your Ruby app and any related gems.
|
98
|
+
test_files:
|
99
|
+
- spec/gersion_spec.rb
|
100
|
+
- spec/spec_helper.rb
|