dassets-erb 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.log
3
+ *.rbc
4
+ .rbx/
5
+ .bundle
6
+ .config
7
+ .yardoc
8
+ Gemfile.lock
9
+ InstalledFiles
10
+ _yardoc
11
+ coverage
12
+ doc/
13
+ lib/bundler/man
14
+ pkg
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem 'rake'
6
+ gem 'pry'
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013-Present Kelly Redding and Collin Redding
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,45 @@
1
+ # Dassets::Erb
2
+
3
+ Dassets [engine](https://github.com/redding/dassets#compiling) for compiling dynamic asserts written in Erb.
4
+
5
+ ## Usage
6
+
7
+ Register the engine:
8
+
9
+ ```ruby
10
+ # in config/assets.rb
11
+ require 'dassets'
12
+ require 'dassets-erb'
13
+
14
+ Dassets.configure do |c|
15
+
16
+ c.source "/path/to/assets") do |s|
17
+ s.engine 'erb', Dassets::Erb::Engine
18
+ end
19
+
20
+ end
21
+ ```
22
+
23
+ Add `.erb` to any source files in your source path. Dassets will compile their content using Erb, remove the `.erb` extension, and write the output to the output path.
24
+
25
+ ## Installation
26
+
27
+ Add this line to your application's Gemfile:
28
+
29
+ gem 'dassets-erb'
30
+
31
+ And then execute:
32
+
33
+ $ bundle
34
+
35
+ Or install it yourself as:
36
+
37
+ $ gem install dassets-erb
38
+
39
+ ## Contributing
40
+
41
+ 1. Fork it
42
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
43
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
44
+ 4. Push to the branch (`git push origin my-new-feature`)
45
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "dassets-erb/version"
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "dassets-erb"
8
+ gem.version = Dassets::Erb::VERSION
9
+ gem.authors = ["Kelly Redding", "Collin Redding"]
10
+ gem.email = ["kelly@kellyredding.com", "collin.redding@me.com"]
11
+ gem.description = %q{Dassets engine for compiling Erb}
12
+ gem.summary = %q{Dassets engine for compiling Erb}
13
+ gem.homepage = "http://github.com/redding/dassets-erb"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_development_dependency("assert")
21
+
22
+ gem.add_dependency("dassets")
23
+
24
+ end
@@ -0,0 +1,19 @@
1
+ require 'erb'
2
+ require 'dassets/engine'
3
+ require "dassets-erb/version"
4
+
5
+ module Dassets::Erb
6
+
7
+ class Engine < Dassets::Engine
8
+
9
+ def ext(input_ext)
10
+ ''
11
+ end
12
+
13
+ def compile(input_content)
14
+ ::ERB.new(input_content).result(binding)
15
+ end
16
+
17
+ end
18
+
19
+ end
@@ -0,0 +1,4 @@
1
+ module Dassets; end
2
+ module Dassets::Erb
3
+ VERSION = "0.1.0"
4
+ end
File without changes
@@ -0,0 +1,15 @@
1
+ # this file is automatically required when you run `assert`
2
+ # put any test helpers here
3
+
4
+ # add the root dir to the load path
5
+ $LOAD_PATH.unshift(File.expand_path("../..", __FILE__))
6
+
7
+ # require pry for debugging (`binding.pry`)
8
+ require 'pry'
9
+
10
+ ENV['DASSETS_TEST_MODE'] = 'yes'
11
+
12
+ require 'test/support/factory'
13
+ class Assert::Context
14
+ setup{ @factory = Dassets::Erb::Factory }
15
+ end
@@ -0,0 +1,20 @@
1
+ module Dassets::Erb
2
+
3
+ module Factory
4
+ module_function
5
+
6
+ def name
7
+ "Joe"
8
+ end
9
+
10
+ def erb
11
+ "hello, <%= Dassets::Erb::Factory.name %>!"
12
+ end
13
+
14
+ def erb_compiled
15
+ "hello, Joe!"
16
+ end
17
+
18
+ end
19
+
20
+ end
@@ -0,0 +1,32 @@
1
+ require 'assert'
2
+ require 'dassets/engine'
3
+ require 'dassets-erb'
4
+
5
+ class Dassets::Erb::Engine
6
+
7
+ class BaseTests < Assert::Context
8
+ desc "the Dassets::Erb engine"
9
+ setup do
10
+ @engine = Dassets::Erb::Engine.new
11
+ end
12
+ subject{ @engine }
13
+
14
+ should "be a Dassets engine" do
15
+ assert_kind_of Dassets::Engine, subject
16
+ assert_respond_to 'ext', subject
17
+ assert_respond_to 'compile', subject
18
+ end
19
+
20
+ should "remove any input extension to `css`" do
21
+ assert_equal '', subject.ext('erb')
22
+ assert_equal '', subject.ext('erubis')
23
+ assert_equal '', subject.ext('whatever')
24
+ end
25
+
26
+ should "compile any input content as Erb" do
27
+ assert_equal @factory.erb_compiled, subject.compile(@factory.erb)
28
+ end
29
+
30
+ end
31
+
32
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dassets-erb
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Kelly Redding
14
+ - Collin Redding
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2013-06-17 00:00:00 Z
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: assert
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :development
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: dassets
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ description: Dassets engine for compiling Erb
50
+ email:
51
+ - kelly@kellyredding.com
52
+ - collin.redding@me.com
53
+ executables: []
54
+
55
+ extensions: []
56
+
57
+ extra_rdoc_files: []
58
+
59
+ files:
60
+ - .gitignore
61
+ - Gemfile
62
+ - LICENSE.txt
63
+ - README.md
64
+ - Rakefile
65
+ - dassets-erb.gemspec
66
+ - lib/dassets-erb.rb
67
+ - lib/dassets-erb/version.rb
68
+ - log/.gitkeep
69
+ - test/helper.rb
70
+ - test/support/factory.rb
71
+ - test/unit/engine_tests.rb
72
+ - tmp/.gitkeep
73
+ homepage: http://github.com/redding/dassets-erb
74
+ licenses: []
75
+
76
+ post_install_message:
77
+ rdoc_options: []
78
+
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ hash: 3
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ hash: 3
96
+ segments:
97
+ - 0
98
+ version: "0"
99
+ requirements: []
100
+
101
+ rubyforge_project:
102
+ rubygems_version: 1.8.24
103
+ signing_key:
104
+ specification_version: 3
105
+ summary: Dassets engine for compiling Erb
106
+ test_files:
107
+ - test/helper.rb
108
+ - test/support/factory.rb
109
+ - test/unit/engine_tests.rb