fogbugz 1.0.3 → 1.0.4

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.
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 3
9
- version: 1.0.3
8
+ - 4
9
+ version: 1.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Erik Charlebois
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-05-22 00:00:00 -04:00
17
+ date: 2012-05-29 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -29,7 +29,19 @@ dependencies:
29
29
  version: "0"
30
30
  type: :runtime
31
31
  version_requirements: *id001
32
- description:
32
+ - !ruby/object:Gem::Dependency
33
+ name: chronic
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
+ description: A command line interface to FogBugz.
33
45
  email: erikcharlebois@gmail.com
34
46
  executables:
35
47
  - fogbugz
@@ -44,7 +56,7 @@ executables:
44
56
  - fogbugz-login
45
57
  - fogbugz-logoff
46
58
  - fogbugz-milestones
47
- - fogbugz-new
59
+ - fogbugz-open
48
60
  - fogbugz-people
49
61
  - fogbugz-priorities
50
62
  - fogbugz-projects
@@ -60,7 +72,7 @@ extensions: []
60
72
  extra_rdoc_files: []
61
73
 
62
74
  files:
63
- - lib/dummy.rb
75
+ - lib/fogbugz/common.rb
64
76
  has_rdoc: true
65
77
  homepage: https://github.com/erikcharlebois/fogbugz
66
78
  licenses:
@@ -86,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
98
  version: "0"
87
99
  requirements: []
88
100
 
89
- rubyforge_project:
101
+ rubyforge_project: nowarning
90
102
  rubygems_version: 1.3.6
91
103
  signing_key:
92
104
  specification_version: 3
