discourse-ember-rails 0.18.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +19 -0
- data/README.md +341 -0
- data/lib/ember-rails.rb +1 -0
- data/lib/ember/rails/engine.rb +25 -0
- data/lib/ember/rails/version.rb +5 -0
- data/lib/ember_rails.rb +96 -0
- data/lib/generators/ember/adapter_generator.rb +21 -0
- data/lib/generators/ember/bootstrap_generator.rb +76 -0
- data/lib/generators/ember/component_generator.rb +28 -0
- data/lib/generators/ember/controller_generator.rb +34 -0
- data/lib/generators/ember/generator_helpers.rb +58 -0
- data/lib/generators/ember/initializer_generator.rb +23 -0
- data/lib/generators/ember/install_generator.rb +194 -0
- data/lib/generators/ember/instance_initializer_generator.rb +23 -0
- data/lib/generators/ember/model_generator.rb +48 -0
- data/lib/generators/ember/resource_generator.rb +29 -0
- data/lib/generators/ember/resource_override.rb +38 -0
- data/lib/generators/ember/route_generator.rb +21 -0
- data/lib/generators/ember/service_generator.rb +23 -0
- data/lib/generators/ember/template_generator.rb +23 -0
- data/lib/generators/ember/view_generator.rb +24 -0
- data/lib/generators/templates/adapter.js +5 -0
- data/lib/generators/templates/adapter.js.coffee +5 -0
- data/lib/generators/templates/adapter.js.em +3 -0
- data/lib/generators/templates/app.js +11 -0
- data/lib/generators/templates/app.js.coffee +11 -0
- data/lib/generators/templates/app.js.em +11 -0
- data/lib/generators/templates/application.hbs +3 -0
- data/lib/generators/templates/application.js +11 -0
- data/lib/generators/templates/application.js.coffee +11 -0
- data/lib/generators/templates/application.js.em +10 -0
- data/lib/generators/templates/application_adapter.js +5 -0
- data/lib/generators/templates/application_adapter.js.coffee +5 -0
- data/lib/generators/templates/application_adapter.js.em +3 -0
- data/lib/generators/templates/array_controller.js +5 -0
- data/lib/generators/templates/array_controller.js.coffee +5 -0
- data/lib/generators/templates/array_controller.js.em +3 -0
- data/lib/generators/templates/component.js +4 -0
- data/lib/generators/templates/component.js.coffee +6 -0
- data/lib/generators/templates/component.js.em +6 -0
- data/lib/generators/templates/component.template.hbs +2 -0
- data/lib/generators/templates/controller.js +5 -0
- data/lib/generators/templates/controller.js.coffee +6 -0
- data/lib/generators/templates/controller.js.em +3 -0
- data/lib/generators/templates/model.js +13 -0
- data/lib/generators/templates/model.js.coffee +12 -0
- data/lib/generators/templates/model.js.em +12 -0
- data/lib/generators/templates/object_controller.js +5 -0
- data/lib/generators/templates/object_controller.js.coffee +5 -0
- data/lib/generators/templates/object_controller.js.em +3 -0
- data/lib/generators/templates/route.js +5 -0
- data/lib/generators/templates/route.js.coffee +5 -0
- data/lib/generators/templates/route.js.em +3 -0
- data/lib/generators/templates/router.js +5 -0
- data/lib/generators/templates/router.js.coffee +5 -0
- data/lib/generators/templates/router.js.em +5 -0
- data/lib/generators/templates/template.hbs +5 -0
- data/lib/generators/templates/view.js +5 -0
- data/lib/generators/templates/view.js.coffee +4 -0
- data/lib/generators/templates/view.js.em +4 -0
- metadata +329 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'generators/ember/generator_helpers'
|
2
|
+
|
3
|
+
module Ember
|
4
|
+
module Generators
|
5
|
+
class AdapterGenerator < ::Rails::Generators::NamedBase
|
6
|
+
include Ember::Generators::GeneratorHelpers
|
7
|
+
|
8
|
+
source_root File.expand_path("../../templates", __FILE__)
|
9
|
+
|
10
|
+
desc "Creates a new Ember.js adapter"
|
11
|
+
class_option :ember_path, :type => :string, :aliases => "-d", :desc => "Custom ember app path"
|
12
|
+
class_option :javascript_engine, :desc => "Engine for JavaScripts"
|
13
|
+
class_option :app_name, :type => :string, :aliases => "-n", :desc => "Custom ember app name"
|
14
|
+
|
15
|
+
def create_adapter_files
|
16
|
+
file_path = File.join(ember_path, 'adapters', class_path, "#{file_name}_adapter.#{engine_extension}")
|
17
|
+
template "adapter.#{engine_extension}", file_path
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'generators/ember/generator_helpers'
|
2
|
+
|
3
|
+
module Ember
|
4
|
+
module Generators
|
5
|
+
class BootstrapGenerator < ::Rails::Generators::Base
|
6
|
+
include Ember::Generators::GeneratorHelpers
|
7
|
+
|
8
|
+
source_root File.expand_path("../../templates", __FILE__)
|
9
|
+
|
10
|
+
desc "Creates a default Ember.js folder layout in app/assets/javascripts"
|
11
|
+
|
12
|
+
class_option :ember_path, :type => :string, :aliases => "-d", :desc => "Custom ember app path"
|
13
|
+
class_option :skip_git, :type => :boolean, :aliases => "-g", :default => false, :desc => "Skip Git keeps"
|
14
|
+
class_option :javascript_engine, :desc => "Engine for JavaScripts (js for JavaScript, coffee for CoffeeScript, etc)"
|
15
|
+
class_option :app_name, :type => :string, :aliases => "-n", :desc => "Custom ember app name"
|
16
|
+
|
17
|
+
def inject_ember
|
18
|
+
begin
|
19
|
+
inject_into_application_file(engine_extension)
|
20
|
+
rescue Exception => e
|
21
|
+
inject_into_application_file('js')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
def create_dir_layout
|
27
|
+
%W{models controllers views routes helpers components templates templates/components mixins adapters}.each do |dir|
|
28
|
+
empty_directory "#{ember_path}/#{dir}"
|
29
|
+
create_file "#{ember_path}/#{dir}/.gitkeep" unless options[:skip_git]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def create_app_file
|
34
|
+
template "app.#{engine_extension}", "#{ember_path}/#{application_name.underscore}.#{engine_extension}"
|
35
|
+
end
|
36
|
+
|
37
|
+
def create_router_file
|
38
|
+
template "router.#{engine_extension}", "#{ember_path}/router.#{engine_extension}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def create_adapter_file
|
42
|
+
template "application_adapter.#{engine_extension}", "#{ember_path}/adapters/application_adapter.#{engine_extension}"
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def inject_into_application_file(safe_extension)
|
48
|
+
application_file = "application.#{safe_extension}"
|
49
|
+
full_path = Pathname.new(destination_root).join(ember_path, application_file)
|
50
|
+
|
51
|
+
if full_path.exist?
|
52
|
+
injection_options = get_options_from_contents(full_path.read)
|
53
|
+
|
54
|
+
inject_into_file(full_path.to_s, injection_options) do
|
55
|
+
context = instance_eval('binding')
|
56
|
+
source = File.expand_path(find_in_source_paths(application_file))
|
57
|
+
ERB.new(::File.binread(source), nil, '-', '@output_buffer').result(context)
|
58
|
+
end
|
59
|
+
else
|
60
|
+
template application_file, full_path
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def get_options_from_contents(contents)
|
65
|
+
if contents =~ regex = /^.*require_tree.*$/
|
66
|
+
{:before => regex}
|
67
|
+
elsif contents =~ regex = /^\s*$/
|
68
|
+
{:before => regex}
|
69
|
+
else
|
70
|
+
regex = /\z/
|
71
|
+
{:after => regex}
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'generators/ember/generator_helpers'
|
2
|
+
|
3
|
+
module Ember
|
4
|
+
module Generators
|
5
|
+
class ComponentGenerator < ::Rails::Generators::NamedBase
|
6
|
+
include Ember::Generators::GeneratorHelpers
|
7
|
+
|
8
|
+
source_root File.expand_path("../../templates", __FILE__)
|
9
|
+
|
10
|
+
desc "Creates a new Ember.js component and component template\nCustom Ember Components require at least two descriptive names separated by a dash. Use CamelCase or dash-case to name your component.\n\nExample,\n\trails generate ember:component PostChart [options]\n\trails generate ember:component post-chart [options]"
|
11
|
+
|
12
|
+
class_option :javascript_engine, :desc => "Engine for JavaScripts"
|
13
|
+
class_option :ember_path, :type => :string, :aliases => "-d", :desc => "Custom ember app path"
|
14
|
+
class_option :app_name, :type => :string, :aliases => "-n", :desc => "Custom ember app name"
|
15
|
+
|
16
|
+
def create_component_files
|
17
|
+
dashed_file_name = file_name.gsub(/_/, '-')
|
18
|
+
comp_path = File.join(ember_path, 'components', class_path, "#{dashed_file_name}_component.#{engine_extension}")
|
19
|
+
template "component.#{engine_extension}", comp_path
|
20
|
+
|
21
|
+
templ_path = File.join(ember_path, 'templates/components', class_path, "#{dashed_file_name}.hbs")
|
22
|
+
template "component.template.hbs", templ_path
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'generators/ember/generator_helpers'
|
2
|
+
|
3
|
+
module Ember
|
4
|
+
module Generators
|
5
|
+
class ControllerGenerator < ::Rails::Generators::NamedBase
|
6
|
+
include Ember::Generators::GeneratorHelpers
|
7
|
+
|
8
|
+
source_root File.expand_path("../../templates", __FILE__)
|
9
|
+
|
10
|
+
desc "Creates a new Ember.js controller"
|
11
|
+
|
12
|
+
class_option :javascript_engine, :desc => "Engine for JavaScripts"
|
13
|
+
class_option :array, :type => :boolean, :default => false, :desc => "Create an Ember.ArrayController to represent multiple objects"
|
14
|
+
class_option :ember_path, :type => :string, :aliases => "-d", :desc => "Custom ember app path"
|
15
|
+
class_option :object, :type => :boolean, :default => false, :desc => "Create an Ember.Controller to represent a single object"
|
16
|
+
class_option :app_name, :type => :string, :aliases => "-n", :desc => "Custom ember app name"
|
17
|
+
|
18
|
+
|
19
|
+
def create_controller_files
|
20
|
+
file_path = File.join(ember_path, 'controllers', class_path, "#{file_name}_controller.#{engine_extension}")
|
21
|
+
|
22
|
+
if options.array?
|
23
|
+
template "array_controller.#{engine_extension}", file_path
|
24
|
+
elsif options.object?
|
25
|
+
template "object_controller.#{engine_extension}", file_path
|
26
|
+
else
|
27
|
+
template "controller.#{engine_extension}", file_path
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Ember
|
2
|
+
module Generators
|
3
|
+
module GeneratorHelpers
|
4
|
+
|
5
|
+
def ember_path
|
6
|
+
if options[:ember_path]
|
7
|
+
options[:ember_path]
|
8
|
+
elsif rails_engine?
|
9
|
+
"app/assets/javascripts/#{engine_name}"
|
10
|
+
elsif configuration.ember_path
|
11
|
+
configuration.ember_path
|
12
|
+
else
|
13
|
+
"app/assets/javascripts"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def rails_engine?
|
18
|
+
defined?(ENGINE_PATH)
|
19
|
+
end
|
20
|
+
|
21
|
+
def engine_name
|
22
|
+
ENGINE_PATH.split('/')[-2]
|
23
|
+
end
|
24
|
+
|
25
|
+
def application_name
|
26
|
+
if options[:app_name]
|
27
|
+
options[:app_name]
|
28
|
+
elsif rails_engine?
|
29
|
+
engine_name
|
30
|
+
elsif configuration.app_name
|
31
|
+
configuration.app_name
|
32
|
+
elsif defined?(::Rails) && ::Rails.application
|
33
|
+
::Rails.application.class.name.split('::').first
|
34
|
+
else
|
35
|
+
"App"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def class_name
|
40
|
+
(class_path + [file_name]).map!{ |m| m.camelize }.join()
|
41
|
+
end
|
42
|
+
|
43
|
+
def handlebars_template_path
|
44
|
+
File.join(class_path, file_name).gsub(/^\//, '')
|
45
|
+
end
|
46
|
+
|
47
|
+
def engine_extension
|
48
|
+
@engine_extension ||= "js.#{options[:javascript_engine]}".sub('js.js','js')
|
49
|
+
end
|
50
|
+
|
51
|
+
def configuration
|
52
|
+
if defined?(::Rails) && ::Rails.configuration
|
53
|
+
::Rails.configuration.ember
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'generators/ember/generator_helpers'
|
2
|
+
|
3
|
+
module Ember
|
4
|
+
module Generators
|
5
|
+
class InitializerGenerator < ::Rails::Generators::NamedBase
|
6
|
+
include Ember::Generators::GeneratorHelpers
|
7
|
+
|
8
|
+
source_root File.expand_path("../../templates", __FILE__)
|
9
|
+
|
10
|
+
desc "Creates a new Ember.js initializer"
|
11
|
+
|
12
|
+
class_option :javascript_engine, :desc => "Engine for JavaScripts"
|
13
|
+
class_option :ember_path, :type => :string, :aliases => "-d", :desc => "Custom ember app path"
|
14
|
+
class_option :app_name, :type => :string, :aliases => "-n", :desc => "Custom ember app name"
|
15
|
+
|
16
|
+
def create_initializer_files
|
17
|
+
file_path = File.join(ember_path, 'initializers', class_path, "#{file_name.dasherize}.#{engine_extension}")
|
18
|
+
|
19
|
+
template "initializer.#{engine_extension}", file_path
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,194 @@
|
|
1
|
+
require 'generators/ember/generator_helpers'
|
2
|
+
require 'net/http'
|
3
|
+
require 'uri'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
module Ember
|
7
|
+
module Generators
|
8
|
+
class InstallGenerator < ::Rails::Generators::Base
|
9
|
+
|
10
|
+
class InvalidChannel < ::Thor::Error; end
|
11
|
+
class ConflictingOptions < ::Thor::Error; end
|
12
|
+
class InsufficientOptions < ::Thor::Error; end
|
13
|
+
|
14
|
+
::InvalidChannel = InvalidChannel
|
15
|
+
::ConflictingOptions = ConflictingOptions
|
16
|
+
::InsufficientOptions = InsufficientOptions
|
17
|
+
|
18
|
+
desc "Install Ember.js into your vendor folder"
|
19
|
+
class_option :head,
|
20
|
+
:type => :boolean,
|
21
|
+
:default => false,
|
22
|
+
:desc => "Download Ember.js & Ember data from canary channel. This is deprecated. Use channel instead."
|
23
|
+
class_option :channel,
|
24
|
+
:type => :string,
|
25
|
+
:required => false,
|
26
|
+
:desc => "Ember release channel Choose between 'release', 'beta' or 'canary'"
|
27
|
+
class_option :ember_only,
|
28
|
+
:type => :boolean,
|
29
|
+
:required => false,
|
30
|
+
:desc => "Only download Ember.",
|
31
|
+
:aliases => '--ember'
|
32
|
+
class_option :ember_data_only,
|
33
|
+
:type => :boolean,
|
34
|
+
:required => false,
|
35
|
+
:desc => "Only download ember-data",
|
36
|
+
:aliases => '--ember-data'
|
37
|
+
class_option :tag,
|
38
|
+
:type => :string,
|
39
|
+
:required => false,
|
40
|
+
:desc => "Download tagged release use syntax v1.0.0-beta.3/ember-data & v1.0.0-rc.8/ember"
|
41
|
+
|
42
|
+
def initialize(args = [], options = {}, config = {})
|
43
|
+
super(args, options, config)
|
44
|
+
check_options
|
45
|
+
process_options
|
46
|
+
end
|
47
|
+
|
48
|
+
def ember
|
49
|
+
begin
|
50
|
+
unless options.ember_data_only?
|
51
|
+
get_ember_js_for(:development)
|
52
|
+
get_ember_js_for(:production)
|
53
|
+
end
|
54
|
+
rescue Thor::Error
|
55
|
+
say('WARNING: no ember files on this channel or tag' , :yellow)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def ember_data
|
60
|
+
begin
|
61
|
+
unless options.ember_only?
|
62
|
+
get_ember_data_for(:development)
|
63
|
+
get_ember_data_for(:production)
|
64
|
+
end
|
65
|
+
rescue Thor::Error
|
66
|
+
say('WARNING: no ember-data files on this channel or tag' , :yellow)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
def get_ember_data_for(environment)
|
73
|
+
|
74
|
+
create_file "vendor/assets/ember/#{environment}/ember-data.js" do
|
75
|
+
fetch url_for(channel, 'ember-data', environment), "vendor/assets/ember/#{environment}/ember-data.js"
|
76
|
+
end
|
77
|
+
|
78
|
+
sourcemap_url = "#{base_url}/#{channel}/ember-data.js.map"
|
79
|
+
if resource_exist?(sourcemap_url)
|
80
|
+
create_file "vendor/assets/ember/#{environment}/ember-data.js.map" do
|
81
|
+
fetch sourcemap_url, "vendor/assets/ember/#{environment}/ember-data.js.map", false
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def get_ember_js_for(environment)
|
87
|
+
create_file "vendor/assets/ember/#{environment}/ember.js" do
|
88
|
+
fetch url_for(channel, 'ember', environment), "vendor/assets/ember/#{environment}/ember.js"
|
89
|
+
end
|
90
|
+
|
91
|
+
compiler_url = "#{base_url}/#{channel}/ember-template-compiler.js"
|
92
|
+
if resource_exist?(compiler_url)
|
93
|
+
create_file "vendor/assets/ember/#{environment}/ember-template-compiler.js" do
|
94
|
+
fetch "#{base_url}/#{channel}/ember-template-compiler.js", "vendor/assets/ember/#{environment}/ember-template-compiler.js"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def url_for(channel, component, environment)
|
100
|
+
base = "#{base_url}/#{channel}/#{component}"
|
101
|
+
|
102
|
+
case environment
|
103
|
+
when :production
|
104
|
+
"#{base}.min.js"
|
105
|
+
when :development
|
106
|
+
if resource_exist?("#{base}.debug.js")
|
107
|
+
"#{base}.debug.js" # Ember.js 1.10.0.beta.1 or later
|
108
|
+
else
|
109
|
+
"#{base}.js"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def check_options
|
115
|
+
if options.head?
|
116
|
+
say('WARNING: --head option is deprecated in favor of --channel=canary' , :yellow)
|
117
|
+
end
|
118
|
+
if options.head? && options.channel?
|
119
|
+
say 'ERROR: conflicting options. --head and --channel. Use either --head or --channel=<channel>', :red
|
120
|
+
raise ConflictingOptions
|
121
|
+
end
|
122
|
+
if options.channel? && !%w(release beta canary).include?(options[:channel])
|
123
|
+
say 'ERROR: channel can either be release, beta or canary', :red
|
124
|
+
raise InvalidChannel
|
125
|
+
end
|
126
|
+
if options.channel? && options.tag?
|
127
|
+
say 'ERROR: conflicting options. --tag and --channel. --tag is incompatible with other options', :red
|
128
|
+
raise ConflictingOptions
|
129
|
+
end
|
130
|
+
if options.head? && options.tag?
|
131
|
+
say 'ERROR: conflicting options. --tag and --head. --tag is incompatible with other options', :red
|
132
|
+
raise ConflictingOptions
|
133
|
+
end
|
134
|
+
if options.tag? && !(options.ember_only? || options.ember_data_only?)
|
135
|
+
say 'ERROR: insufficient options. --tag needs to be combined with eithe --ember or --ember-data', :red
|
136
|
+
raise InsufficientOptions
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
def process_options
|
141
|
+
if options.head?
|
142
|
+
@channel = :canary
|
143
|
+
end
|
144
|
+
if options.tag?
|
145
|
+
@channel = "tags/#{options.tag}"
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
def base_url
|
150
|
+
'http://builds.emberjs.com'
|
151
|
+
end
|
152
|
+
|
153
|
+
def channel
|
154
|
+
if options.channel
|
155
|
+
@channel ||= options[:channel]
|
156
|
+
else
|
157
|
+
@channel ||= :release
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def fetch(from, to, prepend_verbose = true)
|
162
|
+
message = "#{from} -> #{to}"
|
163
|
+
say_status("downloading:", message , :green)
|
164
|
+
|
165
|
+
uri = URI(from)
|
166
|
+
output = StringIO.new
|
167
|
+
if prepend_verbose
|
168
|
+
output.puts "// Fetched from channel: #{channel}, with url " + uri.to_s
|
169
|
+
output.puts "// Fetched on: " + Time.now.utc.iso8601.to_s
|
170
|
+
end
|
171
|
+
|
172
|
+
response = Net::HTTP.get_response(uri)
|
173
|
+
case response.code
|
174
|
+
when '404'
|
175
|
+
say "ERROR: Error reading the content from the channel with url #{from}. File not found" , :red
|
176
|
+
raise Thor::Error
|
177
|
+
when '200'
|
178
|
+
output.puts response.body.force_encoding("UTF-8")
|
179
|
+
else
|
180
|
+
say "ERROR: Unexpected error with status #{response.code} reading the content from the channel with url #{from}." , :red
|
181
|
+
raise Thor::Error
|
182
|
+
end
|
183
|
+
output.rewind
|
184
|
+
content = output.read
|
185
|
+
end
|
186
|
+
|
187
|
+
def resource_exist?(target)
|
188
|
+
uri = URI(target)
|
189
|
+
response = Net::HTTP.new(uri.host, uri.port).head(uri.path)
|
190
|
+
response.code == '200'
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'generators/ember/generator_helpers'
|
2
|
+
|
3
|
+
module Ember
|
4
|
+
module Generators
|
5
|
+
class InstanceInitializerGenerator < ::Rails::Generators::NamedBase
|
6
|
+
include Ember::Generators::GeneratorHelpers
|
7
|
+
|
8
|
+
source_root File.expand_path("../../templates", __FILE__)
|
9
|
+
|
10
|
+
desc "Creates a new Ember.js instance initializer"
|
11
|
+
|
12
|
+
class_option :javascript_engine, :desc => "Engine for JavaScripts"
|
13
|
+
class_option :ember_path, :type => :string, :aliases => "-d", :desc => "Custom ember app path"
|
14
|
+
class_option :app_name, :type => :string, :aliases => "-n", :desc => "Custom ember app name"
|
15
|
+
|
16
|
+
def create_instance_initializer_files
|
17
|
+
file_path = File.join(ember_path, 'instance-initializers', class_path, "#{file_name.dasherize}.#{engine_extension}")
|
18
|
+
|
19
|
+
template "instance-initializer.#{engine_extension}", file_path
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|