ssp-pickler 0.1.4 → 0.1.5
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/lib/pickler/runner.rb +22 -7
- data/ssp-pickler.gemspec +1 -1
- metadata +1 -1
data/lib/pickler/runner.rb
CHANGED
@@ -299,18 +299,33 @@ class Pickler
|
|
299
299
|
description <<-EOF
|
300
300
|
Upload the given story or all features with a tracker url in a comment on the
|
301
301
|
first line. Features with a blank comment in the first line will created as
|
302
|
-
new stories.
|
302
|
+
new stories. Using the -g flag with a remote name instead of an url will use
|
303
|
+
the url of that remote to build the GitHub urls. You can even specify the branch
|
304
|
+
name with a comma.
|
303
305
|
EOF
|
304
306
|
|
305
307
|
on "-g", "--github[=URL]", "push github url instead of scenarios" do |url|
|
306
|
-
|
307
|
-
|
308
|
-
|
308
|
+
remotes = %x{git remote -v show -n | grep git@github}.split("\n").inject({}) do |hash,line|
|
309
|
+
remote, remote_url = line.split("\t")
|
310
|
+
remote_url.sub!(/ .*/, '')
|
311
|
+
hash[remote] = remote_url
|
312
|
+
hash
|
313
|
+
end
|
314
|
+
unless url and url =~ /^https?:/
|
315
|
+
remote, branch = (url || "origin").split(",")
|
316
|
+
remote = remotes[remote]
|
317
|
+
unless remote
|
318
|
+
$stderr.puts "Wrong GitHub url and couldn't determine one."
|
319
|
+
exit 1
|
320
|
+
end
|
321
|
+
branch ||= Dir.chdir(pickler.directory) do
|
322
|
+
remote_info = %x{git remote show #{remote}}
|
309
323
|
branch = %x{git branch}[%r{\* (\S+)}, 1]
|
310
|
-
branch = "master" unless
|
311
|
-
|
324
|
+
branch = "master" unless remote_info =~ %r{^ #{branch}\s+tracked}
|
325
|
+
branch
|
312
326
|
end
|
313
|
-
|
327
|
+
remote.sub!(%r{git@github.com:([^/]+/[^\.]+)\.git}, 'github.com/\1')
|
328
|
+
url = "http://#{remote}/blob/#{branch}"
|
314
329
|
end
|
315
330
|
puts "Using GitHub url #{url.inspect}"
|
316
331
|
@github_url = url
|
data/ssp-pickler.gemspec
CHANGED