fogbugz 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'typhoeus'
5
+ require 'xml'
6
+ require 'optparse'
7
+
8
+ api_url = ENV['FOGBUGZ_API_URL']
9
+ unless api_url
10
+ puts "Environment variable FOGBUGZ_API_URL must be set."
11
+ exit 1
12
+ end
13
+
14
+ api_token = ENV['FOGBUGZ_API_TOKEN']
15
+ unless api_url
16
+ puts "Environment variable FOGBUGZ_API_TOKEN must be set."
17
+ exit 1
18
+ end
19
+
20
+ options = {}
21
+ optparse = OptionParser.new do |opts|
22
+ opts.banner = "usage: #{File::basename(__FILE__)} [options] <case>"
23
+
24
+ options[:verbose] = false
25
+ opts.on('-v', '--verbose', 'Output verbose debugging information.') do
26
+ options[:verbose] = true
27
+ end
28
+
29
+ opts.on_tail('-h', '--help') do
30
+ puts optparse.help
31
+ exit 1
32
+ end
33
+ end
34
+ optparse.parse!
35
+ unless ARGV[0]
36
+ puts optparse.help
37
+ exit 1
38
+ end
39
+
40
+ response = Typhoeus::Request.get(api_url,
41
+ :verbose => options[:verbose],
42
+ :params => {
43
+ :cmd => 'startWork',
44
+ :token => api_token,
45
+ :ixBug => ARGV[0] })
46
+ if response.code != 200
47
+ puts "HTTP request to #{api_url} failed with code #{response.code}."
48
+ exit 1
49
+ end
50
+
51
+ error = XML::Parser.string(response.body).parse.find_first('/response/error')
52
+ if error
53
+ puts "Failed with error: #{error.content}."
54
+ exit 1
55
+ end
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'typhoeus'
5
+ require 'xml'
6
+ require 'optparse'
7
+ require 'set'
8
+
9
+ api_url = ENV['FOGBUGZ_API_URL']
10
+ unless api_url
11
+ puts "Environment variable FOGBUGZ_API_URL must be set."
12
+ exit 1
13
+ end
14
+
15
+ api_token = ENV['FOGBUGZ_API_TOKEN']
16
+ unless api_url
17
+ puts "Environment variable FOGBUGZ_API_TOKEN must be set."
18
+ exit 1
19
+ end
20
+
21
+ options = {}
22
+ optparse = OptionParser.new do |opts|
23
+ opts.banner = "usage: #{File::basename(__FILE__)} [options]"
24
+
25
+ options[:verbose] = false
26
+ opts.on('-v', '--verbose', 'Output verbose debugging information') do
27
+ options[:verbose] = true
28
+ end
29
+
30
+ opts.on_tail('-h', '--help') do
31
+ puts optparse.help
32
+ exit 1
33
+ end
34
+
35
+ options[:resolved] = false
36
+ opts.on('-r', '--resolved', 'Only show resolved statuses.') do
37
+ options[:resolved] = true
38
+ end
39
+ end
40
+ optparse.parse!
41
+
42
+ response = Typhoeus::Request.get(api_url,
43
+ :verbose => options[:verbose],
44
+ :params => {
45
+ :cmd => 'listStatuses',
46
+ :token => api_token,
47
+ :fResolved => options[:resolved] ? 1 : nil })
48
+ if response.code != 200
49
+ puts "HTTP request to #{api_url} failed with code #{response.code}."
50
+ exit 1
51
+ end
52
+
53
+ result = XML::Parser.string(response.body).parse
54
+ error = result.find_first('/response/error')
55
+ if error
56
+ puts "Failed with error: #{error.content}."
57
+ exit 1
58
+ end
59
+
60
+ result.find('/response/statuses/status').map { |s|
61
+ s.find_first('sStatus').content
62
+ }.uniq!.sort!.each { |s| puts s }
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'typhoeus'
5
+ require 'xml'
6
+ require 'optparse'
7
+
8
+ api_url = ENV['FOGBUGZ_API_URL']
9
+ unless api_url
10
+ puts "Environment variable FOGBUGZ_API_URL must be set."
11
+ exit 1
12
+ end
13
+
14
+ api_token = ENV['FOGBUGZ_API_TOKEN']
15
+ unless api_url
16
+ puts "Environment variable FOGBUGZ_API_TOKEN must be set."
17
+ exit 1
18
+ end
19
+
20
+ options = {}
21
+ optparse = OptionParser.new do |opts|
22
+ opts.banner = "usage: #{File::basename(__FILE__)} [options]"
23
+
24
+ options[:verbose] = false
25
+ opts.on('-v', '--verbose', 'Output verbose debugging information.') do
26
+ options[:verbose] = true
27
+ end
28
+
29
+ opts.on_tail('-h', '--help') do
30
+ puts optparse.help
31
+ exit 1
32
+ end
33
+ end
34
+ optparse.parse!
35
+
36
+ response = Typhoeus::Request.get(api_url,
37
+ :verbose => options[:verbose],
38
+ :params => {
39
+ :cmd => 'stopWork',
40
+ :token => api_token })
41
+ if response.code != 200
42
+ puts "HTTP request to #{api_url} failed with code #{response.code}."
43
+ exit 1
44
+ end
45
+
46
+ error = XML::Parser.string(response.body).parse.find_first('/response/error')
47
+ if error
48
+ puts "Failed with error: #{error.content}."
49
+ exit 1
50
+ end
@@ -0,0 +1 @@
1
+ # A dummy fine in lib/ to prevent a gem install error.
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fogbugz
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 1
9
+ version: 1.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Erik Charlebois
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2012-05-21 00:00:00 -04:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: typhoeus
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: libxml-ruby
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ version: "0"
42
+ type: :runtime
43
+ version_requirements: *id002
44
+ - !ruby/object:Gem::Dependency
45
+ name: term-ansicolor
46
+ prerelease: false
47
+ requirement: &id003 !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ segments:
52
+ - 0
53
+ version: "0"
54
+ type: :runtime
55
+ version_requirements: *id003
56
+ description:
57
+ email: erikcharlebois@gmail.com
58
+ executables:
59
+ - fogbugz
60
+ - fogbugz-areas
61
+ - fogbugz-assign
62
+ - fogbugz-categories
63
+ - fogbugz-close
64
+ - fogbugz-edit
65
+ - fogbugz-filter
66
+ - fogbugz-filters
67
+ - fogbugz-list
68
+ - fogbugz-login
69
+ - fogbugz-logoff
70
+ - fogbugz-milestones
71
+ - fogbugz-new
72
+ - fogbugz-people
73
+ - fogbugz-priorities
74
+ - fogbugz-projects
75
+ - fogbugz-reactivate
76
+ - fogbugz-reopen
77
+ - fogbugz-resolve
78
+ - fogbugz-show
79
+ - fogbugz-start
80
+ - fogbugz-statuses
81
+ - fogbugz-stop
82
+ extensions: []
83
+
84
+ extra_rdoc_files: []
85
+
86
+ files:
87
+ - lib/dummy.rb
88
+ has_rdoc: true
89
+ homepage: https://github.com/erikcharlebois/fogbugz
90
+ licenses:
91
+ - BSD
92
+ post_install_message:
93
+ rdoc_options: []
94
+
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ segments:
102
+ - 0
103
+ version: "0"
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ segments:
109
+ - 0
110
+ version: "0"
111
+ requirements: []
112
+
113
+ rubyforge_project:
114
+ rubygems_version: 1.3.6
115
+ signing_key:
116
+ specification_version: 3
117
+ summary: A command line interface to FogBugz.
118
+ test_files: []
119
+