Sha256: 7b291951f529af21758c4dc649461782779b131404d3ef923454cf7b51491b92

Contents?: true

Size: 800 Bytes

Versions: 10

Compression:

Stored size: 800 Bytes

Contents

#!/usr/bin/env ruby
# %% -*- ruby -*-

require 'fileutils'

def show_help_and_exit!
  puts <<END
webruby: compile your favourite Ruby source code for the browser!

Usage:
  webruby new [destination path]

  Create a new webruby project using provided skeleton
END
  exit 0
end

def prompt(*args)
  print(*args)
  str = STDIN.gets.strip.downcase
  str == "yes" || str == "y"
end

if (ARGV.length == 2) &&
    (ARGV[0] == 'new')
  if Dir.exist?(ARGV[1])
    exit 1 unless prompt("Directory #{ARGV[1]} already exists, do you really want to use this path? ")
  end

  FileUtils.mkdir_p(ARGV[1])
  MINIMAL_TEMPLATE_ROOT = File.join(File.dirname(__FILE__),
                                    %w[.. templates minimal])
  FileUtils.cp_r("#{MINIMAL_TEMPLATE_ROOT}/.", ARGV[1])
else
  show_help_and_exit!
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
webruby-0.9.3 bin/webruby
webruby-0.9.2 bin/webruby
webruby-0.9.1 bin/webruby
webruby-0.2.7 bin/webruby
webruby-0.2.5 bin/webruby
webruby-0.2.4 bin/webruby
webruby-0.2.2 bin/webruby
webruby-0.2.1 bin/webruby
webruby-0.1.2 bin/webruby
webruby-0.1.1 bin/webruby