Sha256: 3f6052abd46427d27d0763a704f7bdddbc4bd7c807389f78a2709bbdcefac424

Contents?: true

Size: 1.7 KB

Versions: 4

Compression:

Stored size: 1.7 KB

Contents

#!/usr/bin/env ruby
require 'gli'
begin # XXX: Remove this begin/rescue before distributing your app
  require 'clenver'
  require 'clenver/runner'
  require 'clenver/logging'
rescue LoadError
  STDERR.puts "In development, you need to use `bundle exec bin/clenver` to run your app"
  STDERR.puts "At install-time, RubyGems will make sure lib, etc. are in the load path"
  STDERR.puts "Feel free to remove this message from bin/clenver now"
  exit 64
end

include GLI::App

program_desc 'Command Line home ENVironment managER'

version Clenver::VERSION

desc 'Initialize workspace environment based on given configuration'
arg_name 'Describe arguments to init here'
command :init do |c|
  # c.desc 'Describe a switch to init'
  # c.switch :s

  # c.desc 'Describe a flag to init'
  # c.default_value 'default'
  # c.flag :f
  c.action do |global_options,options,args|

    # Your command logic here

    unless args.empty?
      include Logging
      logger.debug("args: #{args}")
      path = args[0]
      dst_dist = args[1]
      Clenver::Runner.new(path, dst_dist).start
    else
      exit_now!("pass config file as a clenver init argument", 2)
    end
    # If you have any errors, just raise them
    # raise "that command made no sense"
  end
end

pre do |global,command,options,args|
  # Pre logic here
  # Return true to proceed; false to abort and not call the
  # chosen command
  # Use skips_pre before a command to skip this block
  # on that command only
  true
end

post do |global,command,options,args|
  # Post logic here
  # Use skips_post before a command to skip this
  # block on that command only
end

on_error do |exception|
  # Error logic here
  # return false to skip default error handling
  true
end

exit run(ARGV)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
clenver-0.1.12 bin/clenver
clenver-0.1.10 bin/clenver
clenver-0.1.9 bin/clenver
clenver-0.1.8 bin/clenver