Sha256: a4b4f5f0d46bf90be0de24487f4c331fc2b65aa7f077ab78d064ee217dffca12

Contents?: true

Size: 952 Bytes

Versions: 13

Compression:

Stored size: 952 Bytes

Contents

#!/usr/bin/env ruby

require 'optparse'

ARGV << '--help' if ARGV.empty?
COMMANDS = %w(new server console)

options = {
  Port: 3000
}

parser = OptionParser.new do |opts|
  opts.banner = "Usage: ecrire [ #{COMMANDS.join(' | ')} ] [options]:"

  opts.separator ''
  opts.separator 'ecrire new blog.domain.com'

  opts.separator ''
  opts.separator 'ecrire server [options]:'
  opts.on '-p PORT', '--port=PORT', 'Run the server on a given port. Defaults to 3000' do |port|
    options[:Port] = port
  end

  opts.on '-b IP', '--binding=IP', "Binds Rails to the specified IP.", "Default: localhost" do |ip|
    options[:Host] = ip
  end

  opts.separator ''
  opts.separator 'ecrire console'

  opts.on '-h', '--help', 'Show this menu' do 
    puts opts
  end
end

if !COMMANDS.include?(ARGV[0])
  parser.parse! %w(-h)
  exit
end

require 'ecrire/commands'

parser.parse!

command = Ecrire::Commands.send(ARGV[0]).new(options, *ARGV[1..-1])
command.run!

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ecrire-0.31.2 bin/ecrire
ecrire-0.31.1 bin/ecrire
ecrire-0.31.0 bin/ecrire
ecrire-0.30.3 bin/ecrire
ecrire-0.30.2 bin/ecrire
ecrire-0.30.1 bin/ecrire
ecrire-0.30.0 bin/ecrire
ecrire-0.29.0 bin/ecrire
ecrire-0.28.3 bin/ecrire
ecrire-0.28.2 bin/ecrire
ecrire-0.28.1 bin/ecrire
ecrire-0.28.0 bin/ecrire
ecrire-0.27.0 bin/ecrire