pivo_flow 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@ if File.exists?(story_path)
5
5
  if story_id =~ /(\d{7,})/
6
6
  puts IO.read(ARGV[0])
7
7
  commit_msg = IO.read(ARGV[0])
8
- unless commit_msg.include?($1)
8
+ unless commit_msg.include?($1) or commit_msg =~ /Merge branch/
9
9
  File.open(ARGV[0], 'w') do |file|
10
10
  file.print commit_msg
11
11
  file.print "[##{$1}]"
@@ -28,6 +28,7 @@ module PivoFlow
28
28
  @git_hook_path = File.join(@git_dir, 'hooks', 'prepare-commit-msg')
29
29
  @pf_git_hook_name = 'pf-prepare-commit-msg'
30
30
  @pf_git_hook_path = File.join(@git_dir, 'hooks', @pf_git_hook_name)
31
+ @pf_git_hook_local_path = File.join(File.dirname(__FILE__), '..', '..', 'bin', @pf_git_hook_name)
31
32
  @pf_git_hook_cmd = "#{@pf_git_hook_path} $1"
32
33
  @options[:repository] = Grit::Repo.new(@git_dir)
33
34
 
@@ -38,7 +39,11 @@ module PivoFlow
38
39
 
39
40
  # Check if git hook is already installed
40
41
  def git_hook_needed?
41
- !File.executable?(@git_hook_path) || !File.read(@git_hook_path).match(/#{@pf_git_hook_name} \$1/)
42
+ !File.executable?(@git_hook_path) || !File.read(@git_hook_path).match(/#{@pf_git_hook_name} \$1/) || !pf_git_hook_valid?
43
+ end
44
+
45
+ def pf_git_hook_valid?
46
+ File.executable?(@pf_git_hook_path) && File.read(@pf_git_hook_path).match(File.read(@pf_git_hook_local_path))
42
47
  end
43
48
 
44
49
  def git_directory_present?
@@ -51,11 +56,10 @@ module PivoFlow
51
56
  # helpful if user has his custom hooks)
52
57
  def install_git_hook
53
58
  puts "Installing prepare-commit-msg hook..."
54
- hook_path = File.join(File.dirname(__FILE__), '..', '..', 'bin', @pf_git_hook_name)
55
59
  FileUtils.mkdir_p(File.dirname(@pf_git_hook_path))
56
- FileUtils.cp(hook_path, @pf_git_hook_path, preserve: true)
60
+ FileUtils.cp(@pf_git_hook_local_path, @pf_git_hook_path, preserve: true)
57
61
  puts "File copied..."
58
- unless File.exists?(@git_hook_path) && File.read(@git_hook_path).match(@pf_git_hook_cmd)
62
+ unless File.exists?(@git_hook_path) && File.read(@git_hook_path).match(@pf_git_hook_name)
59
63
  File.open(@git_hook_path, "a") { |f| f.puts(@pf_git_hook_cmd) }
60
64
  puts "Reference to pf-prepare-commit-msg added to prepare-commit-msg..."
61
65
  end
@@ -1,3 +1,3 @@
1
1
  module PivoFlow
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pivo_flow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: