git_go 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/lib/git_go.rb +1 -0
- data/lib/git_go/cli.rb +20 -0
- data/lib/git_go/version.rb +1 -1
- data/spec/lib/git_go/cli_spec.rb +25 -0
- metadata +3 -3
data/Gemfile.lock
CHANGED
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
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
|
data/lib/git_go/version.rb
CHANGED
data/spec/lib/git_go/cli_spec.rb
CHANGED
@@ -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.
|
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:
|
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:
|
107
|
+
hash: 731507730674825205
|
108
108
|
requirements: []
|
109
109
|
rubyforge_project:
|
110
110
|
rubygems_version: 1.8.23
|