lib/ninjs/project.rb in ninjs-0.11.0 vs lib/ninjs/project.rb in ninjs-0.11.1

- old
+ new

@@ -19,50 +19,50 @@ dir = '/' << dir unless dir.match(/^\//) dir end def create - puts "\e[32m>>>\e[0m Creating the #{@config.name} project in #{@project_path}" + Ninjs::Notification.notice "Creating the #{@config.name} project in #{@project_path}" create_project_structure - puts "created the project structure" + Ninjs::Notification.notice "created the project structure" @config.create create_ninjs_lib_file create_utility_lib_file create_ninjs_application_file import_test_files end def create_project_structure Dir.mkdir "#{@project_path}" unless File.exists? "#{@project_path}" Ninjs::Manifest.directories.each do |folder| - puts "#{folder}/ created" unless File.exists? "#{@project_path}#{folder}" + Ninjs::Notification.added "#{folder}/ created" unless File.exists? "#{@project_path}#{folder}" Dir.mkdir "#{@project_path}#{folder}" unless File.exists? "#{@project_path}#{folder}" end end def create_ninjs_lib_file ninjs_lib_secretary = Sprockets::Secretary.new( - :root => "#{Ninjs.base_directory}", + :root => "#{Ninjs::BASE_DIR}", :load_path => ["repository"], :source_files => ["repository/ninjs/core/nin.js"] ) ninjs_lib_secretary.concatenation.save_to "#{@project_path}lib/nin.js" - puts "lib/nin.js created" + Ninjs::Notification.added "lib/nin.js created" end def create_utility_lib_file utility_lib_secretary = Sprockets::Secretary.new( - :root => "#{Ninjs.base_directory}", + :root => "#{Ninjs::BASE_DIR}", :load_path => ["repository"], :source_files => ["repository/ninjs/utilities/all.js"] ) utility_lib_secretary.concatenation.save_to "#{@project_path}lib/utilities.js" - puts "lib/utilities.js created" + Ninjs::Notification.added "lib/utilities.js created" end def create_ninjs_application_file filename = "#{@project_path}application/#{@config.app_filename}.js" @@ -72,23 +72,23 @@ file << "\nvar #{@config.name} = new NinjsApplication('#{@config.base_url}', '#{@config.test_path}');" end end def import_test_files - FileUtils.cp "#{Ninjs.base_directory}/repository/ninjs/tests/index.html", "#{@project_path}tests" - FileUtils.cp "#{Ninjs.base_directory}/repository/ninjs/tests/ninjs.test.js", "#{@project_path}tests" - FileUtils.cp "#{Ninjs.base_directory}/repository/ninjs/tests/ninjs.utilities.test.js", "#{@project_path}tests" - FileUtils.cp "#{Ninjs.base_directory}/repository/ninjs/tests/qunit/qunit.js", "#{@project_path}tests/qunit" - FileUtils.cp "#{Ninjs.base_directory}/repository/ninjs/tests/qunit/qunit.css", "#{@project_path}tests/qunit" + FileUtils.cp "#{Ninjs::BASE_DIR}/repository/ninjs/tests/index.html", "#{@project_path}tests" + FileUtils.cp "#{Ninjs::BASE_DIR}/repository/ninjs/tests/ninjs.test.js", "#{@project_path}tests" + FileUtils.cp "#{Ninjs::BASE_DIR}/repository/ninjs/tests/ninjs.utilities.test.js", "#{@project_path}tests" + FileUtils.cp "#{Ninjs::BASE_DIR}/repository/ninjs/tests/qunit/qunit.js", "#{@project_path}tests/qunit" + FileUtils.cp "#{Ninjs::BASE_DIR}/repository/ninjs/tests/qunit/qunit.css", "#{@project_path}tests/qunit" end def update get_updated_modules compile_modules update_application_file compress_application if @config.output == 'compressed' - puts "\e[32m>>>\e[0m application updated" unless @errors + Ninjs::Notification.log "application updated" unless @errors @errors = false end def get_directory_script_files script_files = Array.new @@ -124,25 +124,24 @@ def create_module_file(module_file, module_name) begin module_src = "#{@project_path}modules/#{module_file}" ninjs_lib_secretary = Sprockets::Secretary.new( - :root => "#{Ninjs.base_directory}", + :root => "#{Ninjs::BASE_DIR}", :asset_root => @config.asset_root || @project_path.gsub(/[a-zA-z0-9\.\-\_\s]+\/$/, ''), :load_path => ["repository"], :source_files => ["#{module_src}"] ) module_file = ninjs_lib_secretary.concatenation message = File.exists?("#{@project_path}application/#{module_name}.js") ? "\e[32m>>>\e[0m application/#{module_name}.js updated" : "\e[32m>>>\e[0m application/#{module_name}.js created" module_file.save_to "#{@project_path}application/#{module_name}.js" ninjs_lib_secretary.install_assets - #puts message rescue Exception => error @errors = true - puts "Sprockets error: #{error.message}" + Ninjs::Notification.error "Sprockets error: #{error.message}" end end def update_application_file application_file = "#{@project_path}application/#{@config.app_filename}.js" @@ -179,21 +178,21 @@ end def compile_application_file(file) begin ninjs_lib_secretary = Sprockets::Secretary.new( - :root => "#{Ninjs.base_directory}", + :root => "#{Ninjs::BASE_DIR}", :asset_root => @config.asset_root || @project_path.gsub(/[a-zA-z0-9\.\-\_\s]+\/$/, ''), :load_path => ["repository"], :source_files => ["#{file}"] ) application_file = ninjs_lib_secretary.concatenation ninjs_lib_secretary.install_assets application_file.save_to "#{file}" rescue Exception => error @errors = true - puts "\e[0;31m!!!\e[0m Sprockets error: #{error.message}" + Ninjs::Notification.error "Sprockets error: #{error.message}" end end def compress_application application = @project_path + 'application' \ No newline at end of file