lib/mwc/commands/init.rb in mwc-0.2.0 vs lib/mwc/commands/init.rb in mwc-0.3.0
- old
+ new
@@ -15,45 +15,38 @@
description 'create a new project'
display_on { !Mwc.config.exist? }
argument :name, type: :string, desc: 'project name'
def create_project
- empty_directory(name)
+ directory('app', name)
self.destination_root = name
Mwc.root = destination_root
end
# :nodoc:
def create_mwcrc
template('mwcrc.erb', '.mwcrc')
+ Mwc.config = Pathname.new(destination_root).join('.mwcrc')
end
# :nodoc:
- def setup_project
- empty_directory('vendor')
- empty_directory('dist')
- empty_directory('src/js')
- copy_file('config/build.rb')
- copy_file('.gitignore')
- end
-
- # :nodoc:
def download_mruby
- Mwc.config.reload!
# TODO: Allow choose download mode
+ empty_directory('vendor')
inside(mruby_directory.dirname) do
run("curl -OL #{archive_url}")
run("tar -zxf #{filename}")
remove_file(filename)
run("mv mruby-#{version} #{mruby_directory}")
end
end
private
+ # :nodoc:
def version
- Mwc.config.mruby.version
+ Mwc.mruby.version
end
# :nodoc:
def archive_url
"https://github.com/mruby/mruby/archive/#{filename}"
@@ -62,11 +55,12 @@
# :nodoc:
def filename
"#{version}.tar.gz"
end
+ # :nodoc:
def mruby_directory
- Mwc.config.mruby.path
+ Mwc.mruby.path
end
end
end
end