mosespa 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mosespa.rb +17 -6
  3. data/mosespa.gemspec +1 -1
  4. metadata +2 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aea083afa1aa14d26feea624c31ecbf54f7fa6d5
4
- data.tar.gz: 3cd8a8f45e749582cd7c758409be5bfc4726990f
3
+ metadata.gz: 9dd5323938a623f4a172c72c1abb11ffdeb66e5d
4
+ data.tar.gz: 5dc78ede5463b4a86b981cd9f584d70891bca9a4
5
5
  SHA512:
6
- metadata.gz: 1aaaec3c2b0ea469ebac02fc4c2bbf76ea73e54459299ec9e72c901671569393541f48f3f1008a1ce5a399ed6f7d3e2c434033c132c133706e3fb2e6e6250a12
7
- data.tar.gz: db75da057b24b243974af01afab88b43920f83c77260ca7caafa9f64d998afdfdc3a36e3e493c0fe2f02dcae24e57c9d53ad9485b31f42303ee743945197af13
6
+ metadata.gz: 12b70d35f7478ee2b2abf7375ff82cd8747ea675783ce2d6ca28d17079cf7a89d3de8cc01f65b1ec5f5c1ca5a218c9fe9a0d0f1993fe68419736420ee1971c04
7
+ data.tar.gz: fe835b345b691a89e1c1e6892dd2e3c4930828c2078ce761055c108277644dd5cc8be3968184aec8452804d2fe9cffdb03c3a647df251abd2ba81ce7ab1de0c6
@@ -36,11 +36,13 @@ module Mosespa
36
36
  file = Tempfile.new('mosespa')
37
37
  need_external_editor = summary.nil?
38
38
  if need_external_editor
39
- summary, description = create_get_options(file, project, summary, description)
39
+ task_type, summary, description = create_get_options(file, project,'Task' ,summary, description)
40
+ $stderr.puts "Ticket type was: #{task_type}"
41
+ $stderr.puts "Summary was: #{summary}"
40
42
  end
41
- fail "Won't create a ticket without summary" if summary.nil?
43
+ fail "Won't create a ticket without summary" if summary.nil? or summary.empty?
42
44
  t = client.Issue.build
43
- request = {'summary' => summary, 'description' => description, 'project' => {'key' => project.key}, 'issuetype' => {'name'=> 'Task'} }
45
+ request = {'summary' => summary, 'description' => description, 'project' => {'key' => project.key}, 'issuetype' => {'name'=> task_type || 'Task'} }
44
46
  begin
45
47
  resp = t.save!({'fields' =>request})
46
48
  rescue Exception => e
@@ -52,8 +54,8 @@ module Mosespa
52
54
  file.unlink
53
55
  end
54
56
 
55
- def create_get_options(file, project, summary, description)
56
- file.write(summary || "")
57
+ def create_get_options(file, project, task_type, summary, description)
58
+ file.write(summary || "Task:")
57
59
  file.write("\n")
58
60
  file.write("\n")
59
61
  file.write(description ||"")
@@ -61,17 +63,26 @@ module Mosespa
61
63
  file.write("# Here you can edit the ticket you want to create\n")
62
64
  file.write("# Line starting with a # will be ignored\n")
63
65
  file.write("# The format is the same as a git commit\n")
66
+ file.write("\n")
67
+ file.write("Summary line follows this template : [TaskType]: [Title]\n")
68
+ file.write("This means that if you write: Story: Create a prototype of SOA\n")
69
+ file.write("You'll get a new story about creating a SOA prototype")
70
+ file.write("The summary line is always followed by an empty line and may be followed by a description")
71
+ file.write("\n\n")
64
72
  file.write("# /* vim: set filetype=gitcommit : */")
65
73
  file.close #need to flush
66
74
  file.open
67
75
  system "$EDITOR #{file.path}"
68
76
  all = file.read.lines.reject {|l| l.start_with? "#"}.map {|l| l.chop}
69
77
  summary = all[0]
78
+ m = /^(?<task_type>\w+):(.*)/.match(summary)
79
+ task_type, summary = m.to_a.drop(1) if m
80
+
70
81
  description = all.drop(2).join("\n")
71
82
  puts "summary: #{summary}"
72
83
  puts "description: #{description}"
73
84
  file.close
74
- [summary, description]
85
+ [task_type, summary, description]
75
86
  end
76
87
  end
77
88
 
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "mosespa"
6
- s.version = '1.1.0'
6
+ s.version = '1.2.0'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Grégoire Seux"]
9
9
  s.license = "Apache License v2"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mosespa
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grégoire Seux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-17 00:00:00.000000000 Z
11
+ date: 2013-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jira-ruby
@@ -92,4 +92,3 @@ signing_key:
92
92
  specification_version: 4
93
93
  summary: Play on command line with JIRA
94
94
  test_files: []
95
- has_rdoc: