technicalpickles-gemstalker 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +7 -2
- data/Rakefile +1 -0
- data/VERSION.yml +1 -1
- data/bin/gemstalk +3 -4
- data/lib/gem_stalker.rb +15 -1
- data/test/gemstalker_test.rb +15 -0
- metadata +15 -6
data/README.rdoc
CHANGED
@@ -3,9 +3,14 @@
|
|
3
3
|
GemStalker is a small utility to determine if GitHub has built a gem yet.
|
4
4
|
|
5
5
|
sudo gem install technicalpickles-gemstalker --source http://gems.github.com
|
6
|
-
gemstalk yourusername yourrepo yourversion
|
7
6
|
|
8
|
-
|
7
|
+
gemstalk <username> <repository> <version>
|
8
|
+
gemstalk <username> <repository>
|
9
|
+
gemstalk
|
10
|
+
|
11
|
+
If you leave of the version, it will be figured out from the repository's gemspec on the master branch.
|
12
|
+
|
13
|
+
If you also leave of the username and repository, they will be figured out from the the origin remote's URL. The version will also be figured out from the repository's gemspec on master.
|
9
14
|
|
10
15
|
== Contributions and credit
|
11
16
|
|
data/Rakefile
CHANGED
@@ -12,6 +12,7 @@ begin
|
|
12
12
|
gem.description = "A library for determining if GitHub has built a gem yet"
|
13
13
|
gem.authors = ["Josh Nichols"]
|
14
14
|
gem.files = FileList["[A-Z]*", "{bin,lib,test}/**/*"]
|
15
|
+
gem.add_dependency "git"
|
15
16
|
end
|
16
17
|
rescue LoadError
|
17
18
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
data/VERSION.yml
CHANGED
data/bin/gemstalk
CHANGED
@@ -13,7 +13,7 @@ def usage
|
|
13
13
|
puts " #{File.basename $0} techinicalpickles jeweler"
|
14
14
|
end
|
15
15
|
|
16
|
-
if ARGV.
|
16
|
+
if ARGV.include?("-h") || ARGV.include?("--help")
|
17
17
|
usage
|
18
18
|
exit
|
19
19
|
end
|
@@ -29,6 +29,8 @@ options[:version] = ARGV[2] if ARGV.length >= 3 && ARGV[2] != '--install'
|
|
29
29
|
options[:install] = true if ARGV.include?('--install')
|
30
30
|
stalker = GemStalker.new(options)
|
31
31
|
|
32
|
+
puts "Stalking #{stalker.username}-#{stalker.repository}-#{stalker.version}"
|
33
|
+
|
32
34
|
$stdout.sync = true
|
33
35
|
|
34
36
|
unless stalker.gem?
|
@@ -38,9 +40,6 @@ unless stalker.gem?
|
|
38
40
|
exit
|
39
41
|
end
|
40
42
|
|
41
|
-
if ARGV.length < 3
|
42
|
-
puts "Using version #{stalker.version}"
|
43
|
-
end
|
44
43
|
|
45
44
|
waiting = false
|
46
45
|
|
data/lib/gem_stalker.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'net/http'
|
2
2
|
require 'rubygems/spec_fetcher'
|
3
|
+
require 'git'
|
3
4
|
|
4
5
|
# Small class for determining if a gem has been built on GitHub and if it's installable.
|
5
6
|
class GemStalker
|
@@ -14,8 +15,13 @@ class GemStalker
|
|
14
15
|
def initialize(options = {})
|
15
16
|
@username = options[:username]
|
16
17
|
@repository = options[:repository]
|
18
|
+
unless @username && @repository
|
19
|
+
@username, @repository = determine_username_and_repository
|
20
|
+
end
|
21
|
+
|
17
22
|
@version = options[:version] || determine_version
|
18
23
|
|
24
|
+
|
19
25
|
end
|
20
26
|
|
21
27
|
# Is it built yet?
|
@@ -89,5 +95,13 @@ class GemStalker
|
|
89
95
|
gemspec.version.to_s
|
90
96
|
end
|
91
97
|
end
|
92
|
-
|
98
|
+
|
99
|
+
def determine_username_and_repository
|
100
|
+
git = Git.open(Dir.pwd)
|
101
|
+
|
102
|
+
origin_url = git.remote('origin').url
|
103
|
+
origin_url =~ /git@github\.com:(.*)\/(.*)\.git/
|
104
|
+
|
105
|
+
username, repository = $1, $2
|
106
|
+
end
|
93
107
|
end
|
data/test/gemstalker_test.rb
CHANGED
@@ -51,6 +51,21 @@ class GemstalkerTest < Test::Unit::TestCase
|
|
51
51
|
assert @stalker.gem?
|
52
52
|
end
|
53
53
|
end
|
54
|
+
|
55
|
+
context "a stalker, without username and repository" do
|
56
|
+
setup do
|
57
|
+
@stalker = GemStalker.new(:version => '0.8.1')
|
58
|
+
end
|
59
|
+
|
60
|
+
should "determine username from git remote" do
|
61
|
+
assert_equal 'technicalpickles', @stalker.username
|
62
|
+
end
|
63
|
+
|
64
|
+
should "determine repository from git remote" do
|
65
|
+
assert_equal 'gemstalker', @stalker.repository
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
54
69
|
|
55
70
|
context "a stalker for something not marked as a gem" do
|
56
71
|
setup do
|
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.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Nichols
|
@@ -9,10 +9,19 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-07-22 00:00:00 -07:00
|
13
13
|
default_executable: gemstalk
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: git
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
16
25
|
description: A library for determining if GitHub has built a gem yet
|
17
26
|
email: josh@technicalpickles.com
|
18
27
|
executables:
|
@@ -38,7 +47,7 @@ files:
|
|
38
47
|
- test/responses/technicalpickles-jeweler-0.8.1.gem
|
39
48
|
- test/responses/technicalpickles-jeweler-0.9.3.gem
|
40
49
|
- test/test_helper.rb
|
41
|
-
has_rdoc:
|
50
|
+
has_rdoc: false
|
42
51
|
homepage: http://github.com/technicalpickles/gemstalker
|
43
52
|
post_install_message:
|
44
53
|
rdoc_options:
|
@@ -62,7 +71,7 @@ requirements: []
|
|
62
71
|
rubyforge_project:
|
63
72
|
rubygems_version: 1.2.0
|
64
73
|
signing_key:
|
65
|
-
specification_version:
|
74
|
+
specification_version: 3
|
66
75
|
summary: GemStalker is a small library to determine if GitHub has built a gem yet.
|
67
76
|
test_files:
|
68
77
|
- test/gemstalker_test.rb
|