bin/flok in flok-0.0.103 vs bin/flok in flok-0.0.105

- old
+ new

@@ -34,10 +34,12 @@ local_products_path = File.join(Dir.pwd, "products") Dir.chdir(File.join(File.dirname(__FILE__), "../")) do #1. Use the rake task system('rake build:world') + puts "a" + #2. Copy everything in the gems ./flok/products/$PLATFORM -> $PROJECT/products/$PLATFORM and ./flok/app/kern/services/*.rb -> #$PROJECT/products/$PLATFORM/services FileUtils.cp_r "./products/#{platform}", local_products_path #Copy built in services Flok.src_glob("rb", "./app/kern/services", File.join(local_products_path, platform, "services/kern_services.rb")) @@ -45,55 +47,67 @@ #3. Build the client's ./app/controllers/*.rb into './products/$PLATFORM/user_compiler.js' controller_glob_path = "#{local_products_path}/#{platform}/glob/controllers.rb" Flok.src_glob_r("rb", './app/controllers', controller_glob_path) + puts "b" user_compiler_js = Flok::UserCompiler.compile File.read(controller_glob_path) services_config_js = File.read "./config/services.rb" Flok.src_glob("rb", './app/services', File.join(local_products_path, platform, "./services/user_services.rb")) + puts "c" #4. Move ./app/scripts/*.js into `./products/$PLATFORM/./glob/scripts.js` Flok.src_glob("js", './app/scripts', File.join(local_products_path, platform, "./glob/scripts.js")) + puts "d" #Save the current local user's project directory to reference user_project_dir = Dir.pwd + puts "e" #We are now inside the platform folder Dir.chdir File.join(local_products_path, platform) do #3. Put user_compiler_js in glob folder and services into ./services/user_services.rb File.write "glob/user_compiler.js", user_compiler_js #4. The `./products/$PLATFORM/services/*.rb` file are globbed into `./products/$PLATFORM/services/combined_services.rb` Flok.src_glob("rb", "./services/", "./services/combined_services.rb") + puts "f" #5. The service configuration in `./config/services.rb` is read and run through `services_compiler` and files from `./products/$PLATFORM/services/combined_services.rb` and write to ./glob/services.js services_js = Flok::ServicesCompiler.compile(File.read("./services/combined_services.rb"), services_config_js) File.write "./glob/services.js", services_js #6. Move application.js to the glob folder FileUtils.cp "application.js", "glob/application.js" FileUtils.rm "application.js" + puts "g" #7. The local project `./products/$PLATFORM/glob/application.js` and `./products/$PLATFORM/glob/user_compiler.js` and `./products/$PLATFORM/glob/services.js` and `./products/$PLATFORM/glob/scripts.js` are merged into `./products/$PLATFORM/glob/application_user.js.erb.hooks`. File.open "glob/application_user.js.erb.hooks", "w" do |f| f.puts File.read("glob/application.js") f.puts File.read("glob/user_compiler.js") f.puts File.read("glob/services.js") f.puts File.read("glob/scripts.js") end + puts "h" #9. The `hooks` compiler then runs over the source injecting any necessary hook code into the special comments by going through `./config/hooks.rb` in the user's project. erb_hooks_src = File.read "glob/application_user.js.erb.hooks" + puts "hh" manifest = Flok::UserHooksToManifestOrchestrator.convert_hooks_to_manifest File.read("#{user_project_dir}/config/hooks.rb") + puts "hg" erb_src = Flok::HooksCompiler.compile erb_hooks_src, manifest + puts "hi" File.write "glob/application_user.js.erb", erb_src + puts "i" #9. The `erb` files is then sent to `./products/$PLATFORM/glob/application_user.js` with the below `ERB` variables allowable. erb_src = File.read "glob/application_user.js.erb" renderr = ERB.new(erb_src) context = ERBUserApplicationContext.new() new_src = renderr.result(context.get_binding) File.write "application_user.js", new_src + puts "j" end end desc "server", "Monitors for changes within your flok application and triggers an automatic rebuild of ./products/* for a PLATFORM when something in ./app changes" include SpecHelpers #Contains sh2