@@ -1,175 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require 'net/https'
5
- require 'uri'
6
- require 'rexml/document'
7
- require 'tempfile'
8
- require 'optparse'
9
- require 'yaml'
10
- require 'English'
11
-
12
- api_url = ENV['FOGBUGZ_API_URL']
13
- unless api_url
14
- puts "Environment variable FOGBUGZ_API_URL must be set."
15
- exit 1
16
- end
17
-
18
- api_token = ENV['FOGBUGZ_API_TOKEN']
19
- unless api_token
20
- puts "Environment variable FOGBUGZ_API_TOKEN must be set."
21
- exit 1
22
- end
23
-
24
- editor = ENV['EDITOR'] || 'vim'
25
-
26
- options = {}
27
- optparse = OptionParser.new do |opts|
28
- opts.banner = "usage: #{File::basename(__FILE__)} [options] [-|files]"
29
-
30
- opts.on_tail('-h', '--help') do
31
- puts optparse.help
32
- exit 1
33
- end
34
-
35
- options[:file] = nil
36
- opts.on('-f', '--file=<file>',
37
- 'Take the case content from the given file. Use - to read from STDIN.') do |file|
38
- options[:file] = file
39
- end
40
-
41
- options[:template] = nil
42
- opts.on('-t', '--template=<template>',
43
- 'Use the file content or - for STDIN as the initial case content.') do |template|
44
- options[:template] = template
45
- end
46
- end
47
- optparse.parse!
48
-
49
- unless ARGV.empty?
50
- puts optparse.help
51
- exit 1
52
- end
53
-
54
- invoke_editor = true
55
- if options[:file]
56
- if options[:file] == '-'
57
- ARGV.replace []
58
- else
59
- ARGV.replace [options[:file]]
60
- end
61
- template = ARGF.read
62
- invoke_editor = false
63
- elsif options[:template]
64
- if options[:template] == '-'
65
- ARGV.replace []
66
- else
67
- ARGV.replace [options[:template]]
68
- end
69
- template = ARGF.read
70
- else
71
- template = <<HERE
72
- # Fill in metadata for the case.
73
- # title: <title>
74
- # assignee: <person>
75
- # parent: <case>
76
- # tags: [bug, enhancement]
77
- # project: <project>
78
- # area: <area>
79
- # milestone: <milestone>
80
- # category: <category>
81
- # priority: <priority>
82
- # estimate: <hours>
83
-
84
- # Enter an optional description of the case after the dashes.
85
- ---
86
- HERE
87
- end
88
-
89
- content = template
90
- if invoke_editor
91
- tempfile = Tempfile.new ['case', '.md']
92
- tempfile.write template
93
- tempfile.close
94
- rc = system "#{editor} #{tempfile.path}"
95
- unless rc
96
- puts "Editor exited with non-zero status. Aborting."
97
- exit 1
98
- end
99
- tempfile.open
100
- content = tempfile.read
101
- tempfile.close
102
- tempfile.delete
103
- end
104
-
105
- data = {}
106
- if content =~ /(.*?\n?)^(---\s*$\n?)/m
107
- # Combined YAML front matter with text content.
108
- begin
109
- data = YAML.load($1) || {}
110
- data['body'] = $POSTMATCH if $POSTMATCH and not $POSTMATCH.empty?
111
- rescue => e
112
- puts "Exception reading YAML front matter. #{e.inspect}"
113
- exit 1
114
- end
115
- else
116
- begin
117
- # YAML only content.
118
- data = YAML.load(content)
119
- if data.instance_of? String
120
- # Text only content.
121
- data = { 'body' => data }
122
- end
123
- rescue => e
124
- data = {}
125
- end
126
- end
127
-
128
- if not data or data.empty?
129
- puts "No content for case. Aborting."
130
- exit 1
131
- end
132
-
133
- sTitle = data['title'] ? "&sTitle=#{URI.escape(data['title'].to_s)}" : ''
134
- ixBugParent = (data['parent'] ?
135
- "&ixBugParent=#{URI.escape(data['parent'].to_s)}" : '')
136
- sTags = data['tags'] ? "&sTags=#{URI.escape(data['tags'].join(','))}" : ''
137
- sProject = (data['project'] ?
138
- "&sProject=#{URI.escape(data['project'].to_s)}" : '')
139
- sArea = data['area'] ? "&sArea=#{URI.escape(data['area'].to_s)}" : ''
140
- sFixFor = (data['milestone'] ?
141
- "&sFixFor=#{URI.escape(data['milestone'].to_s)}" : '')
142
- sCategory = (data['category'] ?
143
- "&sCategory=#{URI.escape(data['category'].to_s)}" : '')
144
- sPersonAssignedTo = (data['assignee'] ?
145
- "&sPersonAssignedTo=#{URI.escape(data['assignee'].to_s)}" :
146
- '')
147
- sPriority = (data['priority'] ?
148
- "&sPriority=#{URI.escape(data['priority'].to_s)}" : '')
149
- hrsCurrEst = (data['estimate'] ?
150
- "&hrsCurrEst=#{URI.escape(data['estimate'].to_s)}" : '')
151
- sEvent = data['body'] ? "&sEvent=#{URI.escape(data['body'].to_s)}" : ''
152
-
153
- uri = URI format("#{api_url}?cmd=new&token=%s%s%s%s%s%s%s%s%s%s%s%s",
154
- URI.escape(api_token),
155
- sTitle, ixBugParent, sTags, sProject, sArea, sFixFor, sCategory,
156
- sPersonAssignedTo, sPriority, hrsCurrEst, sEvent)
157
- http = Net::HTTP.new(uri.host, uri.port)
158
- if uri.scheme == 'https'
159
- http.use_ssl = true
160
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
161
- end
162
- response = http.start { |h| h.request Net::HTTP::Get.new(uri.request_uri) }
163
- if response.code != '200'
164
- puts "HTTP request to #{api_url} failed with code #{response.code}."
165
- exit 1
166
- end
167
-
168
- result = REXML::Document.new(response.body)
169
- error = result.elements['/response/error']
170
- if error
171
- puts "Failed with error: #{error.text}."
172
- exit 1
173
- end
174
-
175
- puts "Case #{result.elements['/response/case'].attributes['ixBug']} created."
@@ -1 +0,0 @@
1
- # A dummy fine in lib/ to prevent a gem install error.