Method: FalkorLib::GitFlow.command

Defined in:
lib/falkorlib/git/flow.rb

.command(name, type = 'feature', action = 'start', path = Dir.pwd, optional_args = '') ⇒ Object

generic function to run any of the gitflow commands



154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/falkorlib/git/flow.rb', line 154

def command(name, type = 'feature', action = 'start', path = Dir.pwd, optional_args = '')
  error "Invalid git-flow type '#{type}'" unless %w(feature release hotfix support).include?(type)
  error "Invalid action '#{action}'" unless %w(start finish).include?(action)
  error "You must provide a name" if name == ''
  error "The name '#{name}' cannot contain spaces" if name =~ /\s+/
  exit_status = 1
  Dir.chdir( FalkorLib::Git.rootdir(path) ) do
    exit_status = run %(
               git flow #{type} #{action} #{optional_args} #{name}
            )
  end
  exit_status
end