ki_middleman 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/{transform.rb → assets/default_transforms.rb} +0 -0
- data/bin/ki_middleman +20 -3
- data/ki_middleman.gemspec +2 -1
- data/lib/ki_middleman.rb +4 -0
- data/lib/ki_middleman/version.rb +1 -1
- metadata +30 -13
File without changes
|
data/bin/ki_middleman
CHANGED
@@ -1,16 +1,33 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'methadone'
|
3
3
|
require 'ki_middleman'
|
4
|
+
require 'fileutils'
|
4
5
|
|
5
6
|
include Methadone::Main
|
6
7
|
include Methadone::CLILogging
|
7
8
|
|
9
|
+
def init
|
10
|
+
config_dir = Kiseru::ConfigDir.new
|
11
|
+
assets_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'assets'))
|
12
|
+
assets_file = File.join(assets_dir, 'default_transforms.rb')
|
13
|
+
# TODO - duplicated file name here!
|
14
|
+
new_file = config_dir.file('transforms.rb')
|
15
|
+
if File.exists?(new_file)
|
16
|
+
$stdout.puts "Cannot write #{new_file}. File already exists."
|
17
|
+
else
|
18
|
+
$stdout.puts "Copying default transform file to #{new_file}"
|
19
|
+
FileUtils.cp(assets_file, new_file)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
8
23
|
main do |arg|
|
9
|
-
if options[:
|
24
|
+
if options[:init]
|
25
|
+
init
|
26
|
+
elsif options[:to]
|
10
27
|
pretty = $stdout.tty?
|
11
28
|
|
12
29
|
output_type = options[:to]
|
13
|
-
config = KiMiddleman::Config.from_file('
|
30
|
+
config = KiMiddleman::Config.from_file(Kiseru::ConfigDir.new.file('transforms.rb'))
|
14
31
|
input = MultiJson.load($stdin.read)
|
15
32
|
output = config.convert_data_to_format(input, output_type)
|
16
33
|
$stdout.write MultiJson.dump(output, :pretty => pretty)
|
@@ -21,5 +38,5 @@ version KiMiddleman::VERSION
|
|
21
38
|
description 'Transforms JSON into other JSON'
|
22
39
|
|
23
40
|
on("--to FORMAT", "The output JSON format")
|
24
|
-
|
41
|
+
on("--init", "Set up the default config files")
|
25
42
|
go!
|
data/ki_middleman.gemspec
CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.add_dependency('methadone')
|
20
20
|
|
21
21
|
gem.add_development_dependency('debugger')
|
22
|
-
gem.add_development_dependency('
|
22
|
+
gem.add_development_dependency('rake')
|
23
|
+
gem.add_development_dependency('simplecov')
|
23
24
|
gem.add_development_dependency('rspec')
|
24
25
|
end
|
data/lib/ki_middleman.rb
CHANGED
data/lib/ki_middleman/version.rb
CHANGED
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.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ date: 2012-08-14 00:00:00.000000000Z
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multi_json
|
17
|
-
requirement: &
|
17
|
+
requirement: &70235948737180 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70235948737180
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: methadone
|
28
|
-
requirement: &
|
28
|
+
requirement: &70235948735940 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70235948735940
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: debugger
|
39
|
-
requirement: &
|
39
|
+
requirement: &70235948734720 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70235948734720
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
50
|
-
requirement: &
|
49
|
+
name: rake
|
50
|
+
requirement: &70235948732940 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,21 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70235948732940
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: simplecov
|
61
|
+
requirement: &70235948731680 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
type: :development
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *70235948731680
|
59
70
|
- !ruby/object:Gem::Dependency
|
60
71
|
name: rspec
|
61
|
-
requirement: &
|
72
|
+
requirement: &70235948730840 !ruby/object:Gem::Requirement
|
62
73
|
none: false
|
63
74
|
requirements:
|
64
75
|
- - ! '>='
|
@@ -66,7 +77,7 @@ dependencies:
|
|
66
77
|
version: '0'
|
67
78
|
type: :development
|
68
79
|
prerelease: false
|
69
|
-
version_requirements: *
|
80
|
+
version_requirements: *70235948730840
|
70
81
|
description: Transforms JSON into other JSON
|
71
82
|
email:
|
72
83
|
- ben@freeagent.com
|
@@ -82,6 +93,7 @@ files:
|
|
82
93
|
- LICENSE
|
83
94
|
- README.md
|
84
95
|
- Rakefile
|
96
|
+
- assets/default_transforms.rb
|
85
97
|
- bin/ki_middleman
|
86
98
|
- ki_middleman.gemspec
|
87
99
|
- lib/ki_middleman.rb
|
@@ -89,7 +101,6 @@ files:
|
|
89
101
|
- lib/ki_middleman/version.rb
|
90
102
|
- spec/integration/convert_spec.rb
|
91
103
|
- spec/spec_helper.rb
|
92
|
-
- transform.rb
|
93
104
|
homepage: ''
|
94
105
|
licenses: []
|
95
106
|
post_install_message:
|
@@ -102,12 +113,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
102
113
|
- - ! '>='
|
103
114
|
- !ruby/object:Gem::Version
|
104
115
|
version: '0'
|
116
|
+
segments:
|
117
|
+
- 0
|
118
|
+
hash: -2790870063741766204
|
105
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
120
|
none: false
|
107
121
|
requirements:
|
108
122
|
- - ! '>='
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
125
|
+
segments:
|
126
|
+
- 0
|
127
|
+
hash: -2790870063741766204
|
111
128
|
requirements: []
|
112
129
|
rubyforge_project:
|
113
130
|
rubygems_version: 1.8.10
|