Permalink
Browse files

Remove ember related stuff

  • Loading branch information...
1 parent 9c51e2f commit fc0cabc8d837c4f1a54661beb6174d6a0f53e058 @tchak committed Jun 9, 2012
View
@@ -7,61 +7,19 @@ I will discontinu support to all the ember related stuff in rasputin.
You should start to migrate to [ember-rails](https://github.com/emberjs/ember-rails).
The sprocket extention to use `require` is going to stay in rasputin.
+If you use Rasputin for Ember.js integration with Rails 3.1 assets pipeline you should use [ember-rails](https://github.com/emberjs/ember-rails) gem.
-
-Rasputin integrates Ember.js with Rails 3.1 assets pipeline.
-
-It requires the following ember packages :
-
-* ember
-* ember-data
-
-Rasputin also provide a sprockets engine for handlebars templates. Any template in your
-javascript assets folder with extension `handlebars` or `hbs` will be available in ember.
-
-Examples :
-
- todos/templates/item.handlebars >> Ember.TEMPLATES['todos/item']
- todos/ui/templates/stats.handlebars >> Ember.TEMPLATES['todos/ui/stats']
- todos/templates/collection.hbs >> Ember.TEMPLATES['todos/collection']
-
-If you want to keep using old naming scheme, put this in your rails configuration block :
-
- config.rasputin.template_name_separator = '_'
-
-The new default is '/'
-
-Precompilation :
-
-Rasputin can precompile your handlebars templates. Default behavior is to precompile templates only in production environment.
-If you don't want this behavior you can turn it off in your rails configuration block :
-
- config.rasputin.precompile_handlebars = false
-
-If you use Slim of Haml templates, you can use handlebars filter :
-
- handlebars:
- {{view Ember.Button}}OK{{/view}}
-
-It will be translated as :
-
- <script type="text/x-handlebars">
- {{view Ember.Button}}OK{{/view}}
- </script>
-
-Preprocessor :
-
-If you chouse to use "javascript native require" your application.js file will look like this :
+Rasputin provide a preprocessor for javascript that let you use "require" directive in your files:
require('jquery');
require('ember');
require('ember-data');
require('app/**/*');
-There is two new settings :
+Here is the two available settings :
- config.rasputin.use_javascript_require = true
- config.rasputin.strip_javascript_require = true
+ config.rasputin.enable = true
+ config.rasputin.strip_require_directives = true
Install
-------
@@ -70,18 +28,13 @@ In Gemfile:
gem 'rasputin'
-In your javascript assets manifest (app/assets/javascripts/application.js) add the following:
-
- //= require jquery
- //= require ember
-
-And any of the following you want to include:
-
- //= require ember-data
-
ChangeLog
----------
+0.16.0
+
+* All Ember.js related stuff has moved to ember-rails
+
0.15.0
* Update to Ember.js 0.9.6
View
@@ -2,27 +2,16 @@
require 'sprockets/engines'
require "rasputin/version"
-require "rasputin/handlebars/compiler"
-require "rasputin/handlebars/template"
-
-require "rasputin/slim" if defined? Slim
-require "rasputin/haml" if defined? Haml
-
require "rasputin/require_preprocessor"
module Rasputin
class Engine < ::Rails::Engine
config.rasputin = ActiveSupport::OrderedOptions.new
- config.rasputin.precompile_handlebars = Rails.env.production?
- config.rasputin.template_name_separator = '/'
-
- config.rasputin.use_javascript_require = true
- config.rasputin.strip_javascript_require = true
+ config.rasputin.enable = true
+ config.rasputin.strip_require_directives = true
initializer :setup_rasputin, :group => :all do |app|
app.assets.register_preprocessor 'application/javascript', Rasputin::RequirePreprocessor
- app.assets.register_engine '.handlebars', Rasputin::HandlebarsTemplate
- app.assets.register_engine '.hbs', Rasputin::HandlebarsTemplate
end
end
end
View
@@ -1,11 +0,0 @@
-module Haml
- module Filters
- module Handlebars
- include Base
- def render_with_options(text, options)
- type = "type=#{options[:attr_wrapper]}text/x-handlebars#{options[:attr_wrapper]}"
- "<script #{type}>\n#{text.rstrip}\n</script>"
- end
- end
- end
-end
@@ -1,52 +0,0 @@
-require "execjs"
-
-module Rasputin
- module Handlebars
- module Source
-
- def self.precompiler_path
- assets_path("ember-precompiler.js")
- end
-
- def self.assets_path(name)
- File.expand_path(File.join(__FILE__, "..", "..", "..", "..", "vendor/assets/javascripts/#{name}"))
- end
-
- def self.bundled_path
- assets_path("ember.js")
- end
-
- def self.path
- @path ||= ENV["EMBER_SOURCE_PATH"] || bundled_path
- end
-
- def self.path=(path)
- @contents = @version = @context = nil
- @path = path
- end
-
- def self.contents
- @contents ||= [File.read(precompiler_path), File.read(path)].join("\n")
- end
-
- def self.version
- @version ||= contents[/^Handlebars.VERSION = "([^"]*)"/, 1]
- end
-
- def self.context
- @context ||= ExecJS.compile(contents)
- end
- end
-
- class << self
- def version
- Source.version
- end
-
- def compile(template)
- template = template.read if template.respond_to?(:read)
- Source.context.call("precompileEmberHandlebars", template)
- end
- end
- end
-end
@@ -1,30 +0,0 @@
-module Rasputin
- class HandlebarsTemplate < Tilt::Template
- def self.default_mime_type
- 'application/javascript'
- end
-
- def prepare; end
-
- def evaluate(scope, locals, &block)
- if Rails.configuration.rasputin.precompile_handlebars
- func = Rasputin::Handlebars.compile(data)
- "Ember.TEMPLATES[#{template_path(scope.logical_path).inspect}] = Ember.Handlebars.template(#{func});"
- else
- "Ember.TEMPLATES[#{template_path(scope.logical_path).inspect}] = Ember.Handlebars.compile(#{indent(data).inspect});"
- end
- end
-
- private
-
- def template_path(path)
- path = path.split('/')
- path.delete('templates')
- path.join(Rails.configuration.rasputin.template_name_separator)
- end
-
- def indent(string)
- string.gsub(/$(.)/m, "\\1 ").strip
- end
- end
-end
@@ -24,10 +24,10 @@ class RequirePreprocessor < Tilt::Template
def prepare
@pathname = Pathname.new(file)
- @use_javascript_require = Rails.configuration.rasputin.use_javascript_require
- @strip_javascript_require = Rails.configuration.rasputin.strip_javascript_require
+ @enable = Rails.configuration.rasputin.enable
+ @strip_require_directives = Rails.configuration.rasputin.strip_require_directives
- if @use_javascript_require
+ if @enable
@header = data[HEADER_PATTERN, 0] || ""
@body = $' || data
# Ensure body ends in a new line
@@ -38,7 +38,7 @@ def prepare
end
def evaluate(context, locals, &block)
- if @use_javascript_require
+ if @enable
@context = context
process_directives
@@ -49,7 +49,7 @@ def evaluate(context, locals, &block)
end
def processed_header
- if @use_javascript_require && @strip_javascript_require
+ if @enable && @strip_require_directives
lineno = 0
@processed_header ||= header.lines.map { |line|
lineno += 1
@@ -1,5 +0,0 @@
-module Slim
- class EmbeddedEngine
- register :handlebars, TagEngine, :tag => :script, :attributes => { :type => 'text/x-handlebars' }
- end
-end
@@ -1,3 +1,3 @@
module Rasputin
- VERSION = "0.15.0"
+ VERSION = "0.16.0"
end
View
@@ -15,7 +15,6 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'railties', '~> 3.1'
s.add_runtime_dependency 'actionpack', '~> 3.1'
s.add_runtime_dependency 'sprockets', '~> 2.0'
- s.add_runtime_dependency 'jquery-rails', '>= 1.0'
s.files = `git ls-files`.split("\n")
#s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Oops, something went wrong.

0 comments on commit fc0cabc

Please sign in to comment.