Skip to content
This repository
Browse code

move to Ember / Ember::Rails namespace

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

0 comments on commit 1afca21

Please sign in to comment.
Something went wrong with that request. Please try again.