Sha256: c27f61a4a2a3acf898f8021604f8ed0abf3e92ad857392e832d3499f0047a34e

Contents?: true

Size: 1.45 KB

Versions: 20

Compression:

Stored size: 1.45 KB

Contents

module Nucleon
module Mixin
module Action
module Commit
        
  #-----------------------------------------------------------------------------
  # Settings
        
  def commit_config(optional = true)
    
    if optional
      register :commit, :bool, :false, 'nucleon.core.mixin.action.commit.options.commit'
    else
      settings[:commit] = true
    end
    
    register :allow_empty, :bool, false, 'nucleon.core.mixin.action.commit.options.allow_empty'
    register :propogate_commit, :bool, false, 'nucleon.core.mixin.action.commit.options.propogate_commit'
    
    register :message, :str, '', 'nucleon.core.mixin.action.commit.options.message'
    
    register :author, :str, 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.mixins.action.commit.errors.author', { :value => value })
      false
    end
  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

20 entries across 20 versions & 1 rubygems

Version Path
nucleon-0.2.1 lib/core/mixin/action/commit.rb
nucleon-0.2.0 lib/core/mixin/action/commit.rb
nucleon-0.1.19 lib/core/mixin/action/commit.rb
nucleon-0.1.18 lib/core/mixin/action/commit.rb
nucleon-0.1.17 lib/core/mixin/action/commit.rb
nucleon-0.1.16 lib/core/mixin/action/commit.rb
nucleon-0.1.15 lib/core/mixin/action/commit.rb
nucleon-0.1.14 lib/core/mixin/action/commit.rb
nucleon-0.1.13 lib/core/mixin/action/commit.rb
nucleon-0.1.12 lib/core/mixin/action/commit.rb
nucleon-0.1.11 lib/core/mixin/action/commit.rb
nucleon-0.1.10 lib/core/mixin/action/commit.rb
nucleon-0.1.9 lib/core/mixin/action/commit.rb
nucleon-0.1.8 lib/core/mixin/action/commit.rb
nucleon-0.1.7 lib/core/mixin/action/commit.rb
nucleon-0.1.6 lib/core/mixin/action/commit.rb
nucleon-0.1.5 lib/core/mixin/action/commit.rb
nucleon-0.1.4 lib/core/mixin/action/commit.rb
nucleon-0.1.3 lib/core/mixin/action/commit.rb
nucleon-0.1.2 lib/core/mixin/action/commit.rb