Sha256: 2f38904918a4f46afbc9b8ad026665679dca47b52cb5f93afde67860725134ef

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

module Nucleon
module Action
class Save < Plugin::Action
  
  include Mixin::Action::Project
  include Mixin::Action::Commit
  include Mixin::Action::Push
 
  #-----------------------------------------------------------------------------
  # Save action interface
  
  def normalize
    super('nucleon save [ <file> ... ]')    
    
    codes :project_failure => 20,
          :commit_failure  => 21,
          :push_failure    => 22
  end

  #-----------------------------------------------------------------------------
  # Action operations
  
  def parse(parser)
    parser.arg_array(:files, '.', 
      'nucleon.core.actions.save.options.files'
    )
    project_options(parser, true, false)
    commit_options(parser, false)
    push_options(parser, true)
  end
  
  #---
   
  def execute          
    super do |node, network, status|
      info('nucleon.core.actions.save.start')
          
      if project = project_load(Dir.pwd, false)
        if commit(project, settings[:files])
          status = code.push_failure unless push(project)
        else
          status = code.commit_failure
        end
      else
        status = code.project_failure
      end
      status
    end
  end
end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nucleon-0.1.1 lib/nucleon/action/save.rb