class Leg::Commands::Init
Public Class Methods
name()
click to toggle source
# File lib/leg/commands/init.rb, line 4 def self.name "init" end
summary()
click to toggle source
# File lib/leg/commands/init.rb, line 8 def self.summary "Initialize a new leg project." end
usage()
click to toggle source
# File lib/leg/commands/init.rb, line 12 def self.usage "[new-dir]" end
Public Instance Methods
run()
click to toggle source
# File lib/leg/commands/init.rb, line 19 def run if @config puts "You are already in a leg working directory." return false end if new_dir = @args.first if File.exist?(new_dir) puts "Error: directory already exists." return false end FileUtils.mkdir(new_dir) FileUtils.cd(new_dir) end FileUtils.mkdir_p(".leg/repo") FileUtils.mkdir_p("step") FileUtils.mkdir_p("doc") File.write("doc/tutorial.litdiff", "") File.write("leg.yml", "---\n") config = Leg::Config.new(FileUtils.pwd) git = Leg::Representations::Git.new(config) git.init! end
setopts!(o)
click to toggle source
# File lib/leg/commands/init.rb, line 16 def setopts!(o) end