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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f7c9928f436cbe694d8fb26199358469d7acf17
4
- data.tar.gz: bf3116b3ef4997952ac4a7992dd3a35186f3c1bb
3
+ metadata.gz: 5000d3409d975534bb9a5059a10677d5eebbed62
4
+ data.tar.gz: a7d3b5aa83014053da49b3d15ebcf23a6579624b
5
5
  SHA512:
6
- metadata.gz: fef972384a6ab7441f64237eea1c00b9bab30647490538c8e375b6124c934d78db3c4f58461d0914eecce3b18775ca8e126edc0a6df97512a213eff334a2f1d2
7
- data.tar.gz: f4ef65083f1039e4b54355369558a7be8a47267a2197e516a71190f9fa4805857cae79e528ea22e41f80dc9954641b66d2d2aea8814758ee519443ad9c52d614
6
+ metadata.gz: f1904768cdf4c934772a7bf4b8336d7708eb576dcd7e9b37c4cea37d575df87c868d8d3340942da492cfd49ba480b579e7b9694c4bdb3a91be4c9cadd3307539
7
+ data.tar.gz: a197e854e7a9bc6805c9fd16aa2bb9cd5338c88623b4ae94d803ec72dac403e4f1d3215944ab8f88495ce14b1a6aa33d49a67093716a84e0cf33ed30b645a032
@@ -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
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016 yasaichi
3
+ Copyright (c) 2016 Yuichi Goto
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,39 +1,69 @@
1
1
  # Grease
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/grease`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- TODO: Delete this and the text above, and describe your gem
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 'grease'
15
+ gem "grease"
13
16
  ```
14
17
 
15
18
  And then execute:
16
19
 
17
- $ bundle
20
+ ```shell
21
+ $ bundle
22
+ ```
18
23
 
19
24
  Or install it yourself as:
20
25
 
21
- $ gem install grease
26
+ ```shell
27
+ $ gem install grease
28
+ ```
22
29
 
23
30
  ## Usage
24
31
 
25
- TODO: Write usage instructions here
32
+ If you'd like to use `Tilt::HamlTemplate` in Sprockets, add code like this:
26
33
 
27
- ## Development
34
+ ```ruby
35
+ # Sprockets 3
36
+ register_engine ".haml", Grease.apply(Tilt::HamlTemplate), mime_type: "text/html", silence_deprecation: true
28
37
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
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
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
43
+ It works because `Grease.apply` returns a "callable" object.
32
44
 
33
45
  ## Contributing
34
46
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/grease.
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
 
@@ -1,5 +1,8 @@
1
+ require "grease/adapter"
1
2
  require "grease/version"
2
3
 
3
4
  module Grease
4
- # Your code goes here...
5
+ def self.apply(engine)
6
+ Grease::Adapter.new(engine)
7
+ end
5
8
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Grease
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0".freeze
3
3
  end
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.1.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-09 00:00:00.000000000 Z
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: '1.12'
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: '1.12'
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: '10.0'
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: '10.0'
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: rspec
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
- description: Grease provides an adapter to use Tilt as Transformer of Sprockets 4
56
- or later.
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
- - ".gitignore"
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 4 or later
218
+ summary: Tilt adapter for Sprockets 3 or later
99
219
  test_files: []
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.3.1
5
- before_install: gem install bundler -v 1.12.5
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in grease.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
@@ -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
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -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