Skip to content
This repository has been archived by the owner on Nov 11, 2017. It is now read-only.

Commit

Permalink
initial code
Browse files Browse the repository at this point in the history
  • Loading branch information
tchak committed Jun 28, 2011
0 parents commit 697f9d9
Show file tree
Hide file tree
Showing 14 changed files with 40,865 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.gem
.bundle
Gemfile.lock
pkg/*
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 rasputin.gemspec
gemspec
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require 'bundler/gem_tasks'
3 changes: 3 additions & 0 deletions lib/rasputin.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require "rasputin/version"
require "rasputin/engine"
require "rasputin/handelbars_template"
4 changes: 4 additions & 0 deletions lib/rasputin/engine.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Rasputin
class Engine < ::Rails::Engine
end
end
32 changes: 32 additions & 0 deletions lib/rasputin/handelbars_template.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
require 'tilt'

module Rasputin
class HandlebarsTemplate < Tilt::Template
def self.default_mime_type
'application/javascript'
end

def prepare
end

def evaluate(scope, locals, &block)
<<-HANDLEBARS
SC.TEMPLATES[#{template_path(scope.logical_path).inspect}] = SC.Handlebars.compile(#{indent(data).inspect});
HANDLEBARS
end

private
def template_path(path)
path = path.split('/')
path.delete('templates')
path.join('_')
end

def indent(string)
string.gsub(/$(.)/m, "\\1 ").strip
end
end
end

Sprockets::Engines #invoke autoloading
Sprockets.register_engine '.handlebars', Rasputin::HandlebarsTemplate
3 changes: 3 additions & 0 deletions lib/rasputin/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Rasputin
VERSION = "0.1.0"
end
23 changes: 23 additions & 0 deletions rasputin.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "rasputin/version"

Gem::Specification.new do |s|
s.name = "rasputin"
s.version = Rasputin::VERSION
s.authors = ["Paul Chavard"]
s.email = ["paul@chavard.net"]
s.homepage = "http://github.com/tchak/rasputin"
s.summary = %q{Sproutcore 2.0 adapter for the Rails asset pipeline.}
s.description = %q{Sproutcore 2.0 for the Rails asset pipeline.}

s.rubyforge_project = "rasputin"
s.add_runtime_dependency 'railties', '~> 3.1.0.rc4'
s.add_runtime_dependency 'actionpack', '~> 3.1.0.rc4'
s.add_runtime_dependency 'sprockets', '>= 2.0.0.beta.10'

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
Loading

0 comments on commit 697f9d9

Please sign in to comment.