trackman 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/railtie.rb +4 -8
- data/lib/trackman/version.rb +1 -1
- data/spec/sync_spec.rb +23 -0
- metadata +1 -1
data/README.md
CHANGED
@@ -14,7 +14,7 @@ Works out of the box for Ruby(1.8.7 and 1.9.3) on
|
|
14
14
|
* Deploy the changes and boot your app.
|
15
15
|
|
16
16
|
### Need to change your layout or assets?
|
17
|
-
Simply edit your static pages, link different assets, go crazy!
|
17
|
+
Simply edit your static pages, link different assets, go crazy!
|
18
18
|
Trackman will sync upon application boot on your next deployment.
|
19
19
|
|
20
20
|
### Conventions
|
data/lib/railtie.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
#Bundler.require
|
2
|
-
|
3
1
|
if defined?(Rails)
|
4
|
-
if ::Rails::VERSION::STRING =~ /^2\.[1-9]/
|
2
|
+
if ::Rails::VERSION::STRING =~ /^2\.[1-9]/
|
5
3
|
module Trackman
|
6
4
|
class RackMiddleware
|
7
5
|
def initialize(app)
|
@@ -24,11 +22,9 @@ if defined?(Rails)
|
|
24
22
|
Dir[File.join(File.dirname(__FILE__),'../rails_generators/trackman_tasks/templates/*.rake')].each { |f| load f }
|
25
23
|
end
|
26
24
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
Trackman::Assets::Asset.autosync
|
31
|
-
end
|
25
|
+
initializer "trackman.hook" do |app|
|
26
|
+
app.config.after_initialize do
|
27
|
+
Trackman::Assets::Asset.autosync
|
32
28
|
end
|
33
29
|
end
|
34
30
|
end
|
data/lib/trackman/version.rb
CHANGED
data/spec/sync_spec.rb
CHANGED
@@ -78,4 +78,27 @@ describe Trackman::Assets::Asset do
|
|
78
78
|
|
79
79
|
lambda { result = MyTestAsset.autosync }.should_not raise_error
|
80
80
|
end
|
81
|
+
|
82
|
+
it "syncs if the env is not development or test" do
|
83
|
+
class Rails
|
84
|
+
def self.env
|
85
|
+
Env.new
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
class Env
|
90
|
+
def production?
|
91
|
+
false
|
92
|
+
end
|
93
|
+
def development?
|
94
|
+
false
|
95
|
+
end
|
96
|
+
def test?
|
97
|
+
false
|
98
|
+
end
|
99
|
+
end
|
100
|
+
MyTestAsset.should_receive(:sync)
|
101
|
+
|
102
|
+
MyTestAsset.autosync
|
103
|
+
end
|
81
104
|
end
|