git_mirror 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/bin/git-mirror +25 -5
  2. metadata +19 -3
data/bin/git-mirror CHANGED
@@ -3,12 +3,32 @@
3
3
  $LOAD_PATH.push File.expand_path("../lib", File.dirname(__FILE__))
4
4
  require 'git_mirror'
5
5
 
6
- instance = GitMirror.new
6
+ require "thor"
7
7
 
8
- update_all = ARGV == ['update']
8
+ class GitMirrorCLI < Thor
9
+ desc 'mirror REPOSITORY_URL', 'create a mirror of the repository at REPOSITORY_URL'
10
+ def mirror(repo_url)
11
+ instance.update(repo_url)
12
+ end
9
13
 
10
- if update_all
11
- instance.update_all
14
+ desc 'update', 'update all local mirrors'
15
+ def update
16
+ instance.update_all
17
+ end
18
+
19
+ default_command :mirror
20
+
21
+ private
22
+
23
+ def instance
24
+ @instance ||= GitMirror.new
25
+ end
26
+ end
27
+
28
+ if ARGV == ['update']
29
+ GitMirrorCLI.start(ARGV)
30
+ elsif ARGV == []
31
+ GitMirrorCLI.new.help
12
32
  else
13
- instance.update(ARGV[0])
33
+ GitMirrorCLI.new.mirror(ARGV[0])
14
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_mirror
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -43,6 +43,22 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: thor
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
46
62
  description: utility for mirroring github repositories
47
63
  email: mick@zendesk.com
48
64
  executables:
@@ -67,7 +83,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
67
83
  version: '0'
68
84
  segments:
69
85
  - 0
70
- hash: 3188072254581163088
86
+ hash: -112591484619324664
71
87
  required_rubygems_version: !ruby/object:Gem::Requirement
72
88
  none: false
73
89
  requirements:
@@ -76,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
92
  version: '0'
77
93
  segments:
78
94
  - 0
79
- hash: 3188072254581163088
95
+ hash: -112591484619324664
80
96
  requirements: []
81
97
  rubyforge_project:
82
98
  rubygems_version: 1.8.25