35 lines
No EOL
635 B
Ruby
35 lines
No EOL
635 B
Ruby
#! /usr/bin/ruby
|
|
|
|
require 'sod'
|
|
|
|
class New < Sod::Action
|
|
on "--new", argument: "NAME"
|
|
|
|
def call(name)
|
|
destination_root = Pathname.new name
|
|
|
|
destination_root.mkdir
|
|
|
|
(destination_root+'modules').mkdir
|
|
|
|
gem_root = Pathname.new(__FILE__).parent + '..'
|
|
|
|
for source in gem_root.glob('{example/*,*.md}')
|
|
destination = destination_root + source.basename
|
|
|
|
`cp #{source} #{destination}`
|
|
end
|
|
|
|
(destination_root+'views').mkdir
|
|
|
|
`cp -r #{gem_root+'views'} #{destination_root}`
|
|
end
|
|
end
|
|
|
|
cli = Sod.new(banner: "TonTon Web 0.0.0: TonTon utilitary for web apps") do
|
|
on(New)
|
|
|
|
on Sod::Prefabs::Actions::Help, self
|
|
end
|
|
|
|
cli.call |