## dev_commands Gem Version A ruby gem to aid in the definition and execution of system commands ### Installation The gem can be installed by the single command ``` gem install dev_commands ``` ### Usage This is an example of a simple usage ``` require 'dev_commands' cmd=Command.new 'ruby --version' cmd.execute puts "exit_code: #{cmd[:exit_code]}" puts "output: #{cmd[:output]}" # exit_code: 0 # output": ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14] ``` Using commands in an array ``` commands=['ruby -version','git --version'] commands.execute ``` Using commands in a hash ``` commands= { build: ['gem build dev_commands.gemspec'], test: ['rspec'], doc: ['yard doc - LICENSE'], add: ['git add --all'], commit: ["git commit -m'commit all'"], } commands.execute ``` CLEAN and CLOBBER are defined by dev_command, the default values may be overridden with ``` CLEAN.clear CLOBBER.clear ``` COMMANDS is an automatically populated command hash defined by dev_command. If the auto-generated commands are acceptable, the following code may be used. ``` require 'dev_commands' task :default do COMMANDS.execute end ``` Any default commands may be completely overriden by overwriting the appropriate key, for instance, to override all default build commands, the following could be done. ``` require 'dev_commands' COMMANDS[:build]=['gem build my-gem.gemspec'] task :default do COMMANDS.execute end ``` ### License Copyright 2014-2015 Lou Parslow Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.