lib/ninjs/project.rb in ninjs-0.13.1 vs lib/ninjs/project.rb in ninjs-0.13.2

- old
+ new

@@ -10,10 +10,11 @@ def initialize(sub_dir = '/', name = '') path = add_slashes sub_dir @project_path = Dir.getwd + path @modules = Array.new @config = Ninjs::Configuration.new @project_path, name + @app_filename = @config.name.downcase end def add_slashes(dir) dir += '/' unless dir.match(/\/$/) dir = '/' << dir unless dir.match(/^\//) @@ -62,16 +63,16 @@ Ninjs::Notification.added "lib/utilities.js created" end def create_ninjs_application_file - filename = "#{@project_path}application/#{@config.app_filename}.js" + filename = "#{@project_path}application/#{@app_filename}.js" File.open(filename, "w+") do |file| file << "//-- Ninjs #{Time.now.to_s} --//\n" file << File.open("#{@project_path}lib/nin.js", 'r').readlines.join('') - file << "\nvar #{@config.name} = new NinjsApplication('#{@config.base_url}', '#{@config.test_path}');" + file << "\nvar #{@config.name} = new NinjsApplication();" end end def import_test_files FileUtils.cp "#{Ninjs::BASE_DIR}/repository/ninjs/tests/index.html", "#{@project_path}tests" @@ -125,11 +126,11 @@ begin module_src = "#{@project_path}modules/#{module_file}" ninjs_lib_secretary = Sprockets::Secretary.new( :root => "#{Ninjs::BASE_DIR}", - :asset_root => @config.asset_root || @project_path.gsub(/[a-zA-z0-9\.\-\_\s]+\/$/, ''), + :asset_root => @config.asset_root, :load_path => ["repository"], :source_files => ["#{module_src}"] ) module_file = ninjs_lib_secretary.concatenation @@ -142,11 +143,11 @@ Ninjs::Notification.error "Sprockets error: #{error.message}" end end def update_application_file - application_file = "#{@project_path}application/#{@config.app_filename}.js" + application_file = "#{@project_path}application/#{@app_filename}.js" File.open(application_file, "w+") do |file| write_dependencies(file) write_core(file) write_autoload(file) @@ -164,11 +165,11 @@ end def write_core(file) file << "/*---------- Ninjs core ../lib/nin.js ----------*/\n" file << "//= require \"../lib/nin.js\"\n\n" - file << "\nvar #{@config.name} = new NinjsApplication('#{@config.base_url}', '#{@config.test_path}');\n\n" + file << "\nvar #{@config.name} = new NinjsApplication();\n\n" end def write_autoload(file) @config.autoload.each do |auto_file| file << "/*---------- Ninjs autoload #{auto_file} ----------*/" @@ -179,10 +180,10 @@ def compile_application_file(file) begin ninjs_lib_secretary = Sprockets::Secretary.new( :root => "#{Ninjs::BASE_DIR}", - :asset_root => @config.asset_root || @project_path.gsub(/[a-zA-z0-9\.\-\_\s]+\/$/, ''), + :asset_root => @config.asset_root, :load_path => ["repository"], :source_files => ["#{file}"] ) application_file = ninjs_lib_secretary.concatenation \ No newline at end of file