mirror of
https://github.com/samsonjs/Mojo.Ext.git
synced 2026-03-25 09:25:46 +00:00
Added a short usage message.
This commit is contained in:
parent
2c743f4370
commit
de155b9cc0
1 changed files with 9 additions and 2 deletions
11
inject.rb
11
inject.rb
|
|
@ -8,7 +8,7 @@ require 'stringio'
|
||||||
def inject
|
def inject
|
||||||
FileUtils.cp_r(mojo_ext_path, target_mojo_ext_path)
|
FileUtils.cp_r(mojo_ext_path, target_mojo_ext_path)
|
||||||
|
|
||||||
mojo_ext_source_dict = {'source' => 'mojo-ext/ext.js'}
|
mojo_ext_source_dict = {'source' => File.join('mojo-ext', 'ext.js')}
|
||||||
unless sources.first == mojo_ext_source_dict
|
unless sources.first == mojo_ext_source_dict
|
||||||
sources.unshift(mojo_ext_source_dict)
|
sources.unshift(mojo_ext_source_dict)
|
||||||
save_sources!
|
save_sources!
|
||||||
|
|
@ -43,12 +43,19 @@ def project_path
|
||||||
ARGV.first || Dir.pwd
|
ARGV.first || Dir.pwd
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def usage
|
||||||
|
puts "Usage: #{File.basename(__FILE__)} <path-to-mojo-project>"
|
||||||
|
end
|
||||||
|
|
||||||
def main
|
def main
|
||||||
unless File.exists?(sources_file)
|
unless File.exists?(sources_file)
|
||||||
raise "no Mojo project found at #{project_path}"
|
puts "[error] No Mojo project found at #{project_path}"
|
||||||
|
usage
|
||||||
|
exit(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
if extended?
|
if extended?
|
||||||
|
# TODO ask if the user wants to update/replace Mojo.Ext instead
|
||||||
puts "project already contains Mojo.Ext, bailing"
|
puts "project already contains Mojo.Ext, bailing"
|
||||||
else
|
else
|
||||||
inject
|
inject
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue