flok 0.0.29 → 0.0.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flok/version.rb +1 -1
- data/spec/env/kern.rb +1 -1
- data/spec/etc/cli_spec.rb +113 -128
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 661e0b19172ad38ef6b674a5aa2d7c01e3ccb751
|
4
|
+
data.tar.gz: a80a48d481a2d2fcb12569e51aa51b8ab2c9756b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4a955b189a9287995e4c8d9cfc42a2fc7e9e07297c68f37fe0f6e665dd60f571e37caee341d97c5e0cedc8e9a358a21a73b6f0f28061ed244de8b84190cf11c
|
7
|
+
data.tar.gz: 9257c0090b03557b5d7ea2345c23aec9194715d3b79aaeb3f1a878d146f1da7ac7fc6193cf9cfb8b80a8f8fb7abc735f691c6d752b9f8d60bb45569dc4bd65ad
|
data/lib/flok/version.rb
CHANGED
data/spec/env/kern.rb
CHANGED
@@ -34,7 +34,7 @@ shared_context "kern" do
|
|
34
34
|
File.write './app/controllers/user_controller.rb', user_controllers_src
|
35
35
|
|
36
36
|
#Build
|
37
|
-
flok "build
|
37
|
+
flok "build" #Will generate drivers/ but we will ignore that
|
38
38
|
|
39
39
|
#Execute
|
40
40
|
@driver = FakeDriverContext.new
|
data/spec/etc/cli_spec.rb
CHANGED
@@ -41,11 +41,8 @@ RSpec.describe "CLI" do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it "Can be executed via bundle exec" do
|
44
|
-
|
45
|
-
|
46
|
-
flok_new do
|
47
|
-
flok "build"
|
48
|
-
end
|
44
|
+
flok_new do
|
45
|
+
flok "build"
|
49
46
|
end
|
50
47
|
end
|
51
48
|
|
@@ -67,31 +64,29 @@ it "Can create a new project with correct directories" do
|
|
67
64
|
end
|
68
65
|
|
69
66
|
it "Can build a project with every type of platform" do
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
expect(dirs).to include "drivers"
|
94
|
-
end
|
67
|
+
platform = ENV['PLATFORM']
|
68
|
+
flok_new do
|
69
|
+
#Build a new project
|
70
|
+
flok "build"
|
71
|
+
|
72
|
+
#Check it's products directory
|
73
|
+
expect(dirs).to include "products"
|
74
|
+
Dir.chdir "products" do
|
75
|
+
#Has a platform folder
|
76
|
+
expect(dirs).to include platform
|
77
|
+
Dir.chdir platform do
|
78
|
+
#Has an application_user.js file
|
79
|
+
expect(files).to include "application_user.js"
|
80
|
+
|
81
|
+
#The application_user.js contains both the glob/application.js and the glob/user_compiler.js
|
82
|
+
glob_application_js = File.read('glob/application.js')
|
83
|
+
glob_user_compiler_js = File.read('glob/user_compiler.js')
|
84
|
+
application_user_js = File.read('application_user.js')
|
85
|
+
expect(application_user_js).to include(glob_application_js)
|
86
|
+
expect(application_user_js).to include(glob_user_compiler_js)
|
87
|
+
|
88
|
+
#Contains the same files as the kernel in the drivers directory
|
89
|
+
expect(dirs).to include "drivers"
|
95
90
|
end
|
96
91
|
end
|
97
92
|
end
|
@@ -122,45 +117,41 @@ it "Can create a new project with correct directories" do
|
|
122
117
|
end
|
123
118
|
end
|
124
119
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
controller_rb = File.read('./spec/etc/user_compiler/controller0.rb')
|
120
|
+
platform = ENV['PLATFORM']
|
121
|
+
@platform = platform
|
122
|
+
controller_rb = File.read('./spec/etc/user_compiler/controller0.rb')
|
129
123
|
|
130
|
-
|
131
|
-
|
132
|
-
|
124
|
+
#The file with content should be longer when compiled into the flat application_user.js
|
125
|
+
len_with_content = compile_with_file "./spec/etc/user_compiler/controller0.rb"
|
126
|
+
len_no_content = compile_with_file
|
133
127
|
|
134
|
-
|
135
|
-
end
|
128
|
+
expect(len_no_content).to be < len_with_content
|
136
129
|
end
|
137
130
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
expect(dirs).to include "drivers"
|
163
|
-
end
|
131
|
+
include SpecHelpers
|
132
|
+
it "server does build project when first run" do
|
133
|
+
platform = ENV['PLATFORM']
|
134
|
+
flok_new do
|
135
|
+
#Now execute the command with a set of arguments
|
136
|
+
sh2("bundle exec flok server", /BUILD RAN/) do |inp, out|
|
137
|
+
#The server should always trigger a build on it's first run
|
138
|
+
expect(dirs).to include "products"
|
139
|
+
Dir.chdir "products" do
|
140
|
+
#Has a platform folder
|
141
|
+
expect(dirs).to include platform
|
142
|
+
Dir.chdir platform do
|
143
|
+
#Has an application_user.js file
|
144
|
+
expect(files).to include "application_user.js"
|
145
|
+
|
146
|
+
#The application_user.js contains both the glob/application.js and the glob/user_compiler.js
|
147
|
+
glob_application_js = File.read('glob/application.js')
|
148
|
+
glob_user_compiler_js = File.read('glob/user_compiler.js')
|
149
|
+
application_user_js = File.read('application_user.js')
|
150
|
+
expect(application_user_js).to include(glob_application_js)
|
151
|
+
expect(application_user_js).to include(glob_user_compiler_js)
|
152
|
+
|
153
|
+
#Contains the same files as the kernel in the drivers directory
|
154
|
+
expect(dirs).to include "drivers"
|
164
155
|
end
|
165
156
|
end
|
166
157
|
end
|
@@ -168,86 +159,80 @@ it "Can create a new project with correct directories" do
|
|
168
159
|
end
|
169
160
|
|
170
161
|
it "server does rebuild project when a file is added" do
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
}
|
186
|
-
end
|
162
|
+
platform = ENV['PLATFORM']
|
163
|
+
flok_new do
|
164
|
+
#Now execute the command with a set of arguments
|
165
|
+
sh2("bundle exec flok server", /BUILD RAN/) do |inp, out|
|
166
|
+
#Get the original build
|
167
|
+
application_user_js = File.read("products/#{platform}/application_user.js")
|
168
|
+
|
169
|
+
#Now add a file
|
170
|
+
File.write "./app/controllers/test2.rb", %{
|
171
|
+
controller "my_controller" do
|
172
|
+
view "my_controller"
|
173
|
+
action "my_action" do
|
174
|
+
on_entry %{
|
175
|
+
}
|
187
176
|
end
|
188
|
-
|
177
|
+
end
|
178
|
+
}
|
189
179
|
|
190
|
-
|
191
|
-
|
180
|
+
#Wait for a rebuild
|
181
|
+
expect(out).to readline_and_equal_x_within_y_seconds("BUILD RAN", 5.seconds)
|
192
182
|
|
193
|
-
|
194
|
-
|
183
|
+
#Get updated version
|
184
|
+
application_user_js2 = File.read("products/#{platform}/application_user.js")
|
195
185
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
end
|
186
|
+
#Make sure the compiled file is different and it's somewhat valid (length > 30)
|
187
|
+
expect(application_user_js2).not_to eq(application_user_js)
|
188
|
+
expect(application_user_js2.length).to be > 30 #Magic 30 to avoid any problems
|
200
189
|
end
|
201
190
|
end
|
202
191
|
end
|
203
192
|
|
204
193
|
it "server does host products on localhost:9992" do
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
expect(res).to eq(real_application_user_js)
|
217
|
-
end
|
194
|
+
platform = ENV['PLATFORM']
|
195
|
+
flok_new do
|
196
|
+
#Now execute the command with a set of arguments
|
197
|
+
sh2("bundle exec flok server", /BUILD RAN/) do |inp, out|
|
198
|
+
real_application_user_js = File.read("products/#{platform}/application_user.js")
|
199
|
+
|
200
|
+
#Grab the application_user.js file
|
201
|
+
res = wget "http://localhost:9992/application_user.js"
|
202
|
+
expect(res).not_to eq(nil)
|
203
|
+
expect(res.length).not_to eq(0)
|
204
|
+
expect(res).to eq(real_application_user_js)
|
218
205
|
end
|
219
206
|
end
|
220
207
|
end
|
221
208
|
|
222
209
|
it "server does host products on localhost:9992 and changes the products when the files change" do
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
}
|
238
|
-
end
|
210
|
+
platform = ENV['PLATFORM']
|
211
|
+
flok_new do
|
212
|
+
#Now execute the command with a set of arguments
|
213
|
+
sh2("bundle exec flok server", /BUILD RAN/) do |inp, out|
|
214
|
+
#Get the original
|
215
|
+
application_user_js = wget "http://localhost:9992/application_user.js"
|
216
|
+
|
217
|
+
#Now add a file
|
218
|
+
File.write "./app/controllers/test2.rb", %{
|
219
|
+
controller "my_controller" do
|
220
|
+
view "my_controller"
|
221
|
+
action "my_action" do
|
222
|
+
on_entry %{
|
223
|
+
}
|
239
224
|
end
|
240
|
-
|
241
|
-
|
242
|
-
|
225
|
+
end
|
226
|
+
}
|
227
|
+
#Wait for a rebuild
|
228
|
+
expect(out).to readline_and_equal_x_within_y_seconds("BUILD RAN", 5.seconds)
|
243
229
|
|
244
|
-
|
245
|
-
|
230
|
+
#Grab new version
|
231
|
+
application_user_js2 = wget "http://localhost:9992/application_user.js"
|
246
232
|
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
end
|
233
|
+
#Make sure the compiled file is different and it's longer
|
234
|
+
expect(application_user_js2.length).to be > application_user_js.length
|
235
|
+
expect(application_user_js2.length).to be > 30 #Make sure it's at least something
|
251
236
|
end
|
252
237
|
end
|
253
238
|
end
|