Class: Mwc::Commands::Init

Inherits:
Thor::Group
  • Object
show all
Includes:
Utils::Command, Thor::Actions
Defined in:
lib/mwc/commands/init.rb

Overview

Create a new project

Instance Method Summary collapse

Methods included from Utils::Command

included

Instance Method Details

#create_mwcrcObject

:nodoc:



26
27
28
29
# File 'lib/mwc/commands/init.rb', line 26

def create_mwcrc
  template('mwcrc.erb', '.mwcrc')
  Mwc.config = Pathname.new(destination_root).join('.mwcrc')
end

#create_projectObject



19
20
21
22
23
# File 'lib/mwc/commands/init.rb', line 19

def create_project
  directory('app', name)
  self.destination_root = name
  Mwc.root = destination_root
end

#download_mrubyObject

:nodoc:



32
33
34
35
36
37
38
39
40
41
# File 'lib/mwc/commands/init.rb', line 32

def download_mruby
  # 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