Class: Commit
- Inherits:
-
Object
- Object
- Commit
- Defined in:
- lib/commit.rb
Instance Method Summary collapse
Instance Method Details
#commit ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/commit.rb', line 19 def commit = { :collapse_commits => true, :incremental => false, :prompt_exclusions => [] } if File.exists?(".rake_commit") defaults = File.read(".rake_commit") = (defaults.split(" "), ) end = (ARGV, ) if git_svn? GitSvn.new([:prompt_exclusions]).commit elsif git? Git.new([:collapse_commits], [:incremental], [:prompt_exclusions]).commit else Svn.new([:prompt_exclusions]).commit end end |
#git? ⇒ Boolean
9 10 11 12 |
# File 'lib/commit.rb', line 9 def git? `git symbolic-ref HEAD 2>/dev/null` $?.success? end |
#git_svn? ⇒ Boolean
14 15 16 17 |
# File 'lib/commit.rb', line 14 def git_svn? `git svn info 2> /dev/null` $?.success? end |
#parse_options(args, options) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/commit.rb', line 41 def (args, ) parser = OptionParser.new do |opts| opts. = "Usage: rake_commit [OPTIONS]" opts.on("-h", "--help", "Show this message") do puts opts exit end opts.on("-i", "--incremental", "Prompt for a local commit") do [:incremental] = true end opts.on("-n", "--no-collapse", "Run the build and push without collapsing commits") do [:collapse_commits] = false end opts.on("-w", "--without-prompt PROMPT", "Skips the given prompt (author, feature, message)") do |prompt_exclusion| [:prompt_exclusions] << prompt_exclusion end end parser.parse(args) end |