emberprecompile 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +44 -0
- data/Rakefile +1 -0
- data/bin/emberprecompile +16 -0
- data/emberprecompile.gemspec +25 -0
- data/lib/emberprecompile.rb +7 -0
- data/lib/emberprecompile/compiler.rb +30 -0
- data/lib/emberprecompile/version.rb +3 -0
- data/lib/emberprecompile/watcher.rb +26 -0
- metadata +97 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 TODO: Write your name
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Ember Pre-Compile
|
2
|
+
|
3
|
+
Compiling handlebars for Ember JS library. Supported versions of libraries are Handlbars JS RC 3 and Ember JS RC 1.
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
gem 'emberprecompile'
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install emberprecompile
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
After installing gem, to compile handlebars say:
|
23
|
+
|
24
|
+
$ emberprecompile
|
25
|
+
|
26
|
+
Or
|
27
|
+
|
28
|
+
$ emberprecompile compile
|
29
|
+
|
30
|
+
To keep monitoring changes in handlebar files say:
|
31
|
+
|
32
|
+
$ emberprecompile watch
|
33
|
+
|
34
|
+
## Note
|
35
|
+
|
36
|
+
It expects "views" and "compiled" folders are existing in current location. Currently all handlebars are placed under "views" folder with ".handlebars" extension. Compiled handlebars are placed under "compiled" folder in "views.handlebars.js" file.
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
1. Fork it
|
41
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
42
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
43
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
44
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/emberprecompile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'emberprecompile'
|
4
|
+
|
5
|
+
if !ARGV[0].nil?
|
6
|
+
command = ARGV[0].upcase
|
7
|
+
else
|
8
|
+
command = "COMPILE"
|
9
|
+
end
|
10
|
+
|
11
|
+
case command
|
12
|
+
when "WATCH"
|
13
|
+
puts Emberprecompile::Watcher.watch
|
14
|
+
when "COMPILE"
|
15
|
+
puts Emberprecompile::Compiler.compile
|
16
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'emberprecompile/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "emberprecompile"
|
8
|
+
gem.version = Emberprecompile::VERSION
|
9
|
+
gem.authors = ["Venkatesh Kommineni"]
|
10
|
+
gem.email = ["vkommineni@hotmail.com"]
|
11
|
+
gem.description = %q{Handlebars pre compiler for Ember JS}
|
12
|
+
gem.summary = %q{Pre compiles handlebars for Ember JS}
|
13
|
+
gem.homepage = "https://github.com/venku/emberprecompile"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.files += Dir.glob("lib/**/*")
|
17
|
+
gem.executables = %w(emberprecompile)
|
18
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
|
+
gem.require_paths = ["lib"]
|
20
|
+
|
21
|
+
gem.add_dependency "barber"
|
22
|
+
gem.add_dependency "fssm"
|
23
|
+
|
24
|
+
gem.add_development_dependency "rake"
|
25
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'find'
|
2
|
+
require 'barber'
|
3
|
+
|
4
|
+
module Emberprecompile
|
5
|
+
class Compiler
|
6
|
+
def self.compile
|
7
|
+
fileName = "compiled/views.handlebars.js"
|
8
|
+
source = "views/"
|
9
|
+
output = File.new(fileName, "w")
|
10
|
+
|
11
|
+
Find.find(source) do |file|
|
12
|
+
if !FileTest.directory?(file)
|
13
|
+
print "Compiling "+file
|
14
|
+
templateName = file.chomp(".handlebars")
|
15
|
+
templateName.slice!(source)
|
16
|
+
result = Barber::Ember::FilePrecompiler.call(File.read(file))
|
17
|
+
output.write('/* '+ templateName + ' Handlebar */')
|
18
|
+
output.puts @string
|
19
|
+
output.write('Ember.TEMPLATES["' + templateName + '"] = ' + result + '')
|
20
|
+
output.puts @string
|
21
|
+
print "\n"
|
22
|
+
else
|
23
|
+
next
|
24
|
+
end
|
25
|
+
end
|
26
|
+
print "\n"
|
27
|
+
print "Pre-Compiled handlebars are ready for use....\n-------------------------------------------------------\n"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'fssm'
|
3
|
+
|
4
|
+
module Emberprecompile
|
5
|
+
class Watcher
|
6
|
+
def self.watch
|
7
|
+
source = "views/"
|
8
|
+
FSSM.monitor(source) do
|
9
|
+
update do |b, r|
|
10
|
+
print "Change detected in >>>> " + r + "\n\n"
|
11
|
+
Emberprecompile::Compiler.compile
|
12
|
+
end
|
13
|
+
|
14
|
+
create do |b, r|
|
15
|
+
print "Created >>>> " + r + "\n\n"
|
16
|
+
Emberprecompile::Compiler.compile
|
17
|
+
end
|
18
|
+
|
19
|
+
delete do |b, r|
|
20
|
+
print "Deleted >>>> " + r + "\n\n"
|
21
|
+
Emberprecompile::Compiler.compile
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: emberprecompile
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Venkatesh Kommineni
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2013-02-20 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: barber
|
17
|
+
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
type: :runtime
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: fssm
|
28
|
+
prerelease: false
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: "0"
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rake
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id003
|
48
|
+
description: Handlebars pre compiler for Ember JS
|
49
|
+
email:
|
50
|
+
- vkommineni@hotmail.com
|
51
|
+
executables:
|
52
|
+
- emberprecompile
|
53
|
+
extensions: []
|
54
|
+
|
55
|
+
extra_rdoc_files: []
|
56
|
+
|
57
|
+
files:
|
58
|
+
- .gitignore
|
59
|
+
- Gemfile
|
60
|
+
- LICENSE.txt
|
61
|
+
- README.md
|
62
|
+
- Rakefile
|
63
|
+
- bin/emberprecompile
|
64
|
+
- emberprecompile.gemspec
|
65
|
+
- lib/emberprecompile.rb
|
66
|
+
- lib/emberprecompile/compiler.rb
|
67
|
+
- lib/emberprecompile/version.rb
|
68
|
+
- lib/emberprecompile/watcher.rb
|
69
|
+
homepage: https://github.com/venku/emberprecompile
|
70
|
+
licenses: []
|
71
|
+
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
|
75
|
+
require_paths:
|
76
|
+
- lib
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: "0"
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: "0"
|
89
|
+
requirements: []
|
90
|
+
|
91
|
+
rubyforge_project:
|
92
|
+
rubygems_version: 1.8.25
|
93
|
+
signing_key:
|
94
|
+
specification_version: 3
|
95
|
+
summary: Pre compiles handlebars for Ember JS
|
96
|
+
test_files: []
|
97
|
+
|