rake_commit 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/commit.rb +7 -2
  2. data/lib/git.rb +19 -9
  3. metadata +7 -12
data/lib/commit.rb CHANGED
@@ -18,10 +18,12 @@ class Commit
18
18
 
19
19
  def commit
20
20
  collapse_commits = true
21
+ incremental = false
21
22
 
22
23
  opts = GetoptLong.new(
23
24
  [ '--help', '-h', GetoptLong::NO_ARGUMENT ],
24
- [ '--no-collapse', '-n', GetoptLong::NO_ARGUMENT ]
25
+ [ '--no-collapse', '-n', GetoptLong::NO_ARGUMENT ],
26
+ [ '--incremental', '-i', GetoptLong::NO_ARGUMENT ]
25
27
  )
26
28
  opts.each do |opt, arg|
27
29
  case opt
@@ -30,13 +32,15 @@ class Commit
30
32
  return
31
33
  when '--no-collapse'
32
34
  collapse_commits = false
35
+ when '--incremental'
36
+ incremental = true
33
37
  end
34
38
  end
35
39
 
36
40
  if git_svn?
37
41
  GitSvn.new.commit
38
42
  elsif git?
39
- Git.new(collapse_commits).commit
43
+ Git.new(collapse_commits, incremental).commit
40
44
  else
41
45
  Svn.new.commit
42
46
  end
@@ -48,6 +52,7 @@ Usage: rake_commit [OPTION]
48
52
 
49
53
  --help, -h: show help
50
54
  --no-collapse, -n: do not collapse merge commits
55
+ --incremental, -i: do not push commit to origin (git only)
51
56
  END
52
57
  end
53
58
  end
data/lib/git.rb CHANGED
@@ -1,16 +1,22 @@
1
1
  class Git
2
2
 
3
- def initialize(collapse_commits = true)
3
+ def initialize(collapse_commits = true, incremental = false)
4
4
  @collapse_commits = collapse_commits
5
+ @incremental = incremental
5
6
  end
6
7
 
7
8
  def commit
8
- collapse_git_commits if @collapse_commits && collapse_git_commits?
9
+ if @incremental
10
+ add
11
+ incremental_commit
12
+ else
13
+ collapse_git_commits if @collapse_commits && collapse_git_commits?
9
14
 
10
- Shell.system("rake")
15
+ Shell.system("rake")
11
16
 
12
- if ok_to_check_in?
13
- push
17
+ if ok_to_check_in?
18
+ push
19
+ end
14
20
  end
15
21
  end
16
22
 
@@ -27,10 +33,7 @@ class Git
27
33
  reset_soft
28
34
  status
29
35
  return if nothing_to_commit?
30
- commit_message = CommitMessage.new
31
- Shell.system("git config user.name #{commit_message.pair.inspect}")
32
- message = "#{commit_message.feature} - #{commit_message.message}"
33
- Shell.system("git commit -m #{message.inspect}")
36
+ incremental_commit
34
37
  pull_rebase
35
38
  end
36
39
 
@@ -42,6 +45,13 @@ class Git
42
45
  Shell.system "git add -A ."
43
46
  end
44
47
 
48
+ def incremental_commit
49
+ commit_message = CommitMessage.new
50
+ Shell.system("git config user.name #{commit_message.pair.inspect}")
51
+ message = "#{commit_message.feature} - #{commit_message.message}"
52
+ Shell.system("git commit -m #{message.inspect}")
53
+ end
54
+
45
55
  def reset_soft
46
56
  raise "Could not determine branch" unless git_branch
47
57
  Shell.system "git reset --soft #{merge_base}"
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake_commit
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 9
8
- - 0
9
- version: 0.9.0
4
+ prerelease:
5
+ version: 0.10.0
10
6
  platform: ruby
11
7
  authors:
12
8
  - Paul Gross
@@ -14,7 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2010-10-31 00:00:00 -05:00
13
+ date: 2011-04-07 00:00:00 -05:00
18
14
  default_executable:
19
15
  dependencies: []
20
16
 
@@ -37,6 +33,7 @@ files:
37
33
  - lib/prompt_line.rb
38
34
  - lib/shell.rb
39
35
  - lib/svn.rb
36
+ - bin/rake_commit
40
37
  has_rdoc: true
41
38
  homepage: http://github.com/pgr0ss/rake_commit
42
39
  licenses: []
@@ -47,23 +44,21 @@ rdoc_options: []
47
44
  require_paths:
48
45
  - lib
49
46
  required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
50
48
  requirements:
51
49
  - - ">="
52
50
  - !ruby/object:Gem::Version
53
- segments:
54
- - 0
55
51
  version: "0"
56
52
  required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
57
54
  requirements:
58
55
  - - ">="
59
56
  - !ruby/object:Gem::Version
60
- segments:
61
- - 0
62
57
  version: "0"
63
58
  requirements: []
64
59
 
65
60
  rubyforge_project: rake_commit
66
- rubygems_version: 1.3.6
61
+ rubygems_version: 1.6.2
67
62
  signing_key:
68
63
  specification_version: 3
69
64
  summary: A gem which helps with checking in code