Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoseong Hwang committed Dec 19, 2011
0 parents commit e8710f3
Show file tree
Hide file tree
Showing 15 changed files with 7,213 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.DS_Store
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source "http://rubygems.org"

# Specify your gem's dependencies in dust-rails.gemspec
gemspec
97 changes: 97 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
PATH
remote: .
specs:
dust-rails (0.0.1)
execjs
rails (~> 3.1.0)
tilt

GEM
remote: http://rubygems.org/
specs:
actionmailer (3.1.3)
actionpack (= 3.1.3)
mail (~> 2.3.0)
actionpack (3.1.3)
activemodel (= 3.1.3)
activesupport (= 3.1.3)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
rack (~> 1.3.5)
rack-cache (~> 1.1)
rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
sprockets (~> 2.0.3)
activemodel (3.1.3)
activesupport (= 3.1.3)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.3)
activemodel (= 3.1.3)
activesupport (= 3.1.3)
arel (~> 2.2.1)
tzinfo (~> 0.3.29)
activeresource (3.1.3)
activemodel (= 3.1.3)
activesupport (= 3.1.3)
activesupport (3.1.3)
multi_json (~> 1.0)
arel (2.2.1)
builder (3.0.0)
erubis (2.7.0)
execjs (1.2.12)
multi_json (~> 1.0)
hike (1.2.1)
i18n (0.6.0)
json (1.6.3)
mail (2.3.0)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.17.2)
multi_json (1.0.4)
polyglot (0.3.3)
rack (1.3.5)
rack-cache (1.1)
rack (>= 0.4)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.1.3)
actionmailer (= 3.1.3)
actionpack (= 3.1.3)
activerecord (= 3.1.3)
activeresource (= 3.1.3)
activesupport (= 3.1.3)
bundler (~> 1.0)
railties (= 3.1.3)
railties (3.1.3)
actionpack (= 3.1.3)
activesupport (= 3.1.3)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
sprockets (2.0.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (!= 1.3.0, ~> 1.1)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.31)

PLATFORMS
ruby

DEPENDENCIES
dust-rails!
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require 'bundler/gem_tasks'
24 changes: 24 additions & 0 deletions dust-rails.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "dust-rails/version"

Gem::Specification.new do |s|
s.name = "dust-rails"
s.version = Dust::Rails::VERSION
s.authors = ["Hoseong Hwang"]
s.email = ["thefron@wafflestudio.com"]
s.homepage = "https://github.com/thefron/dust-rails"
s.summary = %q{Use dust.js with rails}
s.description = %q{This gem makes you dust.js easy to use with rails.}

s.rubyforge_project = "dust-rails"

s.add_dependency('rails', '~> 3.1.0')
s.add_dependency('tilt')
s.add_dependency('execjs')

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
end
9 changes: 9 additions & 0 deletions lib/dust-rails.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require "dust-rails/version"
require "dust-rails/rails/engine.rb"
require "dust-rails/rails/dust_template.rb"

module Dust
module Rails
# Your code goes here...
end
end
39 changes: 39 additions & 0 deletions lib/dust-rails/rails/dust_template.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
require 'tilt'

module Dust
module Rails

module Source
def self.path
@path ||= File.expand_path('../../../../vendor/assets/javascripts/dust-full-for-compile.js', __FILE__)
end

def self.contents
@contents ||= File.read(path)
end

def self.context
@context ||= ExecJS.compile(contents)
end

end

class DustTemplate < ::Tilt::Template

def self.default_mime_type
'application/javascript'
end

def prepare
end

def evaluate(scope, locals, &block)
<<-TMPL
#{Source.context.call("dust.compile", data, basename('.js.dust'))}
TMPL
end
end
end
end


11 changes: 11 additions & 0 deletions lib/dust-rails/rails/engine.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'rails/engine'

module Dust
module Rails
class Engine < ::Rails::Engine
initializer :register_dustjs do |app|
app.assets.register_engine '.dust', DustTemplate
end
end
end
end
5 changes: 5 additions & 0 deletions lib/dust-rails/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Dust
module Rails
VERSION = "0.1.0"
end
end
Binary file added pkg/dust-rails-0.1.0.gem
Binary file not shown.
Loading

0 comments on commit e8710f3

Please sign in to comment.