Sha256: bf34ef53a1bf403372b1b984988bc764e61976455a4ee3883e593a3033ca9133

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

#!/usr/bin/env ruby
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'

require 'rubygems'
require 'simple_commander/import'

program :name, 'simple_commander'
program :version, SimpleCommander::VERSION
program :description, 'Simple Commander utility program.'
helpers 'IO'

command :init do
	syntax      'simple_commander init <optional_path defaults to ./> '
	description 'Add this folder to the simple commander path as the default folder for scripts'
	
	action do |args, options|
		SimpleCommander::CLI.init(args)
	end
end

command 'show config' do
	syntax      'show config'	
	description 'show the current configuration'

	action do |args, options|
		SimpleCommander::CLI.show_config
	end
end

command :new do
	action do |args, options|
		SimpleCommander::CLI.new(args)
		config_file = "#{File.dirname(__FILE__)}/config.yml"
		yml = YAML.load_file(config_file)
		sc_folder = yml[:path] 
		temp_folder = "#{File.dirname(__FILE__)}/"
		s_path = "#{sc_folder}/#{args[0]}"
		if !sc_folder
			say <<-END 
				You need to set a path to commander
				use simple_commander init <path> or cd to
				the folder you want and just simple_commander init
			END
			return
		end
		if File.directory?(s_path)
			say "The script #{args[0]} already exist!"
			return
		end
		mkdir s_path 
		mkdir "#{s_path}/bin"
		mkdir "#{s_path}/spec"
	end
end
 

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_commander-0.3.0 bin/simple_commander