you_track 0.4.6 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: efc854397c048b67fd8208e3a39c9ae31da3b4c2
4
- data.tar.gz: 6de4435788bd6106c336fc929fbb22eadb069aa9
3
+ metadata.gz: fb508f765c63379fa92d71225d020409e27880a1
4
+ data.tar.gz: acd0ac2005f571727435031975af75e66bf5595b
5
5
  SHA512:
6
- metadata.gz: a12c41ca3d91891216fd7099143b7bc105710ec8c89b945e9c8dde695a4c89e4eee597847bcd9ef619752640a61d6030088f4fd1ad306ca4f6c4a2b6a648cf03
7
- data.tar.gz: 38bc069f217bd405b16bb1b04fb7f55177369f5b42e0a9e66bc09e244b08937c542997741288ea3ef15d60941bbf9015aa7f776e4a41fea4c1cf98cd3e5973ba
6
+ metadata.gz: ae9c7c0e97112d80d0a27d5a84d04aa17ab0da9425adc06a47e8c5efb43f68e54b800539664058278e52c243baff3d785a0862f61f5483b91b174516893caa7b
7
+ data.tar.gz: 4149e84c106b152dc9c606f3c2560da2826b728aa0d86e3a79ee9d618d352c1b886581c1229014596ce30a9bd28025263cf4dd338407d373d7f45a9c815a7e67
@@ -29,8 +29,24 @@ class YouTrack::Client::ApplyIssueCommand < YouTrack::Client::Request
29
29
  }
30
30
  end
31
31
 
32
- if params["command"]
33
- commands = params["command"].split.each_slice(2).map { |a| [a[0], a[1]] }
32
+ if command = params["command"]
33
+ words = command.scan(/[^\s]+/) # ["State", "In", "Progress", "Assignee", "jlane"]
34
+ acceptable_commands = find(:project_custom_fields, issue["projectShortName"]).map { |cf| cf["name"] }
35
+
36
+ command_map = Hash.new { |h,k| h[k] = [] }
37
+
38
+ current_command = words.shift
39
+ words.each do |word|
40
+ unless acceptable_commands.include?(word)
41
+ command_map[current_command] << word
42
+ else
43
+ # @todo validate command on closer
44
+ current_command = word
45
+ end
46
+ end
47
+
48
+ commands = command_map.inject({}) { |r,(k,v)| r.merge(k => v.join(" ")) }
49
+
34
50
  commands.each do |field, value|
35
51
  prototype = service.data[:custom_fields].fetch(field)
36
52
 
@@ -1,3 +1,3 @@
1
1
  module YouTrack
2
- VERSION = "0.4.6"
2
+ VERSION = "0.4.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: you_track
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Lane