fogbugz 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/fogbugz-login +24 -2
- metadata +2 -2
data/bin/fogbugz-login
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
require 'fogbugz/common'
|
3
3
|
|
4
4
|
check_api_url
|
5
|
-
check_api_token
|
6
5
|
|
7
6
|
options = {}
|
8
7
|
optparse = OptionParser.new do |opts|
|
@@ -27,7 +26,30 @@ end
|
|
27
26
|
password = options[:password] ||
|
28
27
|
HighLine.new.ask('Password: ') { |q| q.echo = false }
|
29
28
|
|
30
|
-
|
29
|
+
api_url = ENV['FOGBUGZ_API_URL']
|
30
|
+
|
31
|
+
uri = URI("#{api_url}?cmd=logon&email=#{URI.escape(ARGV[0])}&" +
|
32
|
+
"password=#{URI.escape(password)}")
|
33
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
34
|
+
if uri.scheme == 'https'
|
35
|
+
http.use_ssl = true
|
36
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
37
|
+
end
|
38
|
+
response = http.start do |h|
|
39
|
+
h.request Net::HTTP::Get.new(uri.request_uri)
|
40
|
+
end
|
41
|
+
if response.code != '200'
|
42
|
+
puts "HTTP request to #{api_url} failed with code #{response.code}."
|
43
|
+
exit 1
|
44
|
+
end
|
45
|
+
|
46
|
+
result = REXML::Document.new(response.body)
|
47
|
+
error = result.elements['/response/error']
|
48
|
+
if error
|
49
|
+
puts "Failed with error: #{error.text}."
|
50
|
+
exit 1
|
51
|
+
end
|
52
|
+
|
31
53
|
puts <<HERE
|
32
54
|
Login successful. Set the following environment variable:
|
33
55
|
export FOGBUGZ_API_TOKEN=#{result.elements['/response/token'].text}
|
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.6
|
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-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: highline
|