git_go 0.1.2 → 0.1.3

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git_go (0.1.2)
4
+ git_go (0.1.3)
5
5
  net-ssh (~> 2.6.2)
6
6
  thor (~> 0.16.0)
7
7
 
data/README.md CHANGED
@@ -27,6 +27,7 @@ This will provide you with the `gg` executable. Simply run it without any argume
27
27
  $ gg
28
28
 
29
29
  Tasks:
30
+ gg clip NAME # Add the Git URL for NAME to your clipboard (Mac OSX only)
30
31
  gg create NAME # Create a new remote repository named NAME
31
32
  gg destroy NAME # Destroy the remote repository named NAME
32
33
  gg help [TASK] # Describe available tasks or one specific task
data/lib/git_go.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  require "uri"
4
+ require "rbconfig"
4
5
 
5
6
  require "rubygems"
6
7
  require "thor"
data/lib/git_go/cli.rb CHANGED
@@ -114,6 +114,26 @@ module GitGo
114
114
  conn.close
115
115
  end
116
116
 
117
+ desc "clip NAME", "Add the Git URL for NAME to your clipboard (Mac OSX only)"
118
+ def clip(name)
119
+ core = GitGo::Core.new
120
+ conn = core.connection
121
+
122
+ response = conn.bash("find ./*.git/ -mindepth 0 -maxdepth 0")
123
+ repositories = response[:stdout].split("\n").map { |r| File.basename(r) }
124
+ repository = repositories.select { |r| r == name + ".git" }.first
125
+
126
+ if repository.nil?
127
+ puts %Q(There is no git repository named "#{name}". ) +
128
+ %Q(Run `gg list` for the list of repositories.)
129
+ return conn.close_and_exit(1)
130
+ else
131
+ url = "#{core.user}@#{core.host}:#{repository}"
132
+ system(%Q(printf "#{url}" | pbcopy))
133
+ puts "#{url} copied to clipboard."
134
+ end
135
+ end
136
+
117
137
  desc "instructions", "Display a detailed guide to setup Git Go locally and remotely"
118
138
  def instructions
119
139
  puts Core.instructions
@@ -3,6 +3,6 @@
3
3
  module GitGo
4
4
 
5
5
  # @return [String] the current GitGo version.
6
- VERSION = "0.1.2"
6
+ VERSION = "0.1.3"
7
7
  end
8
8
 
@@ -216,5 +216,30 @@ describe GitGo::CLI do
216
216
  cli.list
217
217
  end
218
218
  end
219
+
220
+ describe "#clip" do
221
+
222
+ if RbConfig::CONFIG["target_os"] =~ /darwin/
223
+ context "Mac OSX" do
224
+ it "should clip a URL" do
225
+ create_silent("rspec")
226
+
227
+ cli, core, conn = init
228
+ cli.expects(:puts).with("git@127.0.0.1:rspec.git copied to clipboard.")
229
+ cli.clip("rspec")
230
+
231
+ %x[pbpaste].should == "git@127.0.0.1:rspec.git"
232
+ end
233
+
234
+ it "should report an error if no NAME is found" do
235
+ cli, core, conn = init
236
+ cli.expects(:puts).with(%Q(There is no git repository named "rspec". ) +
237
+ %Q(Run `gg list` for the list of repositories.))
238
+ conn.expects(:close_and_exit).with(1)
239
+ cli.clip("rspec")
240
+ end
241
+ end
242
+ end
243
+ end
219
244
  end
220
245
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_go
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -95,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
95
  version: '0'
96
96
  segments:
97
97
  - 0
98
- hash: -3903107512716536942
98
+ hash: 731507730674825205
99
99
  required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  none: false
101
101
  requirements:
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  segments:
106
106
  - 0
107
- hash: -3903107512716536942
107
+ hash: 731507730674825205
108
108
  requirements: []
109
109
  rubyforge_project:
110
110
  rubygems_version: 1.8.23