git-fogbugz 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/git_fogbugz.rb +17 -17
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/git_fogbugz.rb
CHANGED
@@ -39,7 +39,7 @@ require 'grit'
|
|
39
39
|
include Grit
|
40
40
|
|
41
41
|
class App
|
42
|
-
VERSION = '0.1.
|
42
|
+
VERSION = '0.1.1'
|
43
43
|
|
44
44
|
attr_reader :options
|
45
45
|
|
@@ -53,17 +53,15 @@ class App
|
|
53
53
|
@options.quiet = false
|
54
54
|
@options.quiet = false
|
55
55
|
@options.passthrough = false
|
56
|
-
@options.repo = "
|
56
|
+
@options.repo = "."
|
57
57
|
# TO DO - add additional defaults
|
58
|
-
@options.host = "https://
|
59
|
-
@options.
|
60
|
-
@options.repo_id = 4
|
58
|
+
@options.host = "https://example.fogbugz.com"
|
59
|
+
@options.repo_id = 99
|
61
60
|
|
62
61
|
end
|
63
62
|
|
64
63
|
# Parse options, check arguments, then process the command
|
65
64
|
def run
|
66
|
-
|
67
65
|
if parsed_options? && arguments_valid?
|
68
66
|
|
69
67
|
$stderr.puts "Start at #{DateTime.now}\n\n" if @options.verbose
|
@@ -78,31 +76,33 @@ class App
|
|
78
76
|
else
|
79
77
|
output_usage
|
80
78
|
end
|
81
|
-
|
82
79
|
end
|
83
80
|
|
84
81
|
protected
|
85
82
|
|
86
83
|
def parsed_options?
|
87
|
-
opts = OptionParser.new do |opts|
|
84
|
+
@opts = OptionParser.new do |opts|
|
88
85
|
opts.banner = <<BANNER
|
89
|
-
Usage: git-fogbugz [options]
|
86
|
+
Usage: git-fogbugz [options] fogbugz_server fogbugz_repo_id
|
87
|
+
|
88
|
+
Expects standard input such as sent to the git post-receive hook.
|
89
|
+
See http://www.kernel.org/pub/software/scm/git/docs/githooks.html#post-receive
|
90
|
+
|
91
|
+
Example: git-fogbugz https://example.fogbugz.com 9 < file_with_old_new_ref_lines
|
90
92
|
|
91
93
|
Options are:
|
92
94
|
BANNER
|
93
95
|
opts.separator ""
|
94
|
-
opts.on_tail('-r', '--repo=REPO') {|repo| @options.repo = repo }
|
96
|
+
opts.on_tail('-r', '--repo=REPO', "FogBugz repo id") {|repo| @options.repo = repo }
|
95
97
|
opts.on_tail('-v', '--version') { output_version ; exit 0 }
|
96
98
|
opts.on_tail('-V', '--verbose') { @options.verbose = true }
|
97
99
|
opts.on_tail('-q', '--quiet') { @options.quiet = true }
|
98
|
-
opts.on('-p', '--passthrough'){ @options.passthrough = true }
|
100
|
+
opts.on('-p', '--passthrough', "Output stdin"){ @options.passthrough = true }
|
99
101
|
|
100
102
|
opts.on_tail('-h', '--help') { output_version; puts opts; exit 0 }
|
101
103
|
end
|
102
104
|
opts.parse!(@arguments) rescue return false
|
103
105
|
process_options
|
104
|
-
true
|
105
|
-
|
106
106
|
end
|
107
107
|
|
108
108
|
# Performs post-parse processing on options
|
@@ -121,13 +121,13 @@ BANNER
|
|
121
121
|
# True if required arguments were provided
|
122
122
|
def arguments_valid?
|
123
123
|
# TO DO - implement your real logic here
|
124
|
-
|
125
|
-
true
|
124
|
+
true if @arguments.length == 2
|
126
125
|
end
|
127
126
|
|
128
127
|
# Setup the arguments
|
129
128
|
def process_arguments
|
130
|
-
|
129
|
+
@options.host = @arguments[0]
|
130
|
+
@options.repo_id = @arguments[1]
|
131
131
|
end
|
132
132
|
|
133
133
|
def output_help
|
@@ -136,7 +136,7 @@ BANNER
|
|
136
136
|
end
|
137
137
|
|
138
138
|
def output_usage
|
139
|
-
puts @
|
139
|
+
puts @opts
|
140
140
|
#RDoc::usage('usage') # gets usage from comments above
|
141
141
|
end
|
142
142
|
|