technicalpickles-gemstalker 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +2 -2
- data/bin/gemstalk +10 -2
- data/lib/gem_stalker.rb +9 -4
- metadata +1 -1
data/VERSION.yml
CHANGED
data/bin/gemstalk
CHANGED
@@ -6,7 +6,7 @@ def usage
|
|
6
6
|
puts ""
|
7
7
|
puts "Usage:"
|
8
8
|
puts ""
|
9
|
-
puts " #{File.basename $0} <username> <repository> [version]"
|
9
|
+
puts " #{File.basename $0} <username> <repository> [version] [--install]"
|
10
10
|
puts ""
|
11
11
|
puts "Begins stalking a gem at the specified location. Example:"
|
12
12
|
puts ""
|
@@ -25,7 +25,8 @@ trap "SIGINT" do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
options = {:username => ARGV[0], :repository => ARGV[1]}
|
28
|
-
options[:version] = ARGV[2] if ARGV.length >= 3
|
28
|
+
options[:version] = ARGV[2] if ARGV.length >= 3 && ARGV[2] != '--install'
|
29
|
+
options[:install] = true if ARGV.include?('--install')
|
29
30
|
stalker = GemStalker.new(options)
|
30
31
|
|
31
32
|
$stdout.sync = true
|
@@ -48,6 +49,7 @@ loop do
|
|
48
49
|
if stalker.built?
|
49
50
|
puts "." if waiting
|
50
51
|
puts "=> Zomg, it's built, I'm so telling everyone!"
|
52
|
+
puts "=> http://gems.github.com/#{stalker.gem_path}"
|
51
53
|
break
|
52
54
|
end
|
53
55
|
print "."
|
@@ -55,6 +57,12 @@ loop do
|
|
55
57
|
sleep(5)
|
56
58
|
end
|
57
59
|
|
60
|
+
# Now that it is built lets install
|
61
|
+
if options[:install]
|
62
|
+
puts "=> Installing built gem"
|
63
|
+
stalker.install
|
64
|
+
end
|
65
|
+
|
58
66
|
waiting = false
|
59
67
|
|
60
68
|
puts "Checking to see if it is in the specfile:"
|
data/lib/gem_stalker.rb
CHANGED
@@ -44,17 +44,24 @@ class GemStalker
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
def install
|
48
|
+
sudo = RUBY_PLATFORM =~ /mswin32/ ? '' : 'sudo'
|
49
|
+
wget = "wget http://gems.github.com/#{gem_path}"
|
50
|
+
install = "#{sudo} gem install #{gem_name}-#{@version}.gem"
|
51
|
+
system "#{wget}; #{install}"
|
52
|
+
end
|
53
|
+
|
47
54
|
# Path to edit the repository
|
48
55
|
def edit_repo_url
|
49
56
|
"http://github.com/#{@username}/#{@repository}/edit"
|
50
57
|
end
|
51
58
|
|
52
|
-
protected
|
53
|
-
|
54
59
|
def gem_path
|
55
60
|
"/gems/#{gem_name}-#{@version}.gem"
|
56
61
|
end
|
57
62
|
|
63
|
+
protected
|
64
|
+
|
58
65
|
def gem_name
|
59
66
|
"#{@username}-#{@repository}"
|
60
67
|
end
|
@@ -68,8 +75,6 @@ class GemStalker
|
|
68
75
|
"/#{@username}/#{@repository}/tree/master"
|
69
76
|
end
|
70
77
|
|
71
|
-
|
72
|
-
|
73
78
|
def determine_version
|
74
79
|
res = nil
|
75
80
|
Net::HTTP.start('github.com') {|http|
|