sprockets-emblem 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3bd51458cbc95e24e2f23bfcc68b18690e1335a8
4
+ data.tar.gz: 52d6ccfc048ae394d2db9e29c1b22b1e7796cf9d
5
+ SHA512:
6
+ metadata.gz: 99f01424fe6e103015d10cb74c6aab900770940403d52279256d31f487fe2d165353a0633005e419b0d10ea5d1cb00b9944bfc84450f813394f2ad4ccfcbc6ed
7
+ data.tar.gz: 4b487f1f64d6df589c3ee361869f57b288d9d01f437d3ea937682e4f85aa0d448552d95d0a9f14e082c5ca034ba6a0c9d8e1f7461e1bef492bedfb4284b73baa
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'emblem-source', '~>0.3.16'
4
+ gem 'handlebars_assets', '~>0.16'
5
+
6
+ group :development do
7
+ gem "rspec", "~> 2.14.0"
8
+ gem "rdoc", "~> 3.12"
9
+ gem "bundler", "~> 1.0"
10
+ gem "jeweler", "~> 2.0.1"
11
+ end
@@ -0,0 +1,82 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ addressable (2.3.6)
5
+ builder (3.2.2)
6
+ descendants_tracker (0.0.4)
7
+ thread_safe (~> 0.3, >= 0.3.1)
8
+ diff-lcs (1.2.5)
9
+ emblem-source (0.3.16)
10
+ execjs (2.2.0)
11
+ faraday (0.9.0)
12
+ multipart-post (>= 1.2, < 3)
13
+ git (1.2.6)
14
+ github_api (0.11.3)
15
+ addressable (~> 2.3)
16
+ descendants_tracker (~> 0.0.1)
17
+ faraday (~> 0.8, < 0.10)
18
+ hashie (>= 1.2)
19
+ multi_json (>= 1.7.5, < 2.0)
20
+ nokogiri (~> 1.6.0)
21
+ oauth2
22
+ handlebars_assets (0.16)
23
+ execjs (>= 1.2.9)
24
+ multi_json
25
+ sprockets (>= 2.0.3)
26
+ tilt
27
+ hashie (2.1.2)
28
+ highline (1.6.21)
29
+ hike (1.2.3)
30
+ jeweler (2.0.1)
31
+ builder
32
+ bundler (>= 1.0)
33
+ git (>= 1.2.5)
34
+ github_api
35
+ highline (>= 1.6.15)
36
+ nokogiri (>= 1.5.10)
37
+ rake
38
+ rdoc
39
+ json (1.8.1)
40
+ jwt (1.0.0)
41
+ mini_portile (0.6.0)
42
+ multi_json (1.10.1)
43
+ multi_xml (0.5.5)
44
+ multipart-post (2.0.0)
45
+ nokogiri (1.6.2.1)
46
+ mini_portile (= 0.6.0)
47
+ oauth2 (0.9.4)
48
+ faraday (>= 0.8, < 0.10)
49
+ jwt (~> 1.0)
50
+ multi_json (~> 1.3)
51
+ multi_xml (~> 0.5)
52
+ rack (~> 1.2)
53
+ rack (1.5.2)
54
+ rake (10.3.2)
55
+ rdoc (3.12.2)
56
+ json (~> 1.4)
57
+ rspec (2.14.1)
58
+ rspec-core (~> 2.14.0)
59
+ rspec-expectations (~> 2.14.0)
60
+ rspec-mocks (~> 2.14.0)
61
+ rspec-core (2.14.8)
62
+ rspec-expectations (2.14.5)
63
+ diff-lcs (>= 1.1.3, < 2.0)
64
+ rspec-mocks (2.14.6)
65
+ sprockets (2.11.0)
66
+ hike (~> 1.2)
67
+ multi_json (~> 1.0)
68
+ rack (~> 1.0)
69
+ tilt (~> 1.1, != 1.3.0)
70
+ thread_safe (0.3.4)
71
+ tilt (1.4.1)
72
+
73
+ PLATFORMS
74
+ ruby
75
+
76
+ DEPENDENCIES
77
+ bundler (~> 1.0)
78
+ emblem-source (~> 0.3.16)
79
+ handlebars_assets (~> 0.16)
80
+ jeweler (~> 2.0.1)
81
+ rdoc (~> 3.12)
82
+ rspec (~> 2.14.0)
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2014 Roman Shterenzon
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,34 @@
1
+ # Sprockets::Emblem
2
+
3
+ This gem integrates [Emblem.js][1] with [Sprockets](https://github.com/sstephenson/sprockets).
4
+ The difference between this gem and the [emblem-rails]
5
+ [2] gem is that this gem doesn't depend on the ember-rails (and myriad of other gems), and only does the minimal work required. If you do need Ember support, you will be better off using [emblem-rails][2].
6
+
7
+
8
+ ## Installation
9
+
10
+ Add the gem to your Gemfile:
11
+
12
+ gem 'sprockets-emblem'
13
+
14
+ Add handlebars.runtime to your application.js:
15
+
16
+ //=require handlebars.runtime
17
+
18
+ Now you can use [Emblem.js][1] in your templates by using a .jst.emblem extension.
19
+ Because this gem depends on the [handlebars_assets](https://github.com/leshill/handlebars_assets) gem, you can also use .jst.hbs templates.
20
+
21
+ # Contributing
22
+
23
+ Pull requests are welcome! Please do not update the version number.
24
+
25
+ In a nutshell:
26
+
27
+ 1. Fork
28
+ 2. Create a topic branch - git checkout -b my_branch
29
+ 3. Push to your branch - git push origin my_branch
30
+ 4. Create a Pull Request from your branch
31
+ 5. That's it!
32
+
33
+ [1]: https://github.com/machty/emblem.js
34
+ [2]: https://github.com/alexspeller/emblem-rails
@@ -0,0 +1,44 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
17
+ gem.name = "sprockets-emblem"
18
+ gem.homepage = "http://github.com/romanbsd/emblem-sprockets"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Sprockets integration for Emblem.js}
21
+ gem.description = gem.summary
22
+ gem.email = "romanbsd@yahoo.com"
23
+ gem.authors = ["Roman Shterenzon"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ task :default => :spec
35
+
36
+ require 'rdoc/task'
37
+ Rake::RDocTask.new do |rdoc|
38
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
39
+
40
+ rdoc.rdoc_dir = 'rdoc'
41
+ rdoc.title = "emblem-sprockets #{version}"
42
+ rdoc.rdoc_files.include('README*')
43
+ rdoc.rdoc_files.include('lib/**/*.rb')
44
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,13 @@
1
+ require 'sprockets/emblem'
2
+
3
+ if defined?(Rails) and defined?(Rails::Railtie)
4
+ Class.new(Rails::Railtie) do
5
+ initializer 'sprockets.emblem', :after => 'sprockets.environment', :group => :all do |app|
6
+ next unless app.assets
7
+ app.assets.register_engine('.emblem', Sprockets::Emblem)
8
+ end
9
+ end
10
+ else
11
+ require 'sprockets'
12
+ Sprockets.register_engine '.emblem', Sprockets::Emblem
13
+ end
@@ -0,0 +1,43 @@
1
+ require 'tilt'
2
+ require 'emblem/source'
3
+ require 'handlebars_assets/handlebars'
4
+ require 'execjs'
5
+
6
+ module Sprockets
7
+ class Emblem < Tilt::Template
8
+ self.engine_initialized = true
9
+
10
+ def self.default_mime_type
11
+ 'application/javascript'
12
+ end
13
+
14
+ def context
15
+ @context ||= ExecJS.compile('var window={};' + hbs_source + emblem_source + ';var Emblem = window.Emblem;')
16
+ end
17
+
18
+ def evaluate(scope, locals, &block)
19
+ compiled_hbs = context.call('Emblem.precompile', hbs_variant, data)
20
+ "Handlebars.template(#{compiled_hbs});"
21
+ end
22
+
23
+ protected
24
+ def emblem_source
25
+ File.read ::Emblem::Source.bundled_path
26
+ end
27
+
28
+ def hbs_source
29
+ HandlebarsAssets::Handlebars.send :source
30
+ end
31
+
32
+ def hbs_variant
33
+ @hbs_variant ||= begin
34
+ 'Handlebars'.tap do |hbs|
35
+ hbs.define_singleton_method(:encode_json) { |encoder| hbs }
36
+ end
37
+ end
38
+ end
39
+
40
+ def prepare
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,13 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+
4
+ require 'rspec'
5
+ require 'sprockets-emblem'
6
+
7
+ # Requires supporting files with custom matchers and macros, etc,
8
+ # in ./support/ and its subdirectories.
9
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
10
+
11
+ RSpec.configure do |config|
12
+
13
+ end
@@ -0,0 +1,4 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe Sprockets::Emblem do
4
+ end
@@ -0,0 +1,67 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: sprockets-emblem 0.1.0 ruby lib
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "sprockets-emblem"
9
+ s.version = "0.1.0"
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
13
+ s.authors = ["Roman Shterenzon"]
14
+ s.date = "2014-06-24"
15
+ s.description = "Sprockets integration for Emblem.js"
16
+ s.email = "romanbsd@yahoo.com"
17
+ s.extra_rdoc_files = [
18
+ "LICENSE.txt",
19
+ "README.md"
20
+ ]
21
+ s.files = [
22
+ ".rspec",
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "LICENSE.txt",
26
+ "README.md",
27
+ "Rakefile",
28
+ "VERSION",
29
+ "lib/sprockets-emblem.rb",
30
+ "lib/sprockets/emblem.rb",
31
+ "spec/spec_helper.rb",
32
+ "spec/sprockets-emblem_spec.rb",
33
+ "sprockets-emblem.gemspec"
34
+ ]
35
+ s.homepage = "http://github.com/romanbsd/emblem-sprockets"
36
+ s.licenses = ["MIT"]
37
+ s.rubygems_version = "2.2.2"
38
+ s.summary = "Sprockets integration for Emblem.js"
39
+
40
+ if s.respond_to? :specification_version then
41
+ s.specification_version = 4
42
+
43
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
+ s.add_runtime_dependency(%q<emblem-source>, ["~> 0.3.16"])
45
+ s.add_runtime_dependency(%q<handlebars_assets>, ["~> 0.16"])
46
+ s.add_development_dependency(%q<rspec>, ["~> 2.14.0"])
47
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
48
+ s.add_development_dependency(%q<bundler>, ["~> 1.0"])
49
+ s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
50
+ else
51
+ s.add_dependency(%q<emblem-source>, ["~> 0.3.16"])
52
+ s.add_dependency(%q<handlebars_assets>, ["~> 0.16"])
53
+ s.add_dependency(%q<rspec>, ["~> 2.14.0"])
54
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
55
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
56
+ s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
57
+ end
58
+ else
59
+ s.add_dependency(%q<emblem-source>, ["~> 0.3.16"])
60
+ s.add_dependency(%q<handlebars_assets>, ["~> 0.16"])
61
+ s.add_dependency(%q<rspec>, ["~> 2.14.0"])
62
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
63
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
64
+ s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
65
+ end
66
+ end
67
+
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sprockets-emblem
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Roman Shterenzon
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: emblem-source
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.3.16
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.3.16
27
+ - !ruby/object:Gem::Dependency
28
+ name: handlebars_assets
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.16'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.16'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 2.14.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 2.14.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rdoc
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.12'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.12'
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: jeweler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 2.0.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 2.0.1
97
+ description: Sprockets integration for Emblem.js
98
+ email: romanbsd@yahoo.com
99
+ executables: []
100
+ extensions: []
101
+ extra_rdoc_files:
102
+ - LICENSE.txt
103
+ - README.md
104
+ files:
105
+ - ".rspec"
106
+ - Gemfile
107
+ - Gemfile.lock
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - VERSION
112
+ - lib/sprockets-emblem.rb
113
+ - lib/sprockets/emblem.rb
114
+ - spec/spec_helper.rb
115
+ - spec/sprockets-emblem_spec.rb
116
+ - sprockets-emblem.gemspec
117
+ homepage: http://github.com/romanbsd/emblem-sprockets
118
+ licenses:
119
+ - MIT
120
+ metadata: {}
121
+ post_install_message:
122
+ rdoc_options: []
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubyforge_project:
137
+ rubygems_version: 2.2.2
138
+ signing_key:
139
+ specification_version: 4
140
+ summary: Sprockets integration for Emblem.js
141
+ test_files: []