rake_commit 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.rdoc +19 -18
  2. data/bin/rake_commit +0 -0
  3. data/lib/git.rb +7 -2
  4. data/lib/shell.rb +1 -1
  5. metadata +3 -3
data/README.rdoc CHANGED
@@ -1,21 +1,18 @@
1
- = rake_commit_tasks
1
+ = rake_commit
2
2
 
3
- This plugin contains a set of rake tasks for checking your project into source control (git or subversion). The most important is:
4
-
5
- rake commit
6
-
7
- which does the following, depending on source control:
3
+ This gem automates a pretty standard workflow when committing code to git, svn, and git-svn. Run rake_commit in your current project, which does the following, depending on source control:
8
4
 
9
5
  ==== git
10
6
 
11
- 1. Resets soft back to origin/branch (in order to collapse changes into one commit)
12
- 2. Adds new files to git and removes deleted files
13
- 3. Prompts for a commit message
14
- 4. Commits to git
15
- 5. Pulls changes from origin (and does a rebase to keep a linear history)
16
- 6. Runs the default rake task (which should run the tests)
17
- 7. Checks cruisecontrol.rb to see if the build is passing
18
- 8. Pushes the commit to origin
7
+ 1. Checks in current changes into a temp commit just in case
8
+ 2. Resets soft back to origin/branch (in order to collapse changes into one commit)
9
+ 3. Adds new files to git and removes deleted files
10
+ 4. Prompts for a commit message
11
+ 5. Commits to git
12
+ 6. Pulls changes from origin (and does a rebase to keep a linear history)
13
+ 7. Runs the default rake task (which should run the tests)
14
+ 8. Checks cruisecontrol.rb to see if the build is passing
15
+ 9. Pushes the commit to origin
19
16
 
20
17
  ==== git-svn
21
18
 
@@ -43,14 +40,18 @@ Improvements have been added in from several more projects.
43
40
 
44
41
  == Installation
45
42
 
46
- git clone git://github.com/pgr0ss/rake_commit_tasks.git vendor/plugins/rake_commit_tasks
47
- rake commit
43
+ sudo gem install rake_commit
44
+
45
+ == Usage
46
+
47
+ cd /path/to/project
48
+ rake_commit
48
49
 
49
- == Customization
50
+ == Customization - these currently do not work in gem version yet
50
51
 
51
52
  === Preventing checkins on broken builds
52
53
 
53
- If you want the build to check your cruisecontrol.rb instance and prompt you
54
+ If you want the build to check your cruisecontrol.rb instance and prompt you
54
55
  before checking in on a broken build, set CCRB_RSS to the location of the RSS feed.
55
56
 
56
57
  For example, in your Rakefile:
data/bin/rake_commit CHANGED
File without changes
data/lib/git.rb CHANGED
@@ -21,6 +21,7 @@ class Git
21
21
  temp_commit
22
22
  reset_soft
23
23
  status
24
+ return if nothing_to_commit?
24
25
  commit_message = CommitMessage.new
25
26
  Shell.system("git config user.name #{commit_message.pair.inspect}")
26
27
  message = "#{commit_message.feature} - #{commit_message.message}"
@@ -50,10 +51,14 @@ class Git
50
51
  end
51
52
 
52
53
  def temp_commit
53
- return if Shell.backtick("git status") =~ /nothing to commit/m
54
+ return if nothing_to_commit?
54
55
  Shell.system "git commit -m 'rake_commit backup commit'"
55
56
  end
56
57
 
58
+ def nothing_to_commit?
59
+ Shell.backtick("git status") =~ /nothing to commit/m
60
+ end
61
+
57
62
  def git_branch
58
63
  @git_branch ||= begin
59
64
  output = Shell.backtick("git symbolic-ref HEAD")
@@ -62,7 +67,7 @@ class Git
62
67
  end
63
68
 
64
69
  def merge_commits?
65
- Shell.backtick("git log --merges #{merge_base}..HEAD").any?
70
+ Shell.backtick("git log #{merge_base}..HEAD") != Shell.backtick("git log --no-merges #{merge_base}..HEAD")
66
71
  end
67
72
 
68
73
  def merge_base
data/lib/shell.rb CHANGED
@@ -5,7 +5,7 @@ class Shell
5
5
 
6
6
  def self.backtick(cmd)
7
7
  output = `#{cmd}`
8
- raise unless $?.success?
8
+ raise "Command failed: #{cmd.inspect}" unless $?.success?
9
9
  output
10
10
  end
11
11
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 5
7
+ - 6
8
8
  - 0
9
- version: 0.5.0
9
+ version: 0.6.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Paul Gross
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-11 00:00:00 -05:00
17
+ date: 2010-06-08 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies: []
20
20