ki_middleman 0.0.7 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,38 @@
1
+ # CRAZY CONSTANT AND METHOD MADNESS GOES HERE
2
+
3
+ PIVOTAL_ACCOUNT_NAME = 'Kiseru'
4
+ COMPLEX_DESCRIPTION = <<eos
5
+ Posted from machine '#{`uname -nrm`.chomp}' by #{`whoami`.chomp}
6
+ The sunset in Edinburgh will be at:
7
+ #{`curl 'http://new.uk.weather.yahoo.com/scotland/lothian/edinburgh-19344/' 2> /dev/null`.split('<dt>Sunset:</dt><dd>')[1].split('</dd>')[0]}
8
+ eos
9
+
10
+ def random_case(string)
11
+ string.each_char.map { |c| rand > 0.5 ? c.upcase : c.downcase }.join
12
+ end
13
+
14
+ # BEGIN TRANSLATION RULES
15
+
1
16
  from :youtrack_issue do |issue|
2
17
  to :pivotal_story do
3
18
  {
4
19
  "name" => "[#{issue.id}] #{issue.summary}",
5
- "description" =>"Youtrack: #{issue.issue_url}\n#{issue.description}",
6
- "requested_by" => "Kiseru",
20
+ "description" =>"Youtrack: #{issue.issue_url}\n#{issue.description}\nThis was automatically generated by #{PIVOTAL_ACCOUNT_NAME}",
21
+ "requested_by" => PIVOTAL_ACCOUNT_NAME,
7
22
  "story_type" => "bug"
8
23
  }
9
24
  end
25
+ to :complicated_story do
26
+ `espeak 'your youtrack issue is being translated to something ridiculous'`
27
+ {
28
+ "name" => random_case("Test story posted at #{Time.now}")+", Original name: #{issue.summary}",
29
+ "description" => "#{random_case(COMPLEX_DESCRIPTION)} \n"+"also #{issue.description}",
30
+ "story_type" => "feature",
31
+ "requested_by" => PIVOTAL_ACCOUNT_NAME,
32
+ "owned_by" => PIVOTAL_ACCOUNT_NAME,
33
+ "project_id" => "617613"
34
+ }
35
+ end
10
36
  to :something_not_implemented_yet do
11
37
  {
12
38
  }
data/bin/ki_middleman CHANGED
@@ -42,6 +42,15 @@ module KiMiddleman
42
42
  input = MultiJson.load($stdin.read)
43
43
  end
44
44
  output = config.convert_data_to_format(input, output_type)
45
+ if options[:set]
46
+ assignments = Array(options[:set].split(','))
47
+ patch = Hash.new
48
+ assignments.each do |assignment|
49
+ key,value = assignment.split('=')
50
+ patch[key] = value
51
+ end
52
+ output.merge!(patch)
53
+ end
45
54
  $stdout.write MultiJson.dump(output, :pretty => pretty)
46
55
  rescue MultiJson::DecodeError => e
47
56
  $stderr.puts "Invalid JSON"
@@ -60,6 +69,7 @@ module KiMiddleman
60
69
  on("--init", "Set up the default config files")
61
70
  on("--file FILE", "Read JSON from file")
62
71
  on("--list", "List available transformations")
72
+ on("--set key=value,key2=value", "Specify a set of values to override (ignoring the transform rules)")
63
73
  go!
64
74
 
65
75
  end
@@ -1,3 +1,3 @@
1
1
  module KiMiddleman
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ki_middleman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-08-16 00:00:00.000000000Z
13
+ date: 2012-08-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json
17
- requirement: &70146996153140 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,15 @@ dependencies:
22
22
  version: 1.3.6
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70146996153140
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: 1.3.6
26
31
  - !ruby/object:Gem::Dependency
27
32
  name: methadone
28
- requirement: &70146996152640 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
29
34
  none: false
30
35
  requirements:
31
36
  - - ~>
@@ -33,10 +38,15 @@ dependencies:
33
38
  version: 1.2.1
34
39
  type: :runtime
35
40
  prerelease: false
36
- version_requirements: *70146996152640
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: 1.2.1
37
47
  - !ruby/object:Gem::Dependency
38
48
  name: map
39
- requirement: &70146996152180 !ruby/object:Gem::Requirement
49
+ requirement: !ruby/object:Gem::Requirement
40
50
  none: false
41
51
  requirements:
42
52
  - - ~>
@@ -44,10 +54,15 @@ dependencies:
44
54
  version: 4.6.1
45
55
  type: :runtime
46
56
  prerelease: false
47
- version_requirements: *70146996152180
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: 4.6.1
48
63
  - !ruby/object:Gem::Dependency
49
64
  name: debugger
50
- requirement: &70146996151720 !ruby/object:Gem::Requirement
65
+ requirement: !ruby/object:Gem::Requirement
51
66
  none: false
52
67
  requirements:
53
68
  - - ~>
@@ -55,10 +70,15 @@ dependencies:
55
70
  version: 1.2.0
56
71
  type: :development
57
72
  prerelease: false
58
- version_requirements: *70146996151720
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ version: 1.2.0
59
79
  - !ruby/object:Gem::Dependency
60
80
  name: rake
61
- requirement: &70146996151260 !ruby/object:Gem::Requirement
81
+ requirement: !ruby/object:Gem::Requirement
62
82
  none: false
63
83
  requirements:
64
84
  - - ~>
@@ -66,10 +86,15 @@ dependencies:
66
86
  version: 0.9.2
67
87
  type: :development
68
88
  prerelease: false
69
- version_requirements: *70146996151260
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ~>
93
+ - !ruby/object:Gem::Version
94
+ version: 0.9.2
70
95
  - !ruby/object:Gem::Dependency
71
96
  name: rspec
72
- requirement: &70146996150800 !ruby/object:Gem::Requirement
97
+ requirement: !ruby/object:Gem::Requirement
73
98
  none: false
74
99
  requirements:
75
100
  - - ~>
@@ -77,10 +102,15 @@ dependencies:
77
102
  version: 2.11.0
78
103
  type: :development
79
104
  prerelease: false
80
- version_requirements: *70146996150800
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 2.11.0
81
111
  - !ruby/object:Gem::Dependency
82
112
  name: simplecov
83
- requirement: &70146996150340 !ruby/object:Gem::Requirement
113
+ requirement: !ruby/object:Gem::Requirement
84
114
  none: false
85
115
  requirements:
86
116
  - - ~>
@@ -88,7 +118,12 @@ dependencies:
88
118
  version: 0.6.4
89
119
  type: :development
90
120
  prerelease: false
91
- version_requirements: *70146996150340
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ~>
125
+ - !ruby/object:Gem::Version
126
+ version: 0.6.4
92
127
  description: Transforms JSON into other JSON
93
128
  email:
94
129
  - ben@freeagent.com
@@ -133,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
168
  version: '0'
134
169
  requirements: []
135
170
  rubyforge_project:
136
- rubygems_version: 1.8.10
171
+ rubygems_version: 1.8.24
137
172
  signing_key:
138
173
  specification_version: 3
139
174
  summary: Transforms JSON into other JSON