git-it 0.0.4 → 0.0.5

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/git-it CHANGED
@@ -15,8 +15,13 @@ version GitIt::VERSION
15
15
  # = Global Options =
16
16
  # ==================
17
17
 
18
- desc 'debug mode'
19
- switch [:d,:debug]
18
+ # desc 'debug mode'
19
+ # switch [:d,:debug]
20
+
21
+ desc 'repository path'
22
+ default_value '{{present_working_directory}}'
23
+ arg_name 'path'
24
+ flag [:p,:path]
20
25
 
21
26
  desc 'SHA1'
22
27
  default_value '{{current_head}}'
@@ -7,13 +7,18 @@ class GitIt::Controller
7
7
  attr_reader :repository
8
8
  attr_reader :git_object
9
9
 
10
- # Options::
11
- # * --sha=sha1 - git object reference to work on
10
+ # Global Options::
11
+ # * --help - Show this message
12
+ # * -p, --path=path - repository path (default: {{present_working_directory}})
13
+ # * -s, --sha=sha - SHA1 (default: {{current_head}})
14
+ # * --version -
12
15
  def initialize(options)
13
- @repository = Rugged::Repository.new( discover_repository )
14
- @git_object = get_object(options[:sha])
16
+ @global_options = options
17
+ @repository = Rugged::Repository.new( get_path(options[:path]) )
18
+ @git_object = get_object( options[:sha] )
15
19
  end
16
20
 
21
+
17
22
  # ===========
18
23
  # = Actions =
19
24
  # ===========
@@ -35,12 +40,17 @@ class GitIt::Controller
35
40
  `open #{ github_link }` # should use launchy in the future
36
41
  end
37
42
 
43
+
38
44
  # ============
39
45
  # = Privates =
40
46
  # ============
41
47
 
42
48
  private
43
49
 
50
+ def get_path(path)
51
+ path == "{{present_working_directory}}" ? Dir.pwd : path
52
+ end
53
+
44
54
  def get_object(sha)
45
55
  if sha == "{{current_head}}"
46
56
  repository.lookup( repository.head.target )
@@ -49,8 +59,8 @@ class GitIt::Controller
49
59
  end
50
60
  end
51
61
 
52
- def discover_repository
53
- Rugged::Repository.discover( Dir.pwd )
62
+ def discover_repository(path)
63
+ Rugged::Repository.discover( path )
54
64
  end
55
65
 
56
66
  def remote_branches
@@ -1,3 +1,3 @@
1
1
  module GitIt
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-it
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: debugger
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
62
78
  - !ruby/object:Gem::Dependency
63
79
  name: gli
64
80
  requirement: !ruby/object:Gem::Requirement
@@ -118,7 +134,6 @@ rdoc_options:
118
134
  - -ri
119
135
  require_paths:
120
136
  - lib
121
- - lib
122
137
  required_ruby_version: !ruby/object:Gem::Requirement
123
138
  none: false
124
139
  requirements: