contao 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/contao/coffeescript_compiler.rb +15 -7
- data/lib/contao/compiler.rb +24 -0
- data/lib/contao/javascript_compiler.rb +17 -2
- data/lib/contao/stylesheet_compiler.rb +11 -0
- data/lib/contao/version.rb +1 -1
- data/lib/guard/assets.rb +40 -21
- data/spec/lib/contao/coffeescript_compiler_spec.rb +13 -6
- data/spec/lib/guard/assets_spec.rb +58 -83
- data/spec/support/compiler_shared_examples.rb +82 -0
- metadata +3 -3
@@ -11,20 +11,32 @@ module TechnoGate
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def clean
|
14
|
-
FileUtils.rm_rf
|
14
|
+
FileUtils.rm_rf output_path.to_s if File.exists?(output_path)
|
15
15
|
|
16
16
|
super
|
17
17
|
end
|
18
18
|
|
19
19
|
protected
|
20
20
|
|
21
|
+
def input_from_config_path
|
22
|
+
Application.config.javascripts_path
|
23
|
+
end
|
24
|
+
|
25
|
+
def output_from_config_path
|
26
|
+
Contao.expandify("tmp/compiled_javascript")
|
27
|
+
end
|
28
|
+
|
29
|
+
def compiler_name
|
30
|
+
:coffeescript
|
31
|
+
end
|
32
|
+
|
21
33
|
# Compile assets
|
22
34
|
#
|
23
35
|
# This method compiled coffeescripts from
|
24
36
|
# Application.config.javascripts_path into
|
25
37
|
# Contao.root.join('tmp/compiled_javascript')
|
26
38
|
def compile_assets
|
27
|
-
|
39
|
+
input_path.each do |src_path|
|
28
40
|
Dir["#{Contao.expandify(src_path)}/**/*.coffee"].sort.each do |file|
|
29
41
|
dest = compute_destination_filename(src_path, file)
|
30
42
|
FileUtils.mkdir_p File.dirname(dest)
|
@@ -36,15 +48,11 @@ module TechnoGate
|
|
36
48
|
end
|
37
49
|
|
38
50
|
def compute_destination_filename(src_path, file)
|
39
|
-
dest = "#{
|
51
|
+
dest = "#{output_path}/#{src_path.gsub('/', '_')}/"
|
40
52
|
dest << file.gsub(/.*#{Regexp.escape src_path}\//, '').gsub(/\.coffee$/, '')
|
41
53
|
dest << '.js' unless File.extname(dest) == '.js'
|
42
54
|
dest
|
43
55
|
end
|
44
|
-
|
45
|
-
def compiled_javascript_path
|
46
|
-
Contao.expandify("tmp/compiled_javascript")
|
47
|
-
end
|
48
56
|
end
|
49
57
|
end
|
50
58
|
end
|
data/lib/contao/compiler.rb
CHANGED
@@ -39,6 +39,30 @@ module TechnoGate
|
|
39
39
|
Contao.expandify(Contao::Application.config.assets_public_path)
|
40
40
|
end
|
41
41
|
|
42
|
+
def input_from_config_path
|
43
|
+
raise "Child class must define this"
|
44
|
+
end
|
45
|
+
|
46
|
+
def input_from_options
|
47
|
+
@options[:input][compiler_name] rescue nil
|
48
|
+
end
|
49
|
+
|
50
|
+
def input_path
|
51
|
+
input_from_options || input_from_config_path
|
52
|
+
end
|
53
|
+
|
54
|
+
def output_from_config_path
|
55
|
+
raise "Child class must define this"
|
56
|
+
end
|
57
|
+
|
58
|
+
def output_from_options
|
59
|
+
@options[:output][compiler_name] rescue nil
|
60
|
+
end
|
61
|
+
|
62
|
+
def output_path
|
63
|
+
output_from_options || output_from_config_path
|
64
|
+
end
|
65
|
+
|
42
66
|
# Prepare folders
|
43
67
|
def prepare_folders
|
44
68
|
FileUtils.mkdir_p assets_public_path
|
@@ -12,6 +12,18 @@ module TechnoGate
|
|
12
12
|
|
13
13
|
protected
|
14
14
|
|
15
|
+
def compiler_name
|
16
|
+
:javascript
|
17
|
+
end
|
18
|
+
|
19
|
+
def input_from_config_path
|
20
|
+
Application.config.javascripts_path
|
21
|
+
end
|
22
|
+
|
23
|
+
def output_from_config_path
|
24
|
+
Contao.expandify(Application.config.assets_public_path)
|
25
|
+
end
|
26
|
+
|
15
27
|
# Compile assets
|
16
28
|
#
|
17
29
|
# This method compiles javascripts from
|
@@ -39,8 +51,11 @@ module TechnoGate
|
|
39
51
|
FileUtils.mv tmp_app_js, application_js_path
|
40
52
|
end
|
41
53
|
|
54
|
+
# Generate source folders give the exact source and the folder
|
55
|
+
# under tmp/compiled_javascript on which CoffeeScript compiler
|
56
|
+
# adds javascript files to.
|
42
57
|
def javascripts_path
|
43
|
-
|
58
|
+
input_path.map do |path|
|
44
59
|
["tmp/compiled_javascript/#{path.gsub('/', '_')}", path]
|
45
60
|
end.flatten
|
46
61
|
end
|
@@ -51,7 +66,7 @@ module TechnoGate
|
|
51
66
|
end
|
52
67
|
|
53
68
|
def application_js_path
|
54
|
-
|
69
|
+
Pathname(output_from_config_path).join("application.js")
|
55
70
|
end
|
56
71
|
|
57
72
|
def generate_manifest
|
@@ -22,6 +22,17 @@ module TechnoGate
|
|
22
22
|
end
|
23
23
|
|
24
24
|
protected
|
25
|
+
def compiler_name
|
26
|
+
:stylesheet
|
27
|
+
end
|
28
|
+
|
29
|
+
# This class can't be told where to get assets from or where to compile to
|
30
|
+
# unless I figure out how to configure the UpdateProject without a file
|
31
|
+
def input_from_config_path
|
32
|
+
end
|
33
|
+
def output_from_config_path
|
34
|
+
end
|
35
|
+
|
25
36
|
def compile_assets
|
26
37
|
@updater ||= Compass::Commands::UpdateProject.new(
|
27
38
|
Contao.root,
|
data/lib/contao/version.rb
CHANGED
data/lib/guard/assets.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'guard'
|
2
2
|
require 'guard/guard'
|
3
|
+
require 'active_support/core_ext/string/inflections'
|
4
|
+
require 'active_support/core_ext/object/try'
|
3
5
|
|
4
6
|
module Guard
|
5
7
|
class Assets < ::Guard::Guard
|
@@ -9,9 +11,8 @@ module Guard
|
|
9
11
|
def initialize(watchers = [], options = {})
|
10
12
|
super
|
11
13
|
|
12
|
-
@
|
13
|
-
@
|
14
|
-
@stylesheet_compiler = ::TechnoGate::Contao::StylesheetCompiler.new
|
14
|
+
@options = options
|
15
|
+
@compilers = instantiate_compilers
|
15
16
|
end
|
16
17
|
|
17
18
|
# Call once when Guard starts. Please override initialize method to init stuff.
|
@@ -24,12 +25,11 @@ module Guard
|
|
24
25
|
# This method should be principally used for long action like running all specs/tests/...
|
25
26
|
# @raise [:task_has_failed] when run_all has failed
|
26
27
|
def run_all
|
27
|
-
@
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
compile_javascript
|
28
|
+
@compilers.each do |compiler|
|
29
|
+
compiler.clean
|
30
|
+
end
|
31
|
+
|
32
|
+
call_compilers
|
33
33
|
end
|
34
34
|
|
35
35
|
# Called on file(s) modifications that the Guard watches.
|
@@ -47,6 +47,28 @@ module Guard
|
|
47
47
|
end
|
48
48
|
|
49
49
|
protected
|
50
|
+
def instantiate_compilers
|
51
|
+
@options.merge!(compilers: [:stylesheet, :coffeescript, :javascript]) unless @options[:compilers]
|
52
|
+
|
53
|
+
sort_compilers(@options[:compilers]).map(&:to_s).map do |compiler|
|
54
|
+
self.instance_variable_set(
|
55
|
+
"@#{compiler}_compiler",
|
56
|
+
"::TechnoGate::Contao::#{compiler.camelize}Compiler".constantize.new(@options)
|
57
|
+
)
|
58
|
+
|
59
|
+
self.instance_variable_get "@#{compiler}_compiler"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def sort_compilers(unsorted_compilers)
|
64
|
+
compilers = []
|
65
|
+
compilers << :stylesheet if unsorted_compilers.include? :stylesheet
|
66
|
+
compilers << :coffeescript if unsorted_compilers.include? :coffeescript
|
67
|
+
compilers << :javascript if unsorted_compilers.include? :javascript
|
68
|
+
|
69
|
+
compilers
|
70
|
+
end
|
71
|
+
|
50
72
|
def compile(paths)
|
51
73
|
coffeescript = javascript = stylesheet = false
|
52
74
|
|
@@ -56,21 +78,18 @@ module Guard
|
|
56
78
|
stylesheet = true if !stylesheet && is_stylesheet?(path)
|
57
79
|
end
|
58
80
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
81
|
+
compilers = @compilers.clone
|
82
|
+
compilers.delete(:stylesheet) unless stylesheet
|
83
|
+
compilers.delete(:javascript) unless javascript
|
84
|
+
compilers.delete(:coffeescript) unless coffeescript
|
63
85
|
|
64
|
-
|
65
|
-
@stylesheet_compiler.compile
|
86
|
+
call_compilers compilers
|
66
87
|
end
|
67
88
|
|
68
|
-
def
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
def compile_javascript
|
73
|
-
@javascript_compiler.compile
|
89
|
+
def call_compilers(compilers = @compilers)
|
90
|
+
compilers.each do |compiler|
|
91
|
+
compiler.compile
|
92
|
+
end
|
74
93
|
end
|
75
94
|
|
76
95
|
def is_coffeescript?(path)
|
@@ -23,12 +23,7 @@ module TechnoGate
|
|
23
23
|
'/root/my_awesome_project/vendor/assets/javascripts/simple_coffeescript_file.js.coffee',
|
24
24
|
].each do |file|
|
25
25
|
FileUtils.mkdir_p File.dirname(file)
|
26
|
-
File.open(file, 'w')
|
27
|
-
f.write file.
|
28
|
-
gsub('/root/my_awesome_project/app/assets/javascripts/', '').
|
29
|
-
gsub('/root/my_awesome_project/lib/assets/javascripts/', '').
|
30
|
-
gsub('/root/my_awesome_project/vendor/assets/javascripts/', '')
|
31
|
-
end
|
26
|
+
File.open(file, 'w') { |f| f.write "Asset File" }
|
32
27
|
end
|
33
28
|
end
|
34
29
|
|
@@ -41,6 +36,18 @@ module TechnoGate
|
|
41
36
|
File.exists?('/root/my_awesome_project/tmp/compiled_javascript/app_assets_javascripts/simple_javascript_file').should be_false
|
42
37
|
File.exists?('/root/my_awesome_project/tmp/compiled_javascript/app_assets_javascripts/nested/script.js').should be_true
|
43
38
|
end
|
39
|
+
|
40
|
+
it "should compile given a different output path" do
|
41
|
+
subject.should_receive(:output_from_options).at_least(:once).and_return('/root/wat')
|
42
|
+
|
43
|
+
subject.send :compile_assets
|
44
|
+
|
45
|
+
File.exists?('/root/wat/app_assets_javascripts/simple_coffeescript_file.js').should be_true
|
46
|
+
File.exists?('/root/wat/lib_assets_javascripts/simple_coffeescript_file.js').should be_true
|
47
|
+
File.exists?('/root/wat/vendor_assets_javascripts/simple_coffeescript_file.js').should be_true
|
48
|
+
File.exists?('/root/wat/app_assets_javascripts/simple_javascript_file').should be_false
|
49
|
+
File.exists?('/root/wat/app_assets_javascripts/nested/script.js').should be_true
|
50
|
+
end
|
44
51
|
end
|
45
52
|
|
46
53
|
describe "#compute_destination_filename" do
|
@@ -2,25 +2,61 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Guard
|
4
4
|
describe Assets do
|
5
|
+
before :each do
|
6
|
+
@stylesheet_compiler = mock('stylesheet_compiler', clean: true, compile: true)
|
7
|
+
@coffeescript_compiler = mock('coffeescript_compiler', clean: true, compile: true)
|
8
|
+
@javascript_compiler = mock('javascript_compiler', clean: true, compile: true)
|
9
|
+
@compilers =
|
10
|
+
[@stylesheet_compiler, @coffeescript_compiler, @javascript_compiler]
|
11
|
+
|
12
|
+
subject.instance_variable_set :@stylesheet_compiler, @stylesheet_compiler
|
13
|
+
subject.instance_variable_set :@coffeescript_compiler, @coffeescript_compiler
|
14
|
+
subject.instance_variable_set :@javascript_compiler, @javascript_compiler
|
15
|
+
subject.instance_variable_set :@compilers, @compilers
|
16
|
+
end
|
17
|
+
|
5
18
|
it "should inherit from Guard" do
|
6
19
|
subject.class.superclass.should == ::Guard::Guard
|
7
20
|
end
|
8
21
|
|
9
22
|
describe '#init' do
|
23
|
+
before :each do
|
24
|
+
@assets = Assets.new
|
25
|
+
end
|
26
|
+
|
10
27
|
it "should create @coffeescript_compiler" do
|
11
|
-
|
28
|
+
@assets.instance_variable_get(:@coffeescript_compiler).
|
12
29
|
should be_instance_of TechnoGate::Contao::CoffeescriptCompiler
|
13
30
|
end
|
14
31
|
|
15
32
|
it "should create @javascript_compiler" do
|
16
|
-
|
33
|
+
@assets.instance_variable_get(:@javascript_compiler).
|
17
34
|
should be_instance_of TechnoGate::Contao::JavascriptCompiler
|
18
35
|
end
|
19
36
|
|
20
37
|
it "should create @stylesheet_compiler" do
|
21
|
-
|
38
|
+
@assets.instance_variable_get(:@stylesheet_compiler).
|
22
39
|
should be_instance_of TechnoGate::Contao::StylesheetCompiler
|
23
40
|
end
|
41
|
+
|
42
|
+
it "should create @compilers with a specific order with compilers specified" do
|
43
|
+
@assets = Assets.new([], compilers: [:javascript, :coffeescript, :stylesheet])
|
44
|
+
@assets.instance_variable_get(:@compilers).size.should == 3
|
45
|
+
@assets.instance_variable_get(:@compilers).should == [
|
46
|
+
@assets.instance_variable_get(:@stylesheet_compiler),
|
47
|
+
@assets.instance_variable_get(:@coffeescript_compiler),
|
48
|
+
@assets.instance_variable_get(:@javascript_compiler),
|
49
|
+
]
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should create @compilers with a specific order" do
|
53
|
+
subject.instance_variable_get(:@compilers).size.should == 3
|
54
|
+
subject.instance_variable_get(:@compilers).should == [
|
55
|
+
subject.instance_variable_get(:@stylesheet_compiler),
|
56
|
+
subject.instance_variable_get(:@coffeescript_compiler),
|
57
|
+
subject.instance_variable_get(:@javascript_compiler),
|
58
|
+
]
|
59
|
+
end
|
24
60
|
end
|
25
61
|
|
26
62
|
describe "#start" do
|
@@ -38,20 +74,6 @@ module Guard
|
|
38
74
|
end
|
39
75
|
|
40
76
|
describe '#run_all' do
|
41
|
-
before :each do
|
42
|
-
@stylesheet_compiler = mock('stylesheet_compiler', clean: true)
|
43
|
-
@coffeescript_compiler = mock('coffeescript_compiler', clean: true)
|
44
|
-
@javascript_compiler = mock('javascript_compiler', clean: true)
|
45
|
-
|
46
|
-
subject.instance_variable_set(:@stylesheet_compiler, @stylesheet_compiler)
|
47
|
-
subject.instance_variable_set(:@coffeescript_compiler, @coffeescript_compiler)
|
48
|
-
subject.instance_variable_set(:@javascript_compiler, @javascript_compiler)
|
49
|
-
|
50
|
-
subject.stub(:compile_stylesheet)
|
51
|
-
subject.stub(:compile_coffeescript)
|
52
|
-
subject.stub(:compile_javascript)
|
53
|
-
end
|
54
|
-
|
55
77
|
it {should respond_to :run_all}
|
56
78
|
|
57
79
|
it "Should clean assets" do
|
@@ -63,9 +85,9 @@ module Guard
|
|
63
85
|
end
|
64
86
|
|
65
87
|
it "Should recompile assets" do
|
66
|
-
|
67
|
-
|
68
|
-
|
88
|
+
@stylesheet_compiler.should_receive(:compile).once.ordered
|
89
|
+
@coffeescript_compiler.should_receive(:compile).once.ordered
|
90
|
+
@javascript_compiler.should_receive(:compile).once.ordered
|
69
91
|
|
70
92
|
subject.run_all
|
71
93
|
end
|
@@ -99,104 +121,57 @@ module Guard
|
|
99
121
|
end
|
100
122
|
end
|
101
123
|
|
102
|
-
describe '#compile_stylesheet' do
|
103
|
-
before :each do
|
104
|
-
@stylesheet_compiler = mock('stylesheet_compiler', clean: true)
|
105
|
-
|
106
|
-
subject.instance_variable_set(:@stylesheet_compiler, @stylesheet_compiler)
|
107
|
-
end
|
108
|
-
|
109
|
-
it {should respond_to :compile_stylesheet}
|
110
|
-
|
111
|
-
it "should call @stylesheet_compiler.compile" do
|
112
|
-
@stylesheet_compiler.should_receive(:compile).once
|
113
|
-
|
114
|
-
subject.send :compile_stylesheet
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
describe '#compile_coffeescript' do
|
119
|
-
before :each do
|
120
|
-
@coffeescript_compiler = mock('coffeescript_compiler', clean: true, compile: true)
|
121
|
-
|
122
|
-
subject.instance_variable_set(:@coffeescript_compiler, @coffeescript_compiler)
|
123
|
-
|
124
|
-
subject.stub :compile_javascript
|
125
|
-
end
|
126
|
-
|
127
|
-
it {should respond_to :compile_coffeescript}
|
128
|
-
|
129
|
-
it "should call @coffeescript_compiler.compile" do
|
130
|
-
@coffeescript_compiler.should_receive(:compile).once
|
131
|
-
|
132
|
-
subject.send :compile_coffeescript
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
describe '#compile_javascript' do
|
137
|
-
before :each do
|
138
|
-
@javascript_compiler = mock('javascript_compiler', clean: true)
|
139
|
-
|
140
|
-
subject.instance_variable_set(:@javascript_compiler, @javascript_compiler)
|
141
|
-
end
|
142
|
-
|
143
|
-
it {should respond_to :compile_javascript}
|
144
|
-
|
145
|
-
it "should call @javascript_compiler.compile" do
|
146
|
-
@javascript_compiler.should_receive(:compile).once
|
147
|
-
|
148
|
-
subject.send :compile_javascript
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
124
|
describe '#compile' do
|
153
|
-
before :each do
|
154
|
-
subject.stub :compile_stylesheet
|
155
|
-
subject.stub :compile_coffeescript
|
156
|
-
subject.stub :compile_javascript
|
157
|
-
end
|
158
|
-
|
159
125
|
it "should call compile_stylesheet only if some stylesheet paths has changed" do
|
160
|
-
|
126
|
+
@stylesheet_compiler.should_receive(:compile).once
|
161
127
|
|
162
128
|
subject.send :compile, ["app/assets/stylesheets/file.css"]
|
163
129
|
end
|
164
130
|
|
165
131
|
it "should call compile_coffeescript only if some coffeescript paths has changed" do
|
166
|
-
|
132
|
+
@coffeescript_compiler.should_receive(:compile).once
|
167
133
|
|
168
134
|
subject.send :compile, ["app/assets/javascripts/file.js.coffee"]
|
169
135
|
end
|
170
136
|
|
171
137
|
it "should call compile_javascript only if some javascript paths has changed" do
|
172
|
-
|
138
|
+
@javascript_compiler.should_receive(:compile).once
|
173
139
|
|
174
140
|
subject.send :compile, ["app/assets/javascripts/file.js"]
|
175
141
|
end
|
176
142
|
|
177
143
|
it "should compile stylesheets only once" do
|
178
|
-
|
144
|
+
@stylesheet_compiler.should_receive(:compile).once
|
179
145
|
|
180
146
|
subject.send :compile, ["app/assets/stylesheets/file.css", "app/assets/stylesheets/file2.css"]
|
181
147
|
end
|
182
148
|
|
183
149
|
it "should compile coffeescripts only once" do
|
184
|
-
|
150
|
+
@coffeescript_compiler.should_receive(:compile).once
|
185
151
|
|
186
152
|
subject.send :compile, ["app/assets/javascripts/file.js.coffee", "app/assets/javascripts/file2.js.coffee"]
|
187
153
|
end
|
188
154
|
|
189
155
|
it "should compile javascripts only once" do
|
190
|
-
|
156
|
+
@javascript_compiler.should_receive(:compile).once
|
191
157
|
|
192
158
|
subject.send :compile, ["app/assets/javascripts/file.js", "app/assets/javascripts/file2.js"]
|
193
159
|
end
|
194
160
|
|
195
161
|
it "should compile javascript if coffeescript was used" do
|
196
|
-
|
162
|
+
@coffeescript_compiler.should_receive(:compile).once
|
163
|
+
@javascript_compiler.should_receive(:compile).once
|
197
164
|
|
198
165
|
subject.send :compile, ["app/assets/javascripts/file.js.coffee"]
|
199
166
|
end
|
167
|
+
|
168
|
+
it "should not try to compile javascript if compiler not available even if path is a js" do
|
169
|
+
@compilers = [@stylesheet_compiler, @coffeescript_compiler]
|
170
|
+
subject.instance_variable_set :@compilers, @compilers
|
171
|
+
@javascript_compiler.should_not_receive(:compile)
|
172
|
+
|
173
|
+
subject.send :compile, ["app/assets/javascripts/file.js"]
|
174
|
+
end
|
200
175
|
end
|
201
176
|
|
202
177
|
describe "#file_in_path?" do
|
@@ -73,6 +73,88 @@ shared_examples_for "Compiler" do
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
+
describe '#input_from_config_path' do
|
77
|
+
it {should respond_to :input_from_config_path}
|
78
|
+
end
|
79
|
+
|
80
|
+
describe '#output_from_config_path' do
|
81
|
+
it {should respond_to :output_from_config_path}
|
82
|
+
end
|
83
|
+
|
84
|
+
describe '#input_from_options' do
|
85
|
+
it {should respond_to :input_from_options}
|
86
|
+
end
|
87
|
+
|
88
|
+
describe '#output_from_options' do
|
89
|
+
it {should respond_to :output_from_options}
|
90
|
+
end
|
91
|
+
|
92
|
+
describe '#input_path' do
|
93
|
+
it {should respond_to :input_path}
|
94
|
+
|
95
|
+
it "should return whatever in input_from_config_path" do
|
96
|
+
mock('input').tap do |path|
|
97
|
+
subject.stub(:input_from_config_path).and_return path
|
98
|
+
|
99
|
+
subject.send(:input_path).should == path
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should return whatever in input_from_options" do
|
104
|
+
mock('input').tap do |path|
|
105
|
+
subject.stub(:input_from_options).and_return path
|
106
|
+
|
107
|
+
subject.send(:input_path).should == path
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should prefer options over config" do
|
112
|
+
{options: mock('options'), config: mock('config')}.tap do |mocks|
|
113
|
+
subject.stub(:input_from_config_path).and_return mocks[:config]
|
114
|
+
subject.stub(:input_from_options).and_return mocks[:options]
|
115
|
+
|
116
|
+
subject.send(:input_path).should == mocks[:options]
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe '#output_path' do
|
122
|
+
it {should respond_to :output_path}
|
123
|
+
|
124
|
+
it "should return whatever in output_from_config_path" do
|
125
|
+
mock('output').tap do |path|
|
126
|
+
subject.stub(:output_from_config_path).and_return path
|
127
|
+
|
128
|
+
subject.send(:output_path).should == path
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should return whatever in output_from_options" do
|
133
|
+
mock('output').tap do |path|
|
134
|
+
subject.stub(:output_from_options).and_return path
|
135
|
+
|
136
|
+
subject.send(:output_path).should == path
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
it "should prefer options over config" do
|
141
|
+
{options: mock('options'), config: mock('config')}.tap do |mocks|
|
142
|
+
subject.stub(:output_from_config_path).and_return mocks[:config]
|
143
|
+
subject.stub(:output_from_options).and_return mocks[:options]
|
144
|
+
|
145
|
+
subject.send(:output_path).should == mocks[:options]
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
describe "#compiler_name" do
|
151
|
+
it {should respond_to :compiler_name}
|
152
|
+
|
153
|
+
it "should not be empty" do
|
154
|
+
subject.send(:compiler_name).should_not be_empty
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
76
158
|
describe "#prepare_folders", :fakefs do
|
77
159
|
it {should respond_to :prepare_folders}
|
78
160
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contao
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -281,7 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
281
281
|
version: '0'
|
282
282
|
segments:
|
283
283
|
- 0
|
284
|
-
hash:
|
284
|
+
hash: 2585699756949260143
|
285
285
|
requirements: []
|
286
286
|
rubyforge_project:
|
287
287
|
rubygems_version: 1.8.24
|