atome 0.5.5.6.4 → 0.5.5.6.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,278 +0,0 @@
1
- # # frozen_string_literal: true
2
- #
3
- # # FIXME: check when creating gem version the new gem is not always fully updated we have to type gem uninstall first
4
- #
5
- # require 'opal'
6
- # require 'parser'
7
- # require 'uglifier'
8
- #
9
- #
10
- # Opal.append_path 'app'
11
- #
12
- # # def build_opal_content
13
- # # Opal::Builder.build('../lib/platform_specific/opal/opal.rb').to_s
14
- # # end
15
- # #
16
- # # def build_opal(user_project_path)
17
- # #
18
- # # opal_directory = "#{user_project_path}/src/js/opal"
19
- # # opal_js = "#{opal_directory}/opal.js"
20
- # # Dir.mkdir(opal_directory) unless File.directory?(opal_directory)
21
- # #
22
- # # File.new opal_js, 'w'
23
- # # opal_content = build_opal_content
24
- # # File.open(opal_js, 'w') do |f|
25
- # # f.puts opal_content
26
- # # end
27
- # # end
28
- #
29
- # # def build_aui_for_opal(user_project_path)
30
- # # # now we add an uniq aui to the app
31
- # # aui_js = "#{user_project_path}/src/js/aui.js"
32
- # # File.new aui_js, 'w'
33
- # # builder = Opal::Builder.new
34
- # # aui_content = builder.build("#{user_project_path}/src/utilities/aui.rb").to_s
35
- # # File.open(aui_js, 'w') do |f|
36
- # # f.puts aui_content
37
- # # end
38
- # # end
39
- #
40
- # # def build_host_mode_for_opal(user_project_path)
41
- # # host_mode_js = "#{user_project_path}/src/js/host_mode.js"
42
- # # File.new host_mode_js, 'w'
43
- # # builder = Opal::Builder.new
44
- # # host_mode_content = builder.build("#{user_project_path}/src/utilities/host_mode.rb").to_s
45
- # # File.open(host_mode_js, 'w') do |f|
46
- # # f.puts host_mode_content
47
- # # end
48
- # # end
49
- #
50
- # # def copy_assets_files(user_project_path, gem_location)
51
- # # server_location = "#{gem_location}/../vendor/assets/server/"
52
- # # FileUtils.copy_entry server_location, "#{user_project_path}/server", preserve: nil
53
- # # css_location ="#{gem_location}/../vendor/assets/src/css/"
54
- # # FileUtils.copy_entry css_location, "#{user_project_path}/src/css", preserve: nil
55
- # # js_location ="#{gem_location}/../vendor/assets/src/js/"
56
- # # FileUtils.copy_entry js_location, "#{user_project_path}/src/js", preserve: nil
57
- # # index_location ="#{gem_location}/../vendor/assets/src/index.html"
58
- # # FileUtils.copy_entry index_location, "#{user_project_path}/src/index.html", preserve: nil
59
- # # end
60
- #
61
- # # def build_atome_kernel(user_project_path, gem_location)
62
- # # # now lets build the atome kernel
63
- # # atome_directory = "#{user_project_path}/src/js/atome"
64
- # # Dir.mkdir(atome_directory) unless File.directory?(atome_directory)
65
- # # kernel_js = "#{atome_directory}/kernel.js"
66
- # # File.new kernel_js, 'w'
67
- # # builder = Opal::Builder.new
68
- # # builder.append_paths("#{gem_location}/../lib/")
69
- # # kernel_content = builder.build("#{gem_location}/../lib/atome.rb").to_s
70
- # # File.open(kernel_js, 'w') do |f|
71
- # # f.puts kernel_content
72
- # # end
73
- # # end
74
- #
75
- # def build_opal_extensions(user_project_path, gem_location)
76
- # opal_directory = "#{user_project_path}/src/js/opal"
77
- # extensions_js = "#{opal_directory}/atome_opal_extensions.js"
78
- # File.new extensions_js, 'w'
79
- # builder = Opal::Builder.new
80
- # builder.append_paths("#{gem_location}/../lib/platform_specific/opal/")
81
- # extensions_content = builder.build("#{gem_location}/../lib/platform_specific/opal/atome_opal_extensions.rb").to_s
82
- # File.open(extensions_js, 'w') do |f|
83
- # f.puts extensions_content
84
- # end
85
- # end
86
- #
87
- # # def build_opal_parser(user_project_path)
88
- # # parser_js = "#{user_project_path}/src/js/opal/opal_parser.js"
89
- # # File.new parser_js, 'w'
90
- # # parser_content = Opal::Builder.build('../lib/platform_specific/opal/opal_parser.rb').to_s
91
- # # File.open(parser_js, 'w') do |f|
92
- # # f.puts parser_content
93
- # # end
94
- # # end
95
- #
96
- # def modify_and_copy_file(source_path, destination_path,source_code)
97
- # file_content = File.read(source_path)
98
- # modified_content = file_content.gsub(' ', ' ').gsub(' ', ' ').gsub(' ', ' ').gsub(' ', ' ').gsub("require './", "require 'tmp/opal/").gsub('require "./', 'require "tmp/opal/')
99
- # File.write(destination_path, modified_content)
100
- #
101
- # end
102
- # def process_directory(source_dir, destination_dir, source_code)
103
- # Dir.entries(source_dir).each do |entry|
104
- # next if entry == '.' || entry == '..'
105
- #
106
- # source_path = File.join(source_dir, entry)
107
- # destination_path = File.join(destination_dir, entry)
108
- #
109
- # if File.directory?(source_path)
110
- # Dir.mkdir(destination_path) unless Dir.exist?(destination_path)
111
- # process_directory(source_path, destination_path,source_code)
112
- # elsif File.file?(source_path)
113
- # modify_and_copy_file(source_path, destination_path,source_code)
114
- # end
115
- # end
116
- # end
117
- # def build_user_code(user_project_path, source_code)
118
- # application_js = "#{user_project_path}/src/js/application.js"
119
- # builder = Opal::Builder.new
120
- # builder.append_paths("#{user_project_path}/")
121
- # source_directory = "#{source_code}/application"
122
- # destination_directory = "#{source_code}/tmp/opal"
123
- # process_directory(source_directory, destination_directory, source_code)
124
- # application_content = builder.build("#{source_code}/tmp/opal/index.rb").to_s
125
- # File.open(application_js, 'w') do |f|
126
- # f.puts application_content
127
- # end
128
- # end
129
- #
130
- # def build_system_infos(user_project_path, source_code)
131
- # system_infos_js = "#{user_project_path}/src/js/infos.js"
132
- # builder = Opal::Builder.new
133
- # builder.append_paths("#{user_project_path}/")
134
- # # system_infos = builder.build("#{source_code}/src/utilities/mode.rb").to_s
135
- # File.open(system_infos_js, 'w') do |f|
136
- # f.puts system_infos
137
- # end
138
- # end
139
- #
140
- # def minimize_aui(user_project_path)
141
- # aui_js = "#{user_project_path}/src/js/aui.js"
142
- # aui_content = File.open(aui_js).read
143
- # aui_content = Uglifier.new.compile(aui_content)
144
- # File.open(aui_js, 'w') do |f|
145
- # f.puts aui_content
146
- # end
147
- # end
148
- #
149
- # def minimize_opal(user_project_path)
150
- # opal_js = "#{user_project_path}/src/js/opal/opal.js"
151
- # opal_content = File.open(opal_js).read
152
- # opal_content = Uglifier.new.compile(opal_content)
153
- # File.open(opal_js, 'w') do |f|
154
- # f.puts opal_content
155
- # end
156
- # end
157
- #
158
- # def minimize_parser(user_project_path)
159
- # parser_js = "#{user_project_path}/src/js/opal/opal_parser.js"
160
- # parser_content = File.open(parser_js).read
161
- # parser_content = Uglifier.new.compile(parser_content)
162
- # File.open(parser_js, 'w') do |f|
163
- # f.puts parser_content
164
- # end
165
- # end
166
- #
167
- # def minimize_kernel(user_project_path)
168
- # kernel_js = "#{user_project_path}/src/js/atome/kernel.js"
169
- # kernel_content = File.open(kernel_js).read
170
- # kernel_content = Uglifier.new.compile(kernel_content)
171
- # File.open(kernel_js, 'w') do |f|
172
- # f.puts kernel_content
173
- # end
174
- # end
175
- #
176
- # def minimize_atome(user_project_path)
177
- # atome_js = "#{user_project_path}/src/js/atome/atome.js"
178
- # atome_content = File.open(atome_js).read
179
- # atome_content = Uglifier.new.compile(atome_content)
180
- # File.open(atome_js, 'w') do |f|
181
- # f.puts atome_content
182
- # end
183
- # end
184
- #
185
- # def minimize_opal_extensions(user_project_path)
186
- # atome_opal_extensions_js = "#{user_project_path}/src/js/opal/atome_opal_extensions.js"
187
- # atome_opal_extensions_content = File.open(atome_opal_extensions_js).read
188
- # atome_opal_extensions_content = Uglifier.new.compile(atome_opal_extensions_content)
189
- # File.open(atome_opal_extensions_js, 'w') do |f|
190
- # f.puts atome_opal_extensions_content
191
- # end
192
- # end
193
- #
194
- # def minimize_libraries(user_project_path)
195
- # # minimizing aui
196
- # minimize_aui(user_project_path)
197
- # # minimizing opal
198
- # minimize_opal(user_project_path)
199
- # # # minimizing opal_browser
200
- # # minimize_browser(user_project_path)
201
- # # minimizing opal_parser
202
- # minimize_parser(user_project_path)
203
- # # minimizing atome_lib
204
- # minimize_kernel(user_project_path)
205
- # # minimizing atome
206
- # minimize_atome(user_project_path)
207
- # # minimizing atome_lib
208
- # minimize_opal_extensions(user_project_path)
209
- # # minimizing application
210
- # minimize_application(user_project_path)
211
- # # minimize(user_project_path) if production == 'production'
212
- # end
213
- #
214
- # def minimize_application(user_project_path)
215
- # # minimizing user codes
216
- # application_js = "#{user_project_path}/src/js/application.js"
217
- # application_content = File.open(application_js).read
218
- # application_content = Uglifier.new.compile(application_content)
219
- # File.open(application_js, 'w') do |f|
220
- # f.puts application_content
221
- # end
222
- # end
223
- #
224
- # task :build_user_code, :user_project_path, :production do |_t, args|
225
- # user_project_path = args[:user_project_path]
226
- # source_code = "#{user_project_path}"
227
- # build_system_infos(user_project_path, source_code)
228
- # build_user_code(user_project_path, source_code)
229
- # end
230
- #
231
- # task :system_builder, :user_project_path, :production do |_t, args|
232
- # user_project_path = args[:user_project_path]
233
- # production = args[:production]
234
- # source_code = '../vendor/assets'
235
- # build_common_libraries(user_project_path, production)
236
- # build_system_infos(user_project_path, source_code)
237
- # build_user_code(user_project_path, source_code)
238
- #
239
- # # TODO: catch and message to user when when there's no force and folder already exist
240
- # end
241
- #
242
- # task :system_updater, :user_project_path, :production do |_t, args|
243
- # user_project_path = args[:user_project_path]
244
- # production = args[:production]
245
- # gem_location = File.join(File.dirname(__FILE__))
246
- # build_libraries(user_project_path, gem_location)
247
- # build_common_libraries(user_project_path, production)
248
- # end
249
- #
250
- # task :minimizer, :user_project_path do |_t, args|
251
- # user_project_path = args[:user_project_path]
252
- # minimize(user_project_path)
253
- # end
254
- #
255
- # task default: :run
256
- #
257
- # def build_libraries(user_project_path, gem_location)
258
- # build_aui_for_opal(user_project_path)
259
- # build_host_mode_for_opal(user_project_path)
260
- # build_atome_kernel(user_project_path, gem_location)
261
- # build_opal(user_project_path)
262
- # build_opal_parser(user_project_path)
263
- # build_opal_extensions(user_project_path, gem_location)
264
- # end
265
- #
266
- # def minimize(user_project_path)
267
- # minimize_libraries(user_project_path)
268
- # # minimize_user_code(user_project_path)
269
- # end
270
- #
271
- # def build_common_libraries(user_project_path, production)
272
- # gem_location = File.join(File.dirname(__FILE__))
273
- # copy_assets_files(user_project_path, gem_location)
274
- # build_libraries(user_project_path, gem_location)
275
- # minimize(user_project_path) if production == 'production'
276
- # end
277
- #
278
- # # TODO: integrate pure JS (ruby2js) compilation