36 lines
808 B
Ruby
Executable File
36 lines
808 B
Ruby
Executable File
#!/usr/bin/env ruby
|
|
require 'rubygems'
|
|
require 'rake'
|
|
|
|
def cwd
|
|
File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
|
end
|
|
|
|
def expand(*paths)
|
|
File.expand_path(File.join(*paths))
|
|
end
|
|
|
|
def rakefile_path
|
|
expand(cwd, 'templates/Rakefile')
|
|
end
|
|
|
|
if ARGV[0] == 'init'
|
|
require 'ftools'
|
|
File.makedirs('spec/javascripts')
|
|
dest_root = expand(Dir.pwd, 'spec')
|
|
dest_spec = expand(Dir.pwd, 'spec/javascripts')
|
|
File.copy(expand(cwd, 'templates/example_spec.js'), dest_spec)
|
|
if File.exist?(expand(Dir.pwd, 'Rakefile'))
|
|
existing_rakefile = expand(Dir.pwd, 'Rakefile')
|
|
load existing_rakefile
|
|
unless Rake::Task.task_defined?('jasmine')
|
|
open(existing_rakefile, 'a') do |f|
|
|
f.write(File.read(rakefile_path))
|
|
end
|
|
end
|
|
else
|
|
File.copy(rakefile_path, Dir.pwd)
|
|
end
|
|
end
|
|
|