technicalpickles-gemstalker 0.3.0 → 0.3.1
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.
- data/{README → README.rdoc} +5 -5
- data/VERSION.yml +1 -1
- data/bin/gemstalk +4 -3
- data/lib/gem_stalker.rb +11 -0
- metadata +2 -2
data/{README → README.rdoc}
RENAMED
@@ -1,9 +1,8 @@
|
|
1
|
-
gemstalker
|
2
|
-
==========
|
1
|
+
= gemstalker
|
3
2
|
|
4
3
|
GemStalker is a small library to determine if GitHub has built a gem yet.
|
5
4
|
|
6
|
-
require '
|
5
|
+
require 'gem_stalker'
|
7
6
|
|
8
7
|
stalker = GemStalker.new(:username => 'technicalpickles', :repository => 'jeweler', :version => '0.7.2'
|
9
8
|
|
@@ -18,7 +17,8 @@ You can also omit the version, and it will take the version from the repository'
|
|
18
17
|
|
19
18
|
Origin code borrowed and inspired by hasmygembuiltyet.org.
|
20
19
|
|
21
|
-
|
22
|
-
|
20
|
+
Contributions from Jeff Rafter.
|
21
|
+
|
22
|
+
== COPYRIGHT
|
23
23
|
|
24
24
|
Copyright (c) 2009 Josh Nichols. See LICENSE for details.
|
data/VERSION.yml
CHANGED
data/bin/gemstalk
CHANGED
@@ -8,8 +8,9 @@ def usage
|
|
8
8
|
puts ""
|
9
9
|
puts " #{File.basename $0} <username> <repository> [version]"
|
10
10
|
puts ""
|
11
|
-
puts "Begins stalking a gem at the specified location
|
11
|
+
puts "Begins stalking a gem at the specified location. Example:"
|
12
12
|
puts ""
|
13
|
+
puts " #{File.basename $0} techinicalpickles jeweler"
|
13
14
|
end
|
14
15
|
|
15
16
|
if ARGV.length == 0 || ARGV.include?("-h") || ARGV.include?("--help")
|
@@ -45,7 +46,7 @@ waiting = false
|
|
45
46
|
puts "Checking to see if the gem has been built:"
|
46
47
|
loop do
|
47
48
|
if stalker.built?
|
48
|
-
|
49
|
+
puts "." if waiting
|
49
50
|
puts "=> Zomg, it's built, I'm so telling everyone!"
|
50
51
|
break
|
51
52
|
end
|
@@ -59,7 +60,7 @@ waiting = false
|
|
59
60
|
puts "Checking to see if it is in the specfile"
|
60
61
|
loop do
|
61
62
|
if stalker.in_specfile?
|
62
|
-
|
63
|
+
puts "." if waiting
|
63
64
|
puts "=> Sweeeet, everyone can install it now!"
|
64
65
|
break
|
65
66
|
end
|
data/lib/gem_stalker.rb
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
require 'net/http'
|
2
2
|
require 'rubygems/spec_fetcher'
|
3
3
|
|
4
|
+
# Small class for determining if a gem has been built on GitHub and if it's installable.
|
4
5
|
class GemStalker
|
5
6
|
attr_accessor :username, :name, :repository, :version
|
6
7
|
|
8
|
+
# Accepts the following options:
|
9
|
+
#
|
10
|
+
# username:: GitHub username
|
11
|
+
# repository:: repository name
|
12
|
+
# version:: version to stalk. Defaults to checking the repository for a
|
13
|
+
# gemspec to determine the latest version.
|
7
14
|
def initialize(options = {})
|
8
15
|
@username = options[:username]
|
9
16
|
@repository = options[:repository]
|
@@ -11,6 +18,7 @@ class GemStalker
|
|
11
18
|
|
12
19
|
end
|
13
20
|
|
21
|
+
# Is it built yet?
|
14
22
|
def built?
|
15
23
|
Net::HTTP.start('gems.github.com') {|http|
|
16
24
|
response = http.head(gem_path)
|
@@ -18,6 +26,7 @@ class GemStalker
|
|
18
26
|
}
|
19
27
|
end
|
20
28
|
|
29
|
+
# Is RubyGem building enabled for the repository?
|
21
30
|
def gem?
|
22
31
|
Net::HTTP.start('github.com') {|http|
|
23
32
|
res = http.get(master_path)
|
@@ -26,6 +35,7 @@ class GemStalker
|
|
26
35
|
false
|
27
36
|
end
|
28
37
|
|
38
|
+
# Is it in the specs yet? ie is it installable yet?
|
29
39
|
def in_specfile?
|
30
40
|
fetcher = Gem::SpecFetcher.new
|
31
41
|
specs = fetcher.load_specs(URI.parse('http://gems.github.com/'), 'specs')
|
@@ -34,6 +44,7 @@ class GemStalker
|
|
34
44
|
end
|
35
45
|
end
|
36
46
|
|
47
|
+
# Path to edit the repository
|
37
48
|
def edit_repo_url
|
38
49
|
"http://github.com/#{@username}/#{@repository}/edit"
|
39
50
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: technicalpickles-gemstalker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Nichols
|
@@ -24,7 +24,7 @@ extra_rdoc_files: []
|
|
24
24
|
files:
|
25
25
|
- LICENSE
|
26
26
|
- Rakefile
|
27
|
-
- README
|
27
|
+
- README.rdoc
|
28
28
|
- VERSION.yml
|
29
29
|
- bin/gemstalk
|
30
30
|
- lib/gem_stalker.rb
|