Sha256: 5577369b4ca4cabd97123e57cd3c3161bcbb85498873ea6a20ff83e81e5dbb0a
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
#!/usr/bin/env ruby require 'fileutils' require 'rack' require 'thor' require_relative '../opal/dxopal/version' # Import DXOpal::VERSION module DXOpal class Cli < Thor GEM_ROOT = "#{__dir__}/../" desc "init", "Copy template files into this directory" def init FileUtils.cp("#{GEM_ROOT}/template/index.html", Dir.pwd) puts "Wrote index.html" FileUtils.cp("#{GEM_ROOT}/template/main.rb", Dir.pwd) puts "Wrote main.rb" FileUtils.cp("#{GEM_ROOT}/build/dxopal.min.js", Dir.pwd) puts "Wrote dxopal.min.js" end desc "update", "Update dxopal.min.js" def update src = "#{GEM_ROOT}/build/dxopal.min.js" dst = "#{Dir.pwd}/dxopal.min.js" if File.exist?(dst) && File.read(src) == File.read(dst) puts "dxopal.min.js is already up-to-date." return end FileUtils.cp(src, dst) puts "Wrote #{dst}" end desc "server", "Start local server" option "port", aliases: :p, type: :numeric, default: 7521 def server puts "Starting DXOpal Server" puts "(Open http://localhost:#{options[:port]}/index.html in the browser)" puts "---" app = Rack::Directory.new(Dir.pwd) Rack::Server.start(app: app, Port: options[:port]) end end end puts "DXOpal v#{DXOpal::VERSION}" DXOpal::Cli.start
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dxopal-1.3.0 | exe/dxopal |
dxopal-1.2.0 | exe/dxopal |
dxopal-1.1.0 | exe/dxopal |