git-p4-sync 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/LICENSE +4 -4
  2. data/README.rdoc +3 -1
  3. data/lib/git_p4_sync.rb +12 -7
  4. data/lib/init.rb +2 -0
  5. metadata +5 -13
  6. data/VERSION +0 -1
data/LICENSE CHANGED
@@ -1,5 +1,5 @@
1
- Copyright (c) 2009 Carl Mercier
2
-
1
+ Copyright (c) 2012 Carl Mercier
2
+
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
5
5
  "Software"), to deal in the Software without restriction, including
@@ -7,10 +7,10 @@ without limitation the rights to use, copy, modify, merge, publish,
7
7
  distribute, sublicense, and/or sell copies of the Software, and to
8
8
  permit persons to whom the Software is furnished to do so, subject to
9
9
  the following conditions:
10
-
10
+
11
11
  The above copyright notice and this permission notice shall be
12
12
  included in all copies or substantial portions of the Software.
13
-
13
+
14
14
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
15
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
16
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -30,9 +30,11 @@ To add addition items use the -i/--ignore flag. It can take a single item, or a
30
30
 
31
31
  == COPYRIGHT
32
32
 
33
- Copyright (c) 2009-2011 {Carl Mercier}[http://carlmercier.com]. See LICENSE for details.
33
+ Copyright (c) 2009-2012 {Carl Mercier}[http://carlmercier.com]. See LICENSE for details.
34
34
 
35
35
  == CONTRIBUTORS
36
36
 
37
37
  {Vincent Batts}[https://github.com/vbatts]
38
+ {Daniel Nugent}[https://github.com/DannoHung]
39
+
38
40
 
@@ -34,7 +34,7 @@ module GitP4Sync
34
34
  end
35
35
 
36
36
  if File.exist?(gitignore = File.join(git_path, ".gitignore"))
37
- @ignore_list = @ignore_list.concat(File.read(gitignore).split(/\n/).map {|i| i.gsub("*",".*") } )
37
+ @ignore_list = @ignore_list.concat(File.read(gitignore).split(/\n/).reject{|i| (i.size == 0) or i.strip.start_with?("#") }.map {|i| i.gsub("*",".*") } )
38
38
  end
39
39
 
40
40
  diff = diff_dirs(p4_path, git_path)
@@ -52,13 +52,18 @@ module GitP4Sync
52
52
  Dir.chdir(p4_path) do
53
53
  case action
54
54
  when :new
55
- run_cmd "cp -r #{git_path}#{file} #{p4_path}#{file}", simulate
56
- run_cmd "#{p4_add_recursively("#{p4_path}#{file}")}", simulate
55
+ run_cmd "cp -r '#{git_path}#{file}' '#{p4_path}#{file}'", simulate
56
+ run_cmd "#{p4_add_recursively("'#{p4_path}#{file}'")}", simulate
57
57
  when :deleted
58
- run_cmd "p4 delete #{p4_path}#{file}", simulate
58
+ file_path="#{p4_path}#{file}"
59
+ Find.find(file_path) do |f|
60
+ puts "DELETED in Git (dir contents): #{f}" if file_path != f
61
+ run_cmd("p4 delete '#{f}'", simulate)
62
+ end
63
+ FileUtils.remove_entry_secure(file_path,:force => true)
59
64
  when :modified
60
- run_cmd "p4 edit #{p4_path}#{file}", simulate
61
- run_cmd "cp #{git_path}#{file} #{p4_path}#{file}", simulate
65
+ run_cmd "p4 edit '#{p4_path}#{file}'", simulate
66
+ run_cmd "cp '#{git_path}#{file}' '#{p4_path}#{file}'", simulate
62
67
  else
63
68
  puts "Unknown change type #{action}. Stopping."
64
69
  exit 1
@@ -69,7 +74,7 @@ module GitP4Sync
69
74
  if submit
70
75
  git_head_commit = ""
71
76
  Dir.chdir(git_path) do
72
- git_head_commit = `git show --pretty=oneline`.split("\n")[0]
77
+ git_head_commit = `git show -v -s --pretty=oneline`.split("\n")[0]
73
78
  end
74
79
 
75
80
  Dir.chdir(p4_path) do
@@ -1,3 +1,5 @@
1
1
  require 'rubygems'
2
2
  require 'diff_dirs'
3
3
  require 'optparse'
4
+ require 'find'
5
+ require 'fileutils'
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-p4-sync
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 1
9
7
  - 2
10
- version: 0.1.2
8
+ - 0
9
+ version: 0.2.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Carl Mercier
@@ -15,18 +14,16 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-05-18 00:00:00 -04:00
17
+ date: 2012-06-18 00:00:00 -04:00
19
18
  default_executable: git-p4-sync
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: diff_dirs
23
22
  prerelease: false
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
25
  - - ">="
28
26
  - !ruby/object:Gem::Version
29
- hash: 31
30
27
  segments:
31
28
  - 0
32
29
  - 1
@@ -47,7 +44,6 @@ files:
47
44
  - LICENSE
48
45
  - README.rdoc
49
46
  - Rakefile
50
- - VERSION
51
47
  - bin/git-p4-sync
52
48
  - lib/git_p4_sync.rb
53
49
  - lib/init.rb
@@ -64,27 +60,23 @@ rdoc_options:
64
60
  require_paths:
65
61
  - lib
66
62
  required_ruby_version: !ruby/object:Gem::Requirement
67
- none: false
68
63
  requirements:
69
64
  - - ">="
70
65
  - !ruby/object:Gem::Version
71
- hash: 3
72
66
  segments:
73
67
  - 0
74
68
  version: "0"
75
69
  required_rubygems_version: !ruby/object:Gem::Requirement
76
- none: false
77
70
  requirements:
78
71
  - - ">="
79
72
  - !ruby/object:Gem::Version
80
- hash: 3
81
73
  segments:
82
74
  - 0
83
75
  version: "0"
84
76
  requirements: []
85
77
 
86
78
  rubyforge_project: git-p4-sync
87
- rubygems_version: 1.4.2
79
+ rubygems_version: 1.3.6
88
80
  signing_key:
89
81
  specification_version: 3
90
82
  summary: Submit changes made to a Git repository into to Perforce
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.2