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.
@@ -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
- url ||= begin
307
- origin, branch = Dir.chdir(pickler.directory) do
308
- origin = %x{git remote show origin}
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 origin =~ %r{^ #{branch}\s+tracked}
311
- [origin[%r{git@(github.com:[^/]+/[^\.]+)\.git}, 1], branch]
324
+ branch = "master" unless remote_info =~ %r{^ #{branch}\s+tracked}
325
+ branch
312
326
  end
313
- "http://#{origin.sub(':', '/')}/blob/#{branch}"
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "ssp-pickler"
3
- s.version = "0.1.4"
3
+ s.version = "0.1.5"
4
4
 
5
5
  s.summary = "PIvotal traCKer Liaison to cucumbER"
6
6
  s.description = "Synchronize between Cucumber and Pivotal Tracker"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssp-pickler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pope