grease 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/LICENSE.txt +1 -1
- data/README.md +40 -10
- data/lib/grease.rb +4 -1
- data/lib/grease/adapter.rb +16 -0
- data/lib/grease/version.rb +1 -1
- metadata +142 -22
- data/.gitignore +0 -9
- data/.rspec +0 -2
- data/.travis.yml +0 -5
- data/Gemfile +0 -4
- data/Rakefile +0 -6
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/grease.gemspec +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5000d3409d975534bb9a5059a10677d5eebbed62
|
4
|
+
data.tar.gz: a7d3b5aa83014053da49b3d15ebcf23a6579624b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1904768cdf4c934772a7bf4b8336d7708eb576dcd7e9b37c4cea37d575df87c868d8d3340942da492cfd49ba480b579e7b9694c4bdb3a91be4c9cadd3307539
|
7
|
+
data.tar.gz: a197e854e7a9bc6805c9fd16aa2bb9cd5338c88623b4ae94d803ec72dac403e4f1d3215944ab8f88495ce14b1a6aa33d49a67093716a84e0cf33ed30b645a032
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
# CHANGELOG
|
2
|
+
## [0.2.0](https://github.com/yasaichi/grease/releases/tag/v0.2.0) (September 18, 2016)
|
3
|
+
* Implement core class and function
|
4
|
+
|
5
|
+
## [0.1.0](https://github.com/yasaichi/grease/releases/tag/v0.1.0) (September 9, 2016)
|
6
|
+
* The initial release to reserve the gem name
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,39 +1,69 @@
|
|
1
1
|
# Grease
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/grease.svg)](http://badge.fury.io/rb/grease)
|
4
|
+
[![Build Status](https://travis-ci.org/yasaichi/grease.svg?branch=master)](https://travis-ci.org/yasaichi/grease)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/yasaichi/grease/badges/gpa.svg)](https://codeclimate.com/github/yasaichi/grease)
|
6
|
+
[![Test Coverage](https://codeclimate.com/github/yasaichi/grease/badges/coverage.svg)](https://codeclimate.com/github/yasaichi/grease/coverage)
|
4
7
|
|
5
|
-
|
8
|
+
Grease provides an adapter to use Tilt as extension of Sprockets 3 or later.
|
6
9
|
|
7
10
|
## Installation
|
8
11
|
|
9
12
|
Add this line to your application's Gemfile:
|
10
13
|
|
11
14
|
```ruby
|
12
|
-
gem
|
15
|
+
gem "grease"
|
13
16
|
```
|
14
17
|
|
15
18
|
And then execute:
|
16
19
|
|
17
|
-
|
20
|
+
```shell
|
21
|
+
$ bundle
|
22
|
+
```
|
18
23
|
|
19
24
|
Or install it yourself as:
|
20
25
|
|
21
|
-
|
26
|
+
```shell
|
27
|
+
$ gem install grease
|
28
|
+
```
|
22
29
|
|
23
30
|
## Usage
|
24
31
|
|
25
|
-
|
32
|
+
If you'd like to use `Tilt::HamlTemplate` in Sprockets, add code like this:
|
26
33
|
|
27
|
-
|
34
|
+
```ruby
|
35
|
+
# Sprockets 3
|
36
|
+
register_engine ".haml", Grease.apply(Tilt::HamlTemplate), mime_type: "text/html", silence_deprecation: true
|
28
37
|
|
29
|
-
|
38
|
+
# Sprockets 4+
|
39
|
+
register_mime_type "text/haml", extensions: %w(.haml)
|
40
|
+
register_transformer "text/haml", "text/html", Grease.apply(Tilt::HamlTemplate)
|
41
|
+
```
|
30
42
|
|
31
|
-
|
43
|
+
It works because `Grease.apply` returns a "callable" object.
|
32
44
|
|
33
45
|
## Contributing
|
34
46
|
|
35
|
-
|
47
|
+
You should follow the steps below.
|
48
|
+
|
49
|
+
1. [Fork the repository](https://help.github.com/articles/fork-a-repo/)
|
50
|
+
2. Create a feature branch: `git checkout -b add-new-feature`
|
51
|
+
3. Commit your changes: `git commit -am 'add new feature'`
|
52
|
+
4. Push the branch: `git push origin add-new-feature`
|
53
|
+
4. [Send us a pull request](https://help.github.com/articles/using-pull-requests/)
|
36
54
|
|
55
|
+
We use [Appraisal](https://github.com/thoughtbot/appraisal) to test with different versions of Sprockets.
|
56
|
+
|
57
|
+
```shell
|
58
|
+
bundle install
|
59
|
+
appraisal install
|
60
|
+
|
61
|
+
# Run rspec with a specific version of Sprockets
|
62
|
+
appraisal sprockets4 rspec
|
63
|
+
|
64
|
+
# Run rspec with all versions of Sprockets
|
65
|
+
appraisal rspec
|
66
|
+
```
|
37
67
|
|
38
68
|
## License
|
39
69
|
|
data/lib/grease.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
module Grease
|
2
|
+
class Adapter
|
3
|
+
def initialize(template_class)
|
4
|
+
@template_class = template_class
|
5
|
+
end
|
6
|
+
|
7
|
+
def call(input)
|
8
|
+
context = input[:environment].context_class.new(input)
|
9
|
+
template = @template_class.new { input[:data] }
|
10
|
+
|
11
|
+
# TODO: Hack for converting ActiveSupport::SafeBuffer into String
|
12
|
+
output = "#{template.render(context, {})}"
|
13
|
+
context.metadata.merge(data: output)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/grease/version.rb
CHANGED
metadata
CHANGED
@@ -1,45 +1,115 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grease
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yasaichi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: appraisal
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.0
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.0.0
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
|
-
- - "
|
31
|
+
- - ">="
|
18
32
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
33
|
+
version: '0'
|
20
34
|
type: :development
|
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: codeclimate-test-reporter
|
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: haml
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
25
60
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
27
69
|
- !ruby/object:Gem::Dependency
|
28
70
|
name: rake
|
29
71
|
requirement: !ruby/object:Gem::Requirement
|
30
72
|
requirements:
|
31
|
-
- - "
|
73
|
+
- - ">="
|
32
74
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
75
|
+
version: '0'
|
34
76
|
type: :development
|
35
77
|
prerelease: false
|
36
78
|
version_requirements: !ruby/object:Gem::Requirement
|
37
79
|
requirements:
|
38
|
-
- - "
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
39
88
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
89
|
+
version: '4.2'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '4.2'
|
41
97
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec-rails
|
43
113
|
requirement: !ruby/object:Gem::Requirement
|
44
114
|
requirements:
|
45
115
|
- - "~>"
|
@@ -52,25 +122,75 @@ dependencies:
|
|
52
122
|
- - "~>"
|
53
123
|
- !ruby/object:Gem::Version
|
54
124
|
version: '3.0'
|
55
|
-
|
56
|
-
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: sprockets
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '3.0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '3.0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: sqlite3
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: tilt
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '2.0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '2.0'
|
181
|
+
description: Grease provides an adapter to use Tilt as extension of Sprockets 3 or
|
182
|
+
later.
|
57
183
|
email:
|
58
184
|
- yasaichi@users.noreply.github.com
|
59
185
|
executables: []
|
60
186
|
extensions: []
|
61
187
|
extra_rdoc_files: []
|
62
188
|
files:
|
63
|
-
-
|
64
|
-
- ".rspec"
|
65
|
-
- ".travis.yml"
|
66
|
-
- Gemfile
|
189
|
+
- CHANGELOG.md
|
67
190
|
- LICENSE.txt
|
68
191
|
- README.md
|
69
|
-
- Rakefile
|
70
|
-
- bin/console
|
71
|
-
- bin/setup
|
72
|
-
- grease.gemspec
|
73
192
|
- lib/grease.rb
|
193
|
+
- lib/grease/adapter.rb
|
74
194
|
- lib/grease/version.rb
|
75
195
|
homepage: https://github.com/yasaichi/grease
|
76
196
|
licenses:
|
@@ -95,5 +215,5 @@ rubyforge_project:
|
|
95
215
|
rubygems_version: 2.5.1
|
96
216
|
signing_key:
|
97
217
|
specification_version: 4
|
98
|
-
summary: Tilt adapter for Sprockets
|
218
|
+
summary: Tilt adapter for Sprockets 3 or later
|
99
219
|
test_files: []
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "grease"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
data/bin/setup
DELETED
data/grease.gemspec
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'grease/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "grease"
|
8
|
-
spec.version = Grease::VERSION
|
9
|
-
spec.authors = ["yasaichi"]
|
10
|
-
spec.email = ["yasaichi@users.noreply.github.com"]
|
11
|
-
|
12
|
-
spec.summary = "Tilt adapter for Sprockets 4 or later"
|
13
|
-
spec.description = "Grease provides an adapter to use Tilt as Transformer of Sprockets 4 or later."
|
14
|
-
spec.homepage = "https://github.com/yasaichi/grease"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
spec.bindir = "exe"
|
19
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
-
spec.require_paths = ["lib"]
|
21
|
-
|
22
|
-
spec.add_development_dependency "bundler", "~> 1.12"
|
23
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
25
|
-
end
|