ember-cli-rails 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ember-cli-rails.rb +27 -7
- data/lib/ember-cli/{build_server.rb → app.rb} +17 -5
- data/lib/ember-cli/configuration.rb +1 -1
- data/lib/ember-cli/helpers.rb +10 -0
- data/lib/ember-cli/rack_server.rb +1 -1
- data/lib/ember-cli/railtie.rb +9 -5
- data/lib/ember-cli/rake_task.rb +3 -0
- data/lib/ember-cli/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ef9ebf40bb8a292bd4bbb5616564418e3dbec67
|
4
|
+
data.tar.gz: 588fe62b8b81b49dad39b9669a7985c1d63220da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ae1d31dc429f5bbde157e193aca190b6ed03b96243c205f3f273c3dbb3231ad31ce7b71c4d8fc6da6d03c151268b99388b53b7df70de6318c500ab18fa9611f
|
7
|
+
data.tar.gz: d5810b513cc52ad2f7621a6905a93d022ca3f8dfc0a81e2d34a0fad9902f602ead9c051c4e781072b2a2547f7983ae5ea7cb8e2f19bcc356ae9ae1d4618fa403
|
data/lib/ember-cli-rails.rb
CHANGED
@@ -3,7 +3,7 @@ require "ember-cli/railtie" if defined?(Rails)
|
|
3
3
|
module EmberCLI
|
4
4
|
extend self
|
5
5
|
|
6
|
-
autoload :
|
6
|
+
autoload :App, "ember-cli/app"
|
7
7
|
autoload :Configuration, "ember-cli/configuration"
|
8
8
|
autoload :RackServer, "ember-cli/rack_server"
|
9
9
|
autoload :ViewHelpers, "ember-cli/view_helpers"
|
@@ -18,17 +18,33 @@ module EmberCLI
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def prepare!
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
@prepared ||= begin
|
22
|
+
Rails.configuration.assets.paths << root.join("assets").to_s
|
23
|
+
at_exit{ cleanup }
|
24
|
+
true
|
25
|
+
end
|
24
26
|
end
|
25
27
|
|
26
|
-
def
|
27
|
-
|
28
|
+
def enable!
|
29
|
+
if Rails.env.development?
|
30
|
+
prepare!
|
31
|
+
Rack::Server.send :prepend, RackServer
|
32
|
+
else
|
33
|
+
compile!
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def run!
|
38
|
+
each_app &:run
|
39
|
+
end
|
40
|
+
|
41
|
+
def compile!
|
42
|
+
prepare!
|
43
|
+
each_app &:compile
|
28
44
|
end
|
29
45
|
|
30
46
|
def stop!
|
31
|
-
|
47
|
+
each_app &:stop
|
32
48
|
end
|
33
49
|
|
34
50
|
def root
|
@@ -44,4 +60,8 @@ module EmberCLI
|
|
44
60
|
def cleanup
|
45
61
|
root.rmtree if root.exist?
|
46
62
|
end
|
63
|
+
|
64
|
+
def each_app
|
65
|
+
configuration.apps.values.each{ |a| yield a }
|
66
|
+
end
|
47
67
|
end
|
@@ -1,15 +1,22 @@
|
|
1
1
|
module EmberCLI
|
2
|
-
class
|
2
|
+
class App
|
3
3
|
attr_reader :name, :options, :pid
|
4
4
|
|
5
5
|
def initialize(name, **options)
|
6
6
|
@name, @options = name.to_s, options
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
9
|
+
def compile
|
10
10
|
symlink_to_assets_root
|
11
11
|
add_assets_to_precompile_list
|
12
|
-
|
12
|
+
silence_stream STDOUT do
|
13
|
+
system command, chdir: app_path, err: :out
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
18
|
+
compile
|
19
|
+
@pid = spawn(command(watch: true), chdir: app_path, err: :out)
|
13
20
|
at_exit{ stop }
|
14
21
|
end
|
15
22
|
|
@@ -36,8 +43,9 @@ module EmberCLI
|
|
36
43
|
Rails.configuration.assets.precompile << /(?:\/|\A)#{name}\//
|
37
44
|
end
|
38
45
|
|
39
|
-
def command
|
40
|
-
|
46
|
+
def command(watch: nil)
|
47
|
+
watch = "--watch" if watch
|
48
|
+
"#{ember_path} build #{watch} --environment #{environment} --output-path #{dist_path} #{log_pipe}"
|
41
49
|
end
|
42
50
|
|
43
51
|
def log_pipe
|
@@ -65,5 +73,9 @@ module EmberCLI
|
|
65
73
|
def assets_path
|
66
74
|
@assets_path ||= EmberCLI.root.join("assets").tap(&:mkpath)
|
67
75
|
end
|
76
|
+
|
77
|
+
def environment
|
78
|
+
Rails.env.in?(%w[development test]) ? Rails.env : "production"
|
79
|
+
end
|
68
80
|
end
|
69
81
|
end
|
data/lib/ember-cli/helpers.rb
CHANGED
@@ -14,5 +14,15 @@ module EmberCLI
|
|
14
14
|
|
15
15
|
nil
|
16
16
|
end
|
17
|
+
|
18
|
+
def override_assets_precompile_task!
|
19
|
+
Rake.application.instance_eval do
|
20
|
+
@tasks["assets:precompile:original"] = @tasks.delete("assets:precompile")
|
21
|
+
Rake::Task.define_task "assets:precompile", %i[assets precompile] => :environment do
|
22
|
+
EmberCLI.compile!
|
23
|
+
Rake::Task["assets:precompile:original"].execute
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
17
27
|
end
|
18
28
|
end
|
data/lib/ember-cli/railtie.rb
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
module EmberCLI
|
2
2
|
class Railtie < Rails::Railtie
|
3
|
-
initializer "ember-cli-rails.rack-server" do
|
4
|
-
EmberCLI.prepare! if development_mode?
|
5
|
-
end
|
6
|
-
|
7
3
|
initializer "ember-cli-rails.view_helpers" do
|
8
4
|
ActionView::Base.send :include, ViewHelpers
|
9
5
|
end
|
@@ -14,7 +10,15 @@ module EmberCLI
|
|
14
10
|
end
|
15
11
|
end
|
16
12
|
|
17
|
-
|
13
|
+
initializer "ember-cli-rails.rack-server" do
|
14
|
+
EmberCLI.enable! if non_production?
|
15
|
+
end
|
16
|
+
|
17
|
+
rake_tasks do
|
18
|
+
require "ember-cli/rake_task"
|
19
|
+
end
|
20
|
+
|
21
|
+
def non_production?
|
18
22
|
!Rails.env.production? && Rails.configuration.consider_all_requests_local
|
19
23
|
end
|
20
24
|
end
|
data/lib/ember-cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ember-cli-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Pravosud
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-12-
|
12
|
+
date: 2014-12-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
@@ -36,11 +36,12 @@ files:
|
|
36
36
|
- LICENSE.txt
|
37
37
|
- README.md
|
38
38
|
- lib/ember-cli-rails.rb
|
39
|
-
- lib/ember-cli/
|
39
|
+
- lib/ember-cli/app.rb
|
40
40
|
- lib/ember-cli/configuration.rb
|
41
41
|
- lib/ember-cli/helpers.rb
|
42
42
|
- lib/ember-cli/rack_server.rb
|
43
43
|
- lib/ember-cli/railtie.rb
|
44
|
+
- lib/ember-cli/rake_task.rb
|
44
45
|
- lib/ember-cli/version.rb
|
45
46
|
- lib/ember-cli/view_helpers.rb
|
46
47
|
- lib/generators/ember-cli/init/USAGE
|