Permalink
Browse files

move to Ember / Ember::Rails namespace

  • Loading branch information...
1 parent 5653fb0 commit 1afca21292495557f61977db9b55cefc3fb6c481 @tchak tchak committed Apr 6, 2012
View
4 ember-rails.gemspec
@@ -1,10 +1,10 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
-require "ember_rails/version"
+require "ember/rails/version"
Gem::Specification.new do |s|
s.name = "ember-rails"
- s.version = EmberRails::VERSION
+ s.version = Ember::Rails::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Keith Pitt", "Rob Monie", "Joao Carlos", "Paul Chavard"]
s.email = ["me@keithpitt.com"]
View
21 lib/ember-rails.rb
@@ -1,20 +1 @@
-require 'sprockets'
-require 'sprockets/engines'
-
-require "ember_rails/handlebars/source"
-require "ember_rails/handlebars/template"
-
-module EmberRails
- class Engine < ::Rails::Engine
- config.handlebars = ActiveSupport::OrderedOptions.new
- config.handlebars.precompile = Rails.env.production?
- config.handlebars.template_root = nil
- config.handlebars.template_path_separator = '/'
-
- initializer :setup_ember_rails, :group => :all do |app|
- app.assets.register_engine '.handlebars', EmberRails::Handlebars::Template
- app.assets.register_engine '.hbs', EmberRails::Handlebars::Template
- app.assets.register_engine '.hjs', EmberRails::Handlebars::Template
- end
- end
-end
+require 'ember_rails'
View
0 lib/assets/javascripts/ember-precompiler.js → ...er/handlebars/assets/ember-precompiler.js
File renamed without changes.
View
5 lib/ember_rails/handlebars/source.rb → lib/ember/handlebars/source.rb
@@ -1,12 +1,11 @@
require "execjs"
-module EmberRails
+module Ember
module Handlebars
class Source
def self.precompiler_path
- File.expand_path(File.join(__FILE__, "..", "..", "..",
- "assets/javascripts/ember-precompiler.js"))
+ File.expand_path(File.join(__FILE__, "../assets/ember-precompiler.js"))
end
def self.bundled_path
View
12 lib/ember_rails/handlebars/template.rb → lib/ember/handlebars/template.rb
@@ -1,4 +1,4 @@
-module EmberRails
+module Ember
module Handlebars
class Template < Tilt::Template
def self.default_mime_type
@@ -10,8 +10,8 @@ def prepare; end
def evaluate(scope, locals, &block)
template = mustache_to_handlebars(scope, data)
- if Rails.configuration.handlebars.precompile
- func = EmberRails::Handlebars.compile(template)
+ if ::Rails.configuration.handlebars.precompile
+ func = Ember::Handlebars.compile(template)
"Ember.TEMPLATES[#{template_path(scope.logical_path).inspect}] = Ember.Handlebars.template(#{func});\n"
else
"Ember.TEMPLATES[#{template_path(scope.logical_path).inspect}] = Ember.Handlebars.compile(#{indent(template).inspect});\n"
@@ -31,11 +31,11 @@ def mustache_to_handlebars(scope, template)
def template_path(path)
path = path.split('/')
- unless Rails.configuration.handlebars.template_root.blank?
- path.delete(Rails.configuration.handlebars.template_root)
+ unless ::Rails.configuration.handlebars.template_root.blank?
+ path.delete(::Rails.configuration.handlebars.template_root)
end
- path.join(Rails.configuration.handlebars.template_path_separator)
+ path.join(::Rails.configuration.handlebars.template_path_separator)
end
def indent(string)
View
5 lib/ember/rails/version.rb
@@ -0,0 +1,5 @@
+module Ember
+ module Rails
+ VERSION = "0.3.0"
+ end
+end
View
3 lib/ember/version.rb
@@ -0,0 +1,3 @@
+module Ember
+ VERSION = "0.9.6"
+end
View
26 lib/ember_rails.rb
@@ -1,23 +1,25 @@
require 'sprockets'
require 'sprockets/engines'
-require "ember_rails/handlebars/source"
-require "ember_rails/handlebars/template"
+require "ember/handlebars/source"
+require "ember/handlebars/template"
require "ember_rails/slim" if defined? Slim
require "ember_rails/haml" if defined? Haml
-module EmberRails
- class Engine < ::Rails::Engine
- config.handlebars = ActiveSupport::OrderedOptions.new
- config.handlebars.precompile = Rails.env.production?
- config.handlebars.template_root = 'templates'
- config.handlebars.template_path_separator = '/'
+module Ember
+ module Rails
+ class Engine < ::Rails::Engine
+ config.handlebars = ActiveSupport::OrderedOptions.new
+ config.handlebars.precompile = ::Rails.env.production?
+ config.handlebars.template_root = nil
+ config.handlebars.template_path_separator = '/'
- initializer :setup_ember_rails, :group => :all do |app|
- app.assets.register_engine '.handlebars', EmberRails::Handlebars::Template
- app.assets.register_engine '.hbs', EmberRails::Handlebars::Template
- app.assets.register_engine '.hjs', EmberRails::Handlebars::Template
+ initializer :setup_ember_rails, :group => :all do |app|
+ app.assets.register_engine '.handlebars', Ember::Handlebars::Template
+ app.assets.register_engine '.hbs', Ember::Handlebars::Template
+ app.assets.register_engine '.hjs', Ember::Handlebars::Template
+ end
end
end
end
View
4 lib/ember_rails/version.rb
@@ -1,4 +0,0 @@
-module EmberRails
- VERSION = "0.3.0"
- EMBER_VERSION = "0.9.6"
-end
View
12 ...er_rails/bootstrap/bootstrap_generator.rb → lib/generators/ember/bootstrap_generator.rb
@@ -1,11 +1,11 @@
-require 'generators/ember_rails/generator_helpers'
+require 'generators/ember/generator_helpers'
-module EmberRails
+module Ember
module Generators
- class BootstrapGenerator < Rails::Generators::Base
- include EmberRails::Generators::GeneratorHelpers
+ class BootstrapGenerator < ::Rails::Generators::Base
+ include Ember::Generators::GeneratorHelpers
- source_root File.expand_path("../templates", __FILE__)
+ source_root File.expand_path("../../templates", __FILE__)
desc "Creates a default Ember.js folder layout in app/assets/javascripts/ember"
@@ -34,8 +34,6 @@ def create_dir_layout
def create_app_file
template "app.coffee", "#{ember_path}/#{application_name.underscore}.js.coffee"
end
-
end
-
end
end
View
6 ...nerators/ember_rails/generator_helpers.rb → lib/generators/ember/generator_helpers.rb
@@ -1,4 +1,4 @@
-module EmberRails
+module Ember
module Generators
module GeneratorHelpers
@@ -7,8 +7,8 @@ def ember_path
end
def application_name
- if defined?(Rails) && Rails.application
- Rails.application.class.name.split('::').first
+ if defined?(::Rails) && ::Rails.application
+ ::Rails.application.class.name.split('::').first
else
"app"
end
View
23 .../ember_rails/install/install_generator.rb → lib/generators/ember/install_generator.rb
@@ -1,4 +1,4 @@
-module EmberRails
+module Ember
module Generators
class InstallGenerator < Rails::Generators::Base
@@ -61,7 +61,7 @@ def copy_ember
else
self.class.source_root File.expand_path('../../../../../vendor/assets/javascripts', __FILE__)
- say_status("copying", "Ember.js (#{EmberRails::EMBER_VERSION})", :green)
+ say_status("copying", "Ember.js (#{Ember::VERSION})", :green)
ember_files.each do |name|
copy_file name, "vendor/assets/javascripts/#{name}"
@@ -72,20 +72,19 @@ def copy_ember
private
- def ember_files
- options.runtime? ? RUNTIME_FILES : EMBER_FILES
- end
+ def ember_files
+ options.runtime? ? RUNTIME_FILES : EMBER_FILES
+ end
- def cmd(command)
- out = `#{command}`
+ def cmd(command)
+ out = `#{command}`
- if $?.exitstatus != 0
- raise "Command error: command `#{command}` in directory #{Dir.pwd} has failed."
- end
- out
+ if $?.exitstatus != 0
+ raise "Command error: command `#{command}` in directory #{Dir.pwd} has failed."
end
+ out
+ end
end
-
end
end
View
0 ...mber_rails/bootstrap/templates/app.coffee → lib/generators/templates/app.coffee
File renamed without changes.
View
4 ...ils/bootstrap/bootstrap_generator_test.rb → test/generators/bootstrap_generator_test.rb
@@ -1,8 +1,8 @@
require 'test_helper'
-require 'generators/ember_rails/bootstrap/bootstrap_generator'
+require 'generators/ember/bootstrap_generator'
class BootstrapGeneratorTest < Rails::Generators::TestCase
- tests EmberRails::Generators::BootstrapGenerator
+ tests Ember::Generators::BootstrapGenerator
destination File.join(Rails.root, "tmp")
setup :prepare_destination

0 comments on commit 1afca21

Please sign in to comment.