offline 0.0.1 → 0.0.2
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/bin/offline +28 -0
- data/lib/offline/version.rb +1 -1
- metadata +2 -2
data/bin/offline
CHANGED
@@ -30,6 +30,34 @@ class OfflineApp < Thor
|
|
30
30
|
else
|
31
31
|
run("git clone --mirror git@github.com:#{repo["owner"]}/#{repo["name"]}.git #{target_directory}")
|
32
32
|
end
|
33
|
+
puts "" # blank line
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# TODO: Dry up
|
38
|
+
# Yes I did just copy and paste
|
39
|
+
desc "clone GITHUB_USER", "clone the repositories of a given github user"
|
40
|
+
method_option :only, :type => :array, :required => false
|
41
|
+
method_option :without, :type => :array, :required => false
|
42
|
+
method_option :password, :type => :string, :required => false, :aliases => '-p'
|
43
|
+
method_option :output, :type => :string, :default => 'clone', :required => false, :aliases => '-o'
|
44
|
+
def clone(user)
|
45
|
+
clone_directory = "#{options[:output]}/#{user}"
|
46
|
+
Pathname.new(clone_directory).mkpath
|
47
|
+
reaper = Offline::Github.new(user, options[:password])
|
48
|
+
all_repos = reaper.repositories.map {|r| r["name"] }
|
49
|
+
repos = all_repos & (options[:only] || all_repos) # TODO: Might be a better way of doing this
|
50
|
+
repos = (repos) - Array(options[:without])
|
51
|
+
reaper.repositories.each do |repo|
|
52
|
+
next unless repos.include?(repo["name"])
|
53
|
+
puts "Cloning: #{repo["name"]}"
|
54
|
+
target_directory = Pathname.new("#{clone_directory}/#{repo["name"]}")
|
55
|
+
if target_directory.exist?
|
56
|
+
run("cd #{target_directory} && git fetch")
|
57
|
+
else
|
58
|
+
run("git clone git@github.com:#{repo["owner"]}/#{repo["name"]}.git #{target_directory}")
|
59
|
+
end
|
60
|
+
puts "" # blank line
|
33
61
|
end
|
34
62
|
end
|
35
63
|
end
|
data/lib/offline/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: offline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Luke Chadwick
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-09 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: httparty
|