Sha256: 0bf897dfbdb76ad1f808070d643ac8c5f2c8f93ffaff2d971d1b1786d577ec2d
Contents?: true
Size: 1.59 KB
Versions: 3
Compression:
Stored size: 1.59 KB
Contents
command :new do |c| c.syntax = 'loom new [options]' c.summary = 'Creates a new loom project in the specified directory' c.description = 'loom new generates a bare bones project structure that can immediately compile by calling loom run, this acts as a great starting point for loom development' c.example 'create a new project called MyProject', 'loom new MyProject' c.action do |args, options| dir = args[0] unless args.nil? if dir.nil? say_error "Unable to create a new loom project without a directory. Example: loom new MyGame" exit 1 else if !File.directory?(dir) say "Initializing Project: #{dir}..." say_tab 1, "Creating directory #{dir}/src" FileUtils.mkdir_p "#{dir}/src" say_tab 1, "Creating directory #{dir}/libs" FileUtils.mkdir_p "#{dir}/libs" say_tab 1, "Creating directory #{dir}/bin" FileUtils.mkdir_p "#{dir}/bin" say_tab 1, "Creating directory #{dir}/assets" FileUtils.mkdir_p "#{dir}/assets" say_tab 1, "Writing file #{dir}/src/Main.build" main_build_file = File.new File.join TEMPLATES_DIR, "Main.build.erb" File.open("#{dir}/src/Main.build" , 'w') {|f| f.write(main_build_file.read) } say_tab 1, "Writing file #{dir}/src/Program.ls" program_ls_file = File.new File.join TEMPLATES_DIR, "Program.ls.erb" File.open("#{dir}/src/Program.ls" , 'w') {|f| f.write(program_ls_file.read) } configure_directory dir elsif say_error "Directory #{dir} already exists!" exit 1 end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
loom-0.0.46 | lib/loom/new.rb |
loom-0.0.45 | lib/loom/new.rb |
loom-0.0.43 | lib/loom/new.rb |