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.
- data/README.rdoc +19 -18
- data/bin/rake_commit +0 -0
- data/lib/git.rb +7 -2
- data/lib/shell.rb +1 -1
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -1,21 +1,18 @@
|
|
1
|
-
=
|
1
|
+
= rake_commit
|
2
2
|
|
3
|
-
This
|
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.
|
12
|
-
2.
|
13
|
-
3.
|
14
|
-
4.
|
15
|
-
5.
|
16
|
-
6.
|
17
|
-
7.
|
18
|
-
8.
|
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
|
-
|
47
|
-
|
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
|
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")
|
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
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 6
|
8
8
|
- 0
|
9
|
-
version: 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-
|
17
|
+
date: 2010-06-08 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|