mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-04 09:38:00 +08:00
42 lines
751 B
Ruby
42 lines
751 B
Ruby
#!/usr/bin/ruby
|
|
|
|
if ARGV.size != 1
|
|
$stderr.puts "Usage: #{File.basename(__FILE__)} <app-name>"
|
|
exit 1
|
|
end
|
|
|
|
app_name = ARGV[0]
|
|
|
|
unless app_name.match(/^[a-zA-Z\d\s]+$/)
|
|
$stderr.puts "Invalid app name"
|
|
exit 1
|
|
end
|
|
|
|
if File.exist?(app_name)
|
|
$stderr.puts "Directory `#{app_name}' already exists"
|
|
exit 1
|
|
end
|
|
|
|
Dir.mkdir(app_name)
|
|
Dir.chdir(app_name) do
|
|
File.open('Rakefile', 'w') do |io|
|
|
io.puts <<EOS
|
|
require 'rubygems'
|
|
require 'rubixir/rake'
|
|
|
|
Rubixir::CONFIG.app_name = '#{app_name}'
|
|
EOS
|
|
end
|
|
Dir.mkdir('app')
|
|
File.open('app/main.rb', 'w') do |io|
|
|
io.puts <<EOS
|
|
class AppDelegate
|
|
def application(application, didFinishLaunchingWithOptions:launchOptions)
|
|
puts "Hello World!"
|
|
end
|
|
end
|
|
EOS
|
|
end
|
|
Dir.mkdir('resources')
|
|
end
|