fogbugz 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/fogbugz +0 -2
- data/bin/fogbugz-estimate +8 -0
- data/bin/fogbugz-filter +2 -2
- data/bin/fogbugz-login +22 -15
- data/bin/fogbugz-logoff +3 -0
- data/lib/fogbugz/common.rb +13 -6
- metadata +4 -2
data/bin/fogbugz
CHANGED
data/bin/fogbugz-filter
CHANGED
@@ -4,8 +4,8 @@ require 'fogbugz/common'
|
|
4
4
|
check_api_url
|
5
5
|
check_api_token
|
6
6
|
|
7
|
-
api_url =
|
8
|
-
api_token =
|
7
|
+
api_url = CONFIG[:api_url]
|
8
|
+
api_token = CONFIG[:api_token]
|
9
9
|
|
10
10
|
parse_opts "usage: #{File::basename(__FILE__)} [options] <filter>", 1
|
11
11
|
|
data/bin/fogbugz-login
CHANGED
@@ -1,14 +1,22 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'fogbugz/common'
|
3
3
|
|
4
|
-
check_api_url
|
5
|
-
|
6
4
|
options = {}
|
7
5
|
optparse = OptionParser.new do |opts|
|
8
|
-
opts.banner = "usage: #{File::basename(__FILE__)} [options]
|
6
|
+
opts.banner = "usage: #{File::basename(__FILE__)} [options]"
|
7
|
+
|
8
|
+
options[:email] = nil
|
9
|
+
opts.on_tail('--email=<email>') do |password|
|
10
|
+
options[:email] = password
|
11
|
+
end
|
12
|
+
|
13
|
+
options[:api_url] = nil
|
14
|
+
opts.on_tail('--apiurl=<apiurl>') do |api_url|
|
15
|
+
options[:api_url] = api_url
|
16
|
+
end
|
9
17
|
|
10
18
|
options[:password] = nil
|
11
|
-
opts.on_tail('
|
19
|
+
opts.on_tail('--password=<password>') do |password|
|
12
20
|
options[:password] = password
|
13
21
|
end
|
14
22
|
|
@@ -18,17 +26,15 @@ optparse = OptionParser.new do |opts|
|
|
18
26
|
end
|
19
27
|
end
|
20
28
|
optparse.parse!
|
21
|
-
unless ARGV.length == 1
|
22
|
-
puts optparse.help
|
23
|
-
exit 1
|
24
|
-
end
|
25
29
|
|
30
|
+
api_url = options[:api_url] || CONFIG[:api_url] ||
|
31
|
+
HighLine.new.ask('API URL: ')
|
32
|
+
email = options[:email] || CONFIG[:email] ||
|
33
|
+
HighLine.new.ask('Email: ')
|
26
34
|
password = options[:password] ||
|
27
35
|
HighLine.new.ask('Password: ') { |q| q.echo = false }
|
28
36
|
|
29
|
-
|
30
|
-
|
31
|
-
uri = URI("#{api_url}?cmd=logon&email=#{URI.escape(ARGV[0])}&" +
|
37
|
+
uri = URI("#{api_url}?cmd=logon&email=#{URI.escape(email)}&" +
|
32
38
|
"password=#{URI.escape(password)}")
|
33
39
|
http = Net::HTTP.new(uri.host, uri.port)
|
34
40
|
if uri.scheme == 'https'
|
@@ -50,7 +56,8 @@ if error
|
|
50
56
|
exit 1
|
51
57
|
end
|
52
58
|
|
53
|
-
puts
|
54
|
-
|
55
|
-
|
56
|
-
|
59
|
+
puts "Login successful."
|
60
|
+
CONFIG[:email] = email
|
61
|
+
CONFIG[:api_url] = api_url
|
62
|
+
CONFIG[:api_token] = "#{result.elements['/response/token'].text}"
|
63
|
+
IO::write(CONFIG_FILE, CONFIG.to_yaml)
|
data/bin/fogbugz-logoff
CHANGED
data/lib/fogbugz/common.rb
CHANGED
@@ -9,6 +9,13 @@ require 'English'
|
|
9
9
|
require 'time'
|
10
10
|
require 'chronic'
|
11
11
|
|
12
|
+
CONFIG_FILE = Dir.home + '/.fogbugzrc'
|
13
|
+
begin
|
14
|
+
CONFIG = YAML::load(IO::read(CONFIG_FILE))
|
15
|
+
rescue
|
16
|
+
CONFIG = {}
|
17
|
+
end
|
18
|
+
|
12
19
|
HighLine.use_color = STDOUT.isatty
|
13
20
|
begin
|
14
21
|
require 'win32console' if RUBY_PLATFORM =~ /mingw/
|
@@ -24,15 +31,15 @@ def m; HighLine.use_color? ? HighLine::MAGENTA : ''; end
|
|
24
31
|
def c; HighLine.use_color? ? HighLine::CLEAR : ''; end
|
25
32
|
|
26
33
|
def check_api_url
|
27
|
-
unless
|
28
|
-
puts "
|
34
|
+
unless CONFIG[:api_url]
|
35
|
+
puts "Not logged in."
|
29
36
|
exit 1
|
30
37
|
end
|
31
38
|
end
|
32
39
|
|
33
40
|
def check_api_token
|
34
|
-
unless
|
35
|
-
puts "
|
41
|
+
unless CONFIG[:api_token]
|
42
|
+
puts "Not logged in."
|
36
43
|
exit 1
|
37
44
|
end
|
38
45
|
end
|
@@ -293,8 +300,8 @@ def maybe_literal(xml)
|
|
293
300
|
end
|
294
301
|
|
295
302
|
def do_api(cmd, params={})
|
296
|
-
api_url =
|
297
|
-
api_token =
|
303
|
+
api_url = CONFIG[:api_url]
|
304
|
+
api_token = CONFIG[:api_token]
|
298
305
|
|
299
306
|
query = ''
|
300
307
|
params.each_pair do |k,v|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fogbugz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: highline
|
@@ -54,6 +54,7 @@ executables:
|
|
54
54
|
- fogbugz-categories
|
55
55
|
- fogbugz-close
|
56
56
|
- fogbugz-edit
|
57
|
+
- fogbugz-estimate
|
57
58
|
- fogbugz-filter
|
58
59
|
- fogbugz-filters
|
59
60
|
- fogbugz-list
|
@@ -81,6 +82,7 @@ files:
|
|
81
82
|
- bin/fogbugz-categories
|
82
83
|
- bin/fogbugz-close
|
83
84
|
- bin/fogbugz-edit
|
85
|
+
- bin/fogbugz-estimate
|
84
86
|
- bin/fogbugz-filter
|
85
87
|
- bin/fogbugz-filters
|
86
88
|
- bin/fogbugz-list
|