offline 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/offline +28 -0
  2. data/lib/offline/version.rb +1 -1
  3. metadata +2 -2
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Offline
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: offline
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
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-08 00:00:00 Z
13
+ date: 2011-06-09 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty