agile_check_in 0.0.2 → 0.0.3
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.
- data/lib/agile_check_in.rb +35 -29
- data/lib/agile_check_in/git.rb +19 -0
- data/lib/agile_check_in/version.rb +1 -1
- metadata +2 -1
data/lib/agile_check_in.rb
CHANGED
@@ -1,54 +1,60 @@
|
|
1
1
|
require "agile_check_in/version"
|
2
|
+
require "agile_check_in/git"
|
2
3
|
require "yaml"
|
3
4
|
|
4
5
|
module AgileCheckIn
|
5
6
|
def self.incremental
|
6
7
|
pair_names = ""
|
7
8
|
story_number = ""
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
9
|
+
|
10
|
+
if Git.has_local_changes?
|
11
|
+
history_file = '/tmp/agile_check_in_history.yml'
|
12
|
+
if File.exists?(history_file)
|
13
|
+
shove_history = YAML::load(File.open(history_file))["shove"]
|
14
|
+
pair_names = shove_history["pair"]
|
15
|
+
story_number = shove_history["story"]
|
16
|
+
end
|
17
|
+
|
18
|
+
begin
|
19
|
+
$stdout.write "Pair names (separated with '/') [#{pair_names}]: "
|
20
|
+
input = $stdin.gets.strip
|
21
|
+
pair_names = input unless input.empty?
|
22
|
+
end until !pair_names.empty?
|
23
|
+
|
24
|
+
begin
|
25
|
+
$stdout.write "Story number [#{story_number}]: "
|
26
|
+
input = $stdin.gets.strip
|
27
|
+
story_number = input unless input.empty?
|
28
|
+
end until !story_number.empty?
|
29
|
+
|
30
|
+
File.open(history_file, 'w') do |out|
|
31
|
+
YAML.dump({ "shove" => { "pair" => pair_names, "story" => story_number } }, out)
|
32
|
+
end
|
33
|
+
|
34
|
+
commit_message = "[#{pair_names} - ##{story_number}] "
|
35
|
+
|
36
|
+
system("git add -A")
|
37
|
+
system("EDITOR=vim git commit -e -m '#{commit_message}'")
|
38
|
+
else
|
39
|
+
puts "No local changes to commit."
|
30
40
|
end
|
31
41
|
|
32
|
-
commit_message = "[#{pair_names} - ##{story_number}] "
|
33
|
-
|
34
|
-
system("git add -A")
|
35
|
-
system("EDITOR=vim git commit -e -m '#{commit_message}'")
|
36
42
|
end
|
37
43
|
|
38
44
|
def self.push_and_test
|
39
45
|
puts "*******"
|
40
46
|
puts "About to test these changes:"
|
41
|
-
puts
|
47
|
+
puts Git.local_commits
|
42
48
|
puts "*******"
|
43
49
|
|
44
50
|
|
45
51
|
if system("rake spec")
|
46
52
|
puts "*******"
|
47
53
|
puts "About to push these changes:"
|
48
|
-
puts
|
54
|
+
puts Git.local_commits
|
49
55
|
puts "*******"
|
50
56
|
puts "Shoving..."
|
51
|
-
system("git push
|
57
|
+
system("git push")
|
52
58
|
else
|
53
59
|
puts "Tests failed. Shove aborted."
|
54
60
|
exit(1)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module AgileCheckIn
|
2
|
+
module Git
|
3
|
+
def self.current_branch
|
4
|
+
`git branch --no-color 2> /dev/null`.split("\n")
|
5
|
+
.select{ |branch| branch.match(/\* /) }
|
6
|
+
.first
|
7
|
+
.split("* ")
|
8
|
+
.last
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.local_commits
|
12
|
+
`git log origin/#{current_branch}..HEAD`
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.has_local_changes?
|
16
|
+
!`git status`.match(/working directory clean/)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agile_check_in
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -31,6 +31,7 @@ files:
|
|
31
31
|
- bin/ci
|
32
32
|
- bin/cii
|
33
33
|
- lib/agile_check_in.rb
|
34
|
+
- lib/agile_check_in/git.rb
|
34
35
|
- lib/agile_check_in/version.rb
|
35
36
|
homepage: ''
|
36
37
|
licenses: []
|