Sha256: 082d9b488bd2943f871fb5e531218504ddf3200d13f660b3d170d98a3efe2808

Contents?: true

Size: 1.54 KB

Versions: 11

Compression:

Stored size: 1.54 KB

Contents

module Nucleon
module Mixin
module Action
module Commit
        
  #-----------------------------------------------------------------------------
  # Settings
        
  def commit_config(optional = true)
    
    if optional
      register_bool :commit, :false, 'nucleon.core.mixin.action.commit.options.commit'
    else
      settings[:commit] = true
    end
    
    register_bool :allow_empty, true, 'nucleon.mixin.core.action.commit.options.allow_empty'
    register_bool :propogate_commit, false, 'nucleon.core.mixin.action.commit.options.propogate_commit'
    
    register_str :message, '', 'nucleon.core.mixin.action.commit.options.message'
    
    register_str :author, nil, 'nucleon.core.mixin.action.commit.options.author' do |value|
      if value.nil? || value.strip =~ /^[A-Za-z\s]+<\s*[^@]+@[^>]+\s*>$/
        next true
      end
      warn('corl.core.mixin.action.commit.errors.author', { :value => value })
      false
    end
  end
  
  #---
  
  def commit_ignore
    [ :commit, :allow_empty, :propogate_commit, :message, :author ]
  end
        
  #-----------------------------------------------------------------------------
  # Operations
        
  def commit(project, files = '.')
    success = true
          
    if project && settings[:commit]
      success = project.commit(files, extended_config(:commit, {
        :allow_empty => settings[:allow_empty],
        :message     => settings[:message],
        :author      => settings[:author],
        :propogate   => settings[:propogate_commit]
      }))
    end
    success
  end
end
end
end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
nucleon-0.2.12 lib/core/mixin/action/commit.rb
nucleon-0.2.11 lib/core/mixin/action/commit.rb
nucleon-0.2.10 lib/core/mixin/action/commit.rb
nucleon-0.2.9 lib/core/mixin/action/commit.rb
nucleon-0.2.8 lib/core/mixin/action/commit.rb
nucleon-0.2.7 lib/core/mixin/action/commit.rb
nucleon-0.2.6 lib/core/mixin/action/commit.rb
nucleon-0.2.5 lib/core/mixin/action/commit.rb
nucleon-0.2.4 lib/core/mixin/action/commit.rb
nucleon-0.2.3 lib/core/mixin/action/commit.rb
nucleon-0.2.2 lib/core/mixin/action/commit.rb