tilt-yaml2json 0.0.2 → 0.1.0

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: 0a1bc7afd3ebecf683e1b3a8c653b670aec06bc8
4
- data.tar.gz: 89478fc98f6fa7d6d3d162d71bccdf145fbae850
3
+ metadata.gz: 529289e425f10d60c42e05993e9dc4bb08521974
4
+ data.tar.gz: de51829fc4d12c2502117ebf71215335f7be8583
5
5
  SHA512:
6
- metadata.gz: 4e67ac3c2daf27d0066fb65d0681aed9c2546cb5b910fa278a9c777828e9b814fa9015c12c9ce965aa73204357cafe877791a69e79fb697aa0669cad1032313c
7
- data.tar.gz: 859d2e0fe6954be5f1a99aa14f15caa097fe723f6a2520822dd1b6da2fa5953c6a577720626078d588406cfd4cf471afac5c18b1bf004120901f7bc16d71474d
6
+ metadata.gz: aec89776a103354c662230c1553b047cf8b3123037f84ab48c5eea0aa591024a77630edc4ee7507ceca3dc9b49a605a83141be9cf4fcc3d608b220a1d0f80c7e
7
+ data.tar.gz: 4b8818f7a83e446a53d0dcfa3f02bfe4454796955b0d4cc06f5c5879060ee019c72e2f0a6cd24970eaa4863d11b39449117474a4238d623147ff8450c1c386c7
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm: 2.1.0
3
+
4
+ gemfile:
5
+ - gemfiles/tilt_1.gemfile
6
+ - gemfiles/tilt_2.gemfile
@@ -0,0 +1,7 @@
1
+ appraise 'tilt-1' do
2
+ gem 'tilt', '~> 1.0'
3
+ end
4
+
5
+ appraise 'tilt-2' do
6
+ gem 'tilt', '~> 2.0'
7
+ end
data/README.md CHANGED
@@ -20,7 +20,7 @@ Or install it yourself as:
20
20
  require 'tilt'
21
21
  require 'tilt/yaml2json'
22
22
 
23
- Tilt.register Tilt::YAML2JSONTemplate, 'yml'
23
+ Tilt.register Tilt::YAML2JSON::Template, 'yml'
24
24
 
25
25
  puts Tilt.new('foo.yml').render
26
26
  ```
data/Rakefile CHANGED
@@ -1,2 +1,6 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
2
3
 
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "tilt", "~> 1.0"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,55 @@
1
+ PATH
2
+ remote: ../
3
+ specs:
4
+ tilt-yaml2json (0.0.3)
5
+ multi_json
6
+ tilt
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (4.1.0)
12
+ i18n (~> 0.6, >= 0.6.9)
13
+ json (~> 1.7, >= 1.7.7)
14
+ minitest (~> 5.1)
15
+ thread_safe (~> 0.1)
16
+ tzinfo (~> 1.1)
17
+ appraisal (1.0.0)
18
+ bundler
19
+ rake
20
+ thor (>= 0.14.0)
21
+ diff-lcs (1.2.5)
22
+ i18n (0.6.9)
23
+ json (1.8.1)
24
+ minitest (5.3.3)
25
+ multi_json (1.10.0)
26
+ rake (10.3.1)
27
+ rspec (3.0.0.beta2)
28
+ rspec-core (= 3.0.0.beta2)
29
+ rspec-expectations (= 3.0.0.beta2)
30
+ rspec-mocks (= 3.0.0.beta2)
31
+ rspec-core (3.0.0.beta2)
32
+ rspec-support (= 3.0.0.beta2)
33
+ rspec-expectations (3.0.0.beta2)
34
+ diff-lcs (>= 1.2.0, < 2.0)
35
+ rspec-support (= 3.0.0.beta2)
36
+ rspec-mocks (3.0.0.beta2)
37
+ rspec-support (= 3.0.0.beta2)
38
+ rspec-support (3.0.0.beta2)
39
+ thor (0.19.1)
40
+ thread_safe (0.3.3)
41
+ tilt (1.4.1)
42
+ tzinfo (1.1.0)
43
+ thread_safe (~> 0.1)
44
+
45
+ PLATFORMS
46
+ ruby
47
+
48
+ DEPENDENCIES
49
+ activesupport
50
+ appraisal
51
+ bundler (~> 1.6)
52
+ rake
53
+ rspec (~> 3.0.0.beta)
54
+ tilt (~> 1.0)
55
+ tilt-yaml2json!
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "tilt", "~> 2.0"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,55 @@
1
+ PATH
2
+ remote: ../
3
+ specs:
4
+ tilt-yaml2json (0.0.3)
5
+ multi_json
6
+ tilt
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (4.1.0)
12
+ i18n (~> 0.6, >= 0.6.9)
13
+ json (~> 1.7, >= 1.7.7)
14
+ minitest (~> 5.1)
15
+ thread_safe (~> 0.1)
16
+ tzinfo (~> 1.1)
17
+ appraisal (1.0.0)
18
+ bundler
19
+ rake
20
+ thor (>= 0.14.0)
21
+ diff-lcs (1.2.5)
22
+ i18n (0.6.9)
23
+ json (1.8.1)
24
+ minitest (5.3.3)
25
+ multi_json (1.10.0)
26
+ rake (10.3.1)
27
+ rspec (3.0.0.beta2)
28
+ rspec-core (= 3.0.0.beta2)
29
+ rspec-expectations (= 3.0.0.beta2)
30
+ rspec-mocks (= 3.0.0.beta2)
31
+ rspec-core (3.0.0.beta2)
32
+ rspec-support (= 3.0.0.beta2)
33
+ rspec-expectations (3.0.0.beta2)
34
+ diff-lcs (>= 1.2.0, < 2.0)
35
+ rspec-support (= 3.0.0.beta2)
36
+ rspec-mocks (3.0.0.beta2)
37
+ rspec-support (= 3.0.0.beta2)
38
+ rspec-support (3.0.0.beta2)
39
+ thor (0.19.1)
40
+ thread_safe (0.3.3)
41
+ tilt (2.0.1)
42
+ tzinfo (1.1.0)
43
+ thread_safe (~> 0.1)
44
+
45
+ PLATFORMS
46
+ ruby
47
+
48
+ DEPENDENCIES
49
+ activesupport
50
+ appraisal
51
+ bundler (~> 1.6)
52
+ rake
53
+ rspec (~> 3.0.0.beta)
54
+ tilt (~> 2.0)
55
+ tilt-yaml2json!
@@ -1,23 +1,6 @@
1
- require 'tilt/template'
2
- require 'yaml'
3
- require 'json'
4
-
1
+ require 'tilt/yaml2json/template'
5
2
  require 'tilt/yaml2json/version'
6
3
 
7
4
  module Tilt
8
- class YAML2JSONTemplate < Template
9
- self.default_mime_type = 'application/json'
10
-
11
- def prepare
12
- # do nothing
13
- end
14
-
15
- def evaluate(*)
16
- @output ||= JSON.pretty_generate(YAML.load(data))
17
- end
18
-
19
- def allows_script?
20
- false
21
- end
22
- end
5
+ autoload :YAML2JSONTemplate, 'tilt/yaml2json_template'
23
6
  end
@@ -1,4 +1,4 @@
1
1
  require 'tilt'
2
- require 'tilt/yaml2json'
2
+ require 'tilt/yaml2json/template'
3
3
 
4
- Tilt.register Tilt::YAML2JSONTemplate, 'yml', 'yaml'
4
+ Tilt.register Tilt::YAML2JSON::Template, 'yml', 'yaml'
@@ -0,0 +1,23 @@
1
+ require 'tilt/template'
2
+ require 'yaml'
3
+ require 'multi_json'
4
+
5
+ module Tilt
6
+ module YAML2JSON
7
+ class Template < Tilt::Template
8
+ self.default_mime_type = 'application/json'
9
+
10
+ def prepare
11
+ # do nothing
12
+ end
13
+
14
+ def evaluate(*)
15
+ @output ||= MultiJson.dump(YAML.load(data), pretty: true)
16
+ end
17
+
18
+ def allows_script?
19
+ false
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,5 +1,5 @@
1
1
  module Tilt
2
2
  module YAML2JSON
3
- VERSION = '0.0.2'
3
+ VERSION = '0.1.0'
4
4
  end
5
5
  end
@@ -0,0 +1,7 @@
1
+ warn '[DEPRECATION] `Tilt::YAML2JSONTemplate` is deprecated. Please use `Tilt::YAML2JSON::Template` instead.'
2
+
3
+ require 'tilt/yaml2json/template'
4
+
5
+ module Tilt
6
+ YAML2JSONTemplate = YAML2JSON::Template
7
+ end
@@ -0,0 +1,19 @@
1
+ require 'tilt/yaml2json'
2
+ require 'active_support/core_ext/string/strip'
3
+
4
+ describe Tilt::YAML2JSON::Template do
5
+ subject { described_class.new { template }.render }
6
+
7
+ let(:template) { <<-YAML.strip_heredoc }
8
+ foo:
9
+ bar: 42
10
+ YAML
11
+
12
+ it { should == <<-JSON.strip_heredoc.chomp }
13
+ {
14
+ "foo": {
15
+ "bar": 42
16
+ }
17
+ }
18
+ JSON
19
+ end
@@ -18,8 +18,12 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_runtime_dependency 'tilt', '~> 1.4'
21
+ spec.add_runtime_dependency 'multi_json'
22
+ spec.add_runtime_dependency 'tilt'
22
23
 
24
+ spec.add_development_dependency 'activesupport'
25
+ spec.add_development_dependency 'appraisal'
23
26
  spec.add_development_dependency 'bundler', '~> 1.6'
24
27
  spec.add_development_dependency 'rake'
28
+ spec.add_development_dependency 'rspec', '~> 3.0.0.beta'
25
29
  end
metadata CHANGED
@@ -1,29 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tilt-yaml2json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keita Urashima
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-13 00:00:00.000000000 Z
11
+ date: 2014-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: multi_json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: tilt
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
- - - "~>"
31
+ - - ">="
18
32
  - !ruby/object:Gem::Version
19
- version: '1.4'
33
+ version: '0'
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
- - - "~>"
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: activesupport
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: appraisal
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
25
67
  - !ruby/object:Gem::Version
26
- version: '1.4'
68
+ version: '0'
27
69
  - !ruby/object:Gem::Dependency
28
70
  name: bundler
29
71
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +94,20 @@ dependencies:
52
94
  - - ">="
53
95
  - !ruby/object:Gem::Version
54
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 3.0.0.beta
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 3.0.0.beta
55
111
  description:
56
112
  email:
57
113
  - ursm@ursm.jp
@@ -60,14 +116,23 @@ extensions: []
60
116
  extra_rdoc_files: []
61
117
  files:
62
118
  - ".gitignore"
119
+ - ".travis.yml"
120
+ - Appraisals
63
121
  - Gemfile
64
122
  - LICENSE.txt
65
123
  - README.md
66
124
  - Rakefile
125
+ - gemfiles/tilt_1.gemfile
126
+ - gemfiles/tilt_1.gemfile.lock
127
+ - gemfiles/tilt_2.gemfile
128
+ - gemfiles/tilt_2.gemfile.lock
67
129
  - lib/tilt-yaml2json.rb
68
130
  - lib/tilt/yaml2json.rb
69
131
  - lib/tilt/yaml2json/register.rb
132
+ - lib/tilt/yaml2json/template.rb
70
133
  - lib/tilt/yaml2json/version.rb
134
+ - lib/tilt/yaml2json_template.rb
135
+ - spec/template_spec.rb
71
136
  - tilt-yaml2json.gemspec
72
137
  homepage: https://github.com/ursm/tilt-yaml2json
73
138
  licenses:
@@ -93,4 +158,5 @@ rubygems_version: 2.2.2
93
158
  signing_key:
94
159
  specification_version: 4
95
160
  summary: Tilt template that compiles YAML to JSON
96
- test_files: []
161
+ test_files:
162
+ - spec/template_spec.rb