ext 1.1.3 → 2.0.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG +44 -15
- data/LICENSE-MPL-2.0.txt +373 -0
- data/LICENSE.txt +9 -0
- data/README +5 -13
- data/lib/externals/command.rb +6 -5
- data/lib/externals/configuration/configuration.rb +26 -21
- data/lib/externals/ext.rb +147 -175
- data/lib/externals/extensions/file_utils.rb +11 -11
- data/lib/externals/extensions/string.rb +7 -10
- data/lib/externals/project.rb +27 -41
- data/lib/externals/scms/git_project.rb +64 -53
- data/lib/externals/scms/svn_project.rb +55 -27
- data/version.rb +4 -0
- metadata +23 -82
- data/MIT_LICENSE.txt +0 -22
- data/Rakefile +0 -77
- data/lib/externals/extensions/symbol.rb +0 -7
- data/lib/externals/project_types/rails.rb +0 -35
- data/test/setup/empty_plugin.svn.gz +0 -0
- data/test/setup/foreign_key_migrations.svn.gz +0 -0
- data/test/setup/redhillonrails_core.svn.gz +0 -0
- data/test/test_checkout_git.rb +0 -32
- data/test/test_checkout_with_subprojects_git.rb +0 -169
- data/test/test_checkout_with_subprojects_svn.rb +0 -384
- data/test/test_file_utils_extensions.rb +0 -29
- data/test/test_freeze_to_revision.rb +0 -176
- data/test/test_git_project_extract_name.rb +0 -20
- data/test/test_help.rb +0 -27
- data/test/test_init_git.rb +0 -62
- data/test/test_out_of_date_git_subproject.rb +0 -83
- data/test/test_projects.rb +0 -148
- data/test/test_rails_detection.rb +0 -23
- data/test/test_string_extensions.rb +0 -51
- data/test/test_svn_branches.rb +0 -353
- data/test/test_touch_emptydirs.rb +0 -59
- data/test/test_version.rb +0 -33
|
@@ -2,13 +2,13 @@ require 'fileutils'
|
|
|
2
2
|
|
|
3
3
|
FileUtils.class_eval do
|
|
4
4
|
# simulates cp -a
|
|
5
|
-
def cp_a source, dest, options
|
|
6
|
-
cp_r source, dest, options
|
|
5
|
+
def cp_a source, dest, **options
|
|
6
|
+
cp_r source, dest, **options, :preserve => true
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
# calls rm_rf if the file exists
|
|
10
|
-
def rm_rf_ie file, options
|
|
11
|
-
rm_rf
|
|
10
|
+
def rm_rf_ie file, **options
|
|
11
|
+
rm_rf(file, **options) if File.exist?(file)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
# calls rmdir if the file exists and is empty
|
|
@@ -21,15 +21,15 @@ FileUtils.class_eval do
|
|
|
21
21
|
rmdir path if File.exist?(path)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
alias_method :rm_rf_old, :rm_rf
|
|
25
25
|
#going to try to give a delay after calling rm if necessary...
|
|
26
|
-
def rm_rf *args
|
|
26
|
+
def rm_rf(filename, *args, **opts)
|
|
27
27
|
tries = 0
|
|
28
28
|
|
|
29
29
|
rm = proc do
|
|
30
|
-
rm_rf_old(*args)
|
|
30
|
+
rm_rf_old(filename, *args, **opts)
|
|
31
31
|
|
|
32
|
-
while File.exist?(
|
|
32
|
+
while File.exist?(filename) && tries < 10
|
|
33
33
|
# :nocov:
|
|
34
34
|
sleep 1
|
|
35
35
|
tries += 1
|
|
@@ -40,12 +40,12 @@ FileUtils.class_eval do
|
|
|
40
40
|
rm.call
|
|
41
41
|
if tries >= 10
|
|
42
42
|
# :nocov:
|
|
43
|
-
puts "WARNING: deleted #{
|
|
43
|
+
puts "WARNING: deleted #{filename} didn't work, trying again"
|
|
44
44
|
tries = 0
|
|
45
45
|
rm.call
|
|
46
46
|
|
|
47
47
|
if tries >= 10
|
|
48
|
-
raise "Could not delete #{
|
|
48
|
+
raise "Could not delete #{filename}"
|
|
49
49
|
end
|
|
50
50
|
# :nocov:
|
|
51
51
|
end
|
|
@@ -54,6 +54,6 @@ FileUtils.class_eval do
|
|
|
54
54
|
def dir_empty? path
|
|
55
55
|
File.directory?(path) &&
|
|
56
56
|
File.exist?(path) &&
|
|
57
|
-
!Dir.entries(path).detect{|entry| !["..","."].include?(entry)}
|
|
57
|
+
!Dir.entries(path).detect{|entry| !["..", "."].include?(entry)}
|
|
58
58
|
end
|
|
59
59
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
String.class_eval do
|
|
2
2
|
def cap_first
|
|
3
|
-
"#{self[0].chr.upcase}#{self[1..
|
|
3
|
+
"#{self[0].chr.upcase}#{self[1..]}"
|
|
4
4
|
end
|
|
5
5
|
|
|
6
6
|
def classify
|
|
@@ -8,24 +8,22 @@ String.class_eval do
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
#avoid collision
|
|
11
|
-
raise if
|
|
11
|
+
raise if method_defined?("lines_by_width")
|
|
12
|
+
|
|
12
13
|
def lines_by_width(width = 32)
|
|
13
14
|
width ||= 32
|
|
14
15
|
lines = []
|
|
15
16
|
string = gsub(/\s+/, ' ')
|
|
16
|
-
|
|
17
|
+
until string.empty?
|
|
17
18
|
if string.size <= width
|
|
18
19
|
lines << string
|
|
19
20
|
string = ""
|
|
20
21
|
else
|
|
21
22
|
index = string[0, width + 1].rindex(/\s/)
|
|
22
|
-
|
|
23
|
-
# let's find the first space we can.
|
|
24
|
-
index = string.index(/\s/)
|
|
25
|
-
end
|
|
23
|
+
index ||= string.index(/\s/)
|
|
26
24
|
if index
|
|
27
25
|
lines << string[0, index]
|
|
28
|
-
string = string[(index + 1)
|
|
26
|
+
string = string[(index + 1)..]
|
|
29
27
|
else
|
|
30
28
|
lines << string
|
|
31
29
|
string = ""
|
|
@@ -35,5 +33,4 @@ String.class_eval do
|
|
|
35
33
|
|
|
36
34
|
lines
|
|
37
35
|
end
|
|
38
|
-
|
|
39
|
-
end
|
|
36
|
+
end
|
data/lib/externals/project.rb
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
require 'externals/extensions/symbol'
|
|
2
1
|
require 'fileutils'
|
|
3
2
|
|
|
4
3
|
module Externals
|
|
5
|
-
OPTS_SUFFIXES = ["co", "up", "st", "ex"]
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
OPTS_SUFFIXES = ["co", "up", "st", "ex"].freeze unless const_defined?('OPTS_SUFFIXES')
|
|
5
|
+
unless const_defined?('VALID_ATTRIB')
|
|
6
|
+
VALID_ATTRIB = [
|
|
7
|
+
:name, :path, :repository, :branch, :scm, :revision
|
|
8
|
+
].map(&:to_s)
|
|
9
|
+
end
|
|
10
10
|
|
|
11
11
|
class Project
|
|
12
12
|
attr_accessor :parent
|
|
13
|
+
|
|
13
14
|
include FileUtils
|
|
14
15
|
extend FileUtils
|
|
15
16
|
|
|
@@ -20,20 +21,22 @@ module Externals
|
|
|
20
21
|
attributes[name.to_sym] = value
|
|
21
22
|
end
|
|
22
23
|
next if name == "name" || name == "scm"
|
|
24
|
+
|
|
23
25
|
define_method name do
|
|
24
26
|
attributes[name.to_sym]
|
|
25
27
|
end
|
|
26
28
|
end
|
|
27
29
|
end
|
|
28
30
|
|
|
29
|
-
|
|
30
31
|
attr_attr_accessor Externals::VALID_ATTRIB
|
|
31
32
|
def attributes
|
|
32
33
|
@attributes ||= {}
|
|
33
34
|
end
|
|
35
|
+
|
|
34
36
|
def name
|
|
35
37
|
attributes[:name] || extract_name(repository)
|
|
36
38
|
end
|
|
39
|
+
|
|
37
40
|
def main_project?
|
|
38
41
|
path == '.'
|
|
39
42
|
end
|
|
@@ -48,25 +51,18 @@ module Externals
|
|
|
48
51
|
self.class.scm
|
|
49
52
|
end
|
|
50
53
|
|
|
51
|
-
def
|
|
52
|
-
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def default_branch
|
|
56
|
-
self.class.default_branch
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def switch branch_name, options = {}
|
|
54
|
+
def switch _branch_name, _options = {}
|
|
55
|
+
# :nocov:
|
|
60
56
|
raise "subclass responsibility"
|
|
57
|
+
# :nocov:
|
|
61
58
|
end
|
|
62
59
|
|
|
63
60
|
def initialize hash
|
|
64
61
|
raise "Abstract class" if self.class == Project
|
|
65
62
|
raise "expected hash" unless hash.is_a? Hash
|
|
66
63
|
|
|
67
|
-
hash = hash.keys.
|
|
68
|
-
|
|
69
|
-
new_hash
|
|
64
|
+
hash = hash.keys.to_h do |key|
|
|
65
|
+
[key.to_s, hash[key]]
|
|
70
66
|
end
|
|
71
67
|
|
|
72
68
|
invalid_attrib = hash.keys - Externals::VALID_ATTRIB
|
|
@@ -76,25 +72,26 @@ module Externals
|
|
|
76
72
|
attribute =~ /^\w+_opts(_(#{OPTS_SUFFIXES.join("|")}))?/
|
|
77
73
|
end
|
|
78
74
|
if !invalid_attrib.empty?
|
|
75
|
+
# :nocov:
|
|
79
76
|
raise "invalid attribute(s): #{invalid_attrib.join(', ')}"
|
|
77
|
+
# :nocov:
|
|
80
78
|
end
|
|
81
79
|
end
|
|
82
80
|
|
|
83
81
|
path = hash.delete('path')
|
|
84
82
|
|
|
85
|
-
hash.
|
|
86
|
-
send("#{key}=",
|
|
83
|
+
hash.each_pair do |key, value|
|
|
84
|
+
send("#{key}=", value)
|
|
87
85
|
end
|
|
88
86
|
|
|
89
|
-
if path && !path.is_a?(String)
|
|
90
|
-
path = path.default_path(name)
|
|
91
|
-
end
|
|
92
87
|
self.path = path
|
|
93
88
|
end
|
|
94
89
|
|
|
95
90
|
[:co, :ex].each do |method_name|
|
|
96
|
-
define_method method_name do
|
|
91
|
+
define_method method_name do
|
|
92
|
+
# :nocov:
|
|
97
93
|
raise "subclass responsibility"
|
|
94
|
+
# :nocov:
|
|
98
95
|
end
|
|
99
96
|
end
|
|
100
97
|
|
|
@@ -173,8 +170,9 @@ module Externals
|
|
|
173
170
|
end
|
|
174
171
|
end
|
|
175
172
|
|
|
176
|
-
|
|
177
173
|
def self.inherited child
|
|
174
|
+
super
|
|
175
|
+
|
|
178
176
|
child.class_eval do
|
|
179
177
|
def self.scm
|
|
180
178
|
@scm ||= /^([^:]*::)*([^:]+)Project$/.match(name)[2].downcase
|
|
@@ -190,19 +188,16 @@ module Externals
|
|
|
190
188
|
#of the suffixed versions (<scm_name>_opts_co) as well as the project
|
|
191
189
|
#specific ones. (scm_opts, scm_opts_co, etc)
|
|
192
190
|
scm_name = scm
|
|
193
|
-
Project.__send__(:define_method, "#{scm_name}_opts_raw") do
|
|
194
|
-
attributes[name.to_sym]
|
|
195
|
-
end
|
|
196
191
|
#global settings are fetched from the parent project.
|
|
197
192
|
Project.__send__(:define_method, "#{scm_name}_opts") do
|
|
198
193
|
if parent
|
|
199
194
|
parent.__send__("#{scm_name}_opts")
|
|
200
195
|
else
|
|
201
|
-
attributes["#{scm_name}_opts"
|
|
196
|
+
attributes[:"#{scm_name}_opts"]
|
|
202
197
|
end
|
|
203
198
|
end
|
|
204
199
|
Project.__send__(:define_method, "#{scm_name}_opts=") do |value|
|
|
205
|
-
attributes["#{scm_name}_opts"
|
|
200
|
+
attributes[:"#{scm_name}_opts"] = value
|
|
206
201
|
end
|
|
207
202
|
|
|
208
203
|
#now we create the suffixed version of the global settings.
|
|
@@ -216,7 +211,7 @@ module Externals
|
|
|
216
211
|
else
|
|
217
212
|
values = [
|
|
218
213
|
attributes[name.to_sym],
|
|
219
|
-
|
|
214
|
+
send("#{scm_name}_opts")
|
|
220
215
|
].compact
|
|
221
216
|
|
|
222
217
|
if !values.empty?
|
|
@@ -232,15 +227,6 @@ module Externals
|
|
|
232
227
|
end
|
|
233
228
|
|
|
234
229
|
protected
|
|
235
|
-
def trim_quotes value
|
|
236
|
-
if value
|
|
237
|
-
if [value[0].chr, value[-1].chr] == ['"', '"']
|
|
238
|
-
value[1..-2]
|
|
239
|
-
else
|
|
240
|
-
value
|
|
241
|
-
end
|
|
242
|
-
end
|
|
243
|
-
end
|
|
244
230
|
|
|
245
231
|
#helper method for converting "co" into "scm_opts_co" and "" into "scm_opts"
|
|
246
232
|
def resolve_opts command = ""
|
|
@@ -2,11 +2,8 @@ require File.join(File.dirname(__FILE__), '..', 'project')
|
|
|
2
2
|
|
|
3
3
|
module Externals
|
|
4
4
|
class GitProject < Project
|
|
5
|
-
def default_branch
|
|
6
|
-
'master'
|
|
7
|
-
end
|
|
8
|
-
|
|
9
5
|
private
|
|
6
|
+
|
|
10
7
|
def do_clone command, extra_opts = ""
|
|
11
8
|
opts = resolve_opts(command)
|
|
12
9
|
|
|
@@ -22,25 +19,30 @@ module Externals
|
|
|
22
19
|
puts(gitclonecmd = "git #{opts} clone #{extra_opts} \"#{repository}\" #{dest}")
|
|
23
20
|
puts `#{gitclonecmd}`
|
|
24
21
|
unless $? == 0
|
|
22
|
+
# :nocov:
|
|
25
23
|
raise "git clone of #{repository} failed."
|
|
24
|
+
# :nocov:
|
|
26
25
|
end
|
|
27
26
|
end
|
|
28
27
|
|
|
29
28
|
public
|
|
30
|
-
|
|
29
|
+
|
|
30
|
+
def co *_args
|
|
31
31
|
do_up "co"
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
private
|
|
35
|
+
|
|
35
36
|
# make sure you have already entered Dir.chdir(path) in your calling code!
|
|
36
37
|
def branch_exists branch_name
|
|
37
38
|
opts = resolve_opts
|
|
38
|
-
`git #{opts} branch -a` =~
|
|
39
|
+
`git #{opts} branch -a` =~ /^[\s*]*#{branch_name}\s*$/
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
# make sure you have already entered Dir.chdir(path) in your calling code!
|
|
42
43
|
|
|
43
44
|
public
|
|
45
|
+
|
|
44
46
|
# this method fetches/pulls/changes branches/changes revisions/changes the oil in your geo metro/brings world peace
|
|
45
47
|
def change_to_branch_revision command = ""
|
|
46
48
|
opts = resolve_opts(command)
|
|
@@ -48,16 +50,15 @@ module Externals
|
|
|
48
50
|
pulled = false
|
|
49
51
|
|
|
50
52
|
project_path = if path == "."
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
name || "."
|
|
54
|
+
else
|
|
55
|
+
path
|
|
56
|
+
end
|
|
55
57
|
|
|
56
58
|
Dir.chdir project_path do
|
|
57
59
|
do_fetch command
|
|
58
60
|
end
|
|
59
61
|
|
|
60
|
-
|
|
61
62
|
if branch
|
|
62
63
|
cb = current_branch
|
|
63
64
|
|
|
@@ -78,7 +79,9 @@ module Externals
|
|
|
78
79
|
puts `git #{opts} checkout --track -b #{branch} origin/#{branch}`
|
|
79
80
|
end
|
|
80
81
|
unless $? == 0
|
|
82
|
+
# :nocov:
|
|
81
83
|
raise "Could not checkout origin/#{branch}"
|
|
84
|
+
# :nocov:
|
|
82
85
|
end
|
|
83
86
|
end
|
|
84
87
|
end
|
|
@@ -87,6 +90,7 @@ module Externals
|
|
|
87
90
|
Dir.chdir project_path do
|
|
88
91
|
`git #{opts} pull`
|
|
89
92
|
raise unless $? == 0
|
|
93
|
+
|
|
90
94
|
pulled = true
|
|
91
95
|
end
|
|
92
96
|
end
|
|
@@ -95,7 +99,9 @@ module Externals
|
|
|
95
99
|
Dir.chdir project_path do
|
|
96
100
|
puts `git #{opts} checkout #{revision}`
|
|
97
101
|
unless $? == 0
|
|
102
|
+
# :nocov:
|
|
98
103
|
raise "Could not checkout #{revision}"
|
|
104
|
+
# :nocov:
|
|
99
105
|
end
|
|
100
106
|
end
|
|
101
107
|
else
|
|
@@ -108,29 +114,25 @@ module Externals
|
|
|
108
114
|
end
|
|
109
115
|
end
|
|
110
116
|
|
|
111
|
-
def switch branch_name,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
#
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
# and if not, fetch it.
|
|
121
|
-
if !branch_exists("origin/#{branch_name}")
|
|
122
|
-
puts `git #{scm_opts} fetch`
|
|
123
|
-
end
|
|
117
|
+
def switch branch_name, _options = {}
|
|
118
|
+
# This allows the main project to be checked out to a directory
|
|
119
|
+
# that doesn't match it's name.
|
|
120
|
+
Dir.chdir path do
|
|
121
|
+
# let's see if the branch exists in the remote repository
|
|
122
|
+
# and if not, fetch it.
|
|
123
|
+
if !branch_exists("origin/#{branch_name}")
|
|
124
|
+
puts `git #{scm_opts} fetch`
|
|
125
|
+
end
|
|
124
126
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
127
|
+
if branch_exists(branch_name)
|
|
128
|
+
puts `git #{scm_opts} checkout #{branch_name}`
|
|
129
|
+
else
|
|
130
|
+
puts `git #{resolve_opts("co")} checkout --track -b #{branch_name}`
|
|
131
|
+
end
|
|
132
|
+
unless $? == 0
|
|
133
|
+
# :nocov:
|
|
134
|
+
raise "Could not checkout origin/#{branch_name}"
|
|
135
|
+
# :nocov:
|
|
134
136
|
end
|
|
135
137
|
end
|
|
136
138
|
end
|
|
@@ -149,11 +151,12 @@ module Externals
|
|
|
149
151
|
end
|
|
150
152
|
end
|
|
151
153
|
|
|
152
|
-
def up *
|
|
154
|
+
def up *_args
|
|
153
155
|
do_up "up"
|
|
154
156
|
end
|
|
155
157
|
|
|
156
158
|
private
|
|
159
|
+
|
|
157
160
|
def do_fetch command
|
|
158
161
|
opts = resolve_opts(command)
|
|
159
162
|
`git #{opts} fetch`
|
|
@@ -162,15 +165,15 @@ module Externals
|
|
|
162
165
|
|
|
163
166
|
def do_up command
|
|
164
167
|
project_path = if path == "."
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
168
|
+
name || "." # if no name is specified then we are expected to already be in the right path.
|
|
169
|
+
# this is a little confusing and should be cleaned up.
|
|
170
|
+
# When we are doing a checkout, the name is set manually in Ext.checkout.
|
|
171
|
+
# we are then in the parent directory.
|
|
172
|
+
# When we are doing an update, the main project has no name.
|
|
173
|
+
# we are then in the correct directory.
|
|
174
|
+
else
|
|
175
|
+
path
|
|
176
|
+
end
|
|
174
177
|
|
|
175
178
|
puts "Updating #{path}..."
|
|
176
179
|
|
|
@@ -181,7 +184,8 @@ module Externals
|
|
|
181
184
|
end
|
|
182
185
|
|
|
183
186
|
public
|
|
184
|
-
|
|
187
|
+
|
|
188
|
+
def st *_args
|
|
185
189
|
puts "\nstatus for #{path}:"
|
|
186
190
|
Dir.chdir path do
|
|
187
191
|
puts `git #{scm_opts_st} status`
|
|
@@ -194,8 +198,8 @@ module Externals
|
|
|
194
198
|
|
|
195
199
|
def self.fill_in_opts opts, main_options, sub_options, options
|
|
196
200
|
opts.on("--git", "-g",
|
|
197
|
-
|
|
198
|
-
|
|
201
|
+
Integer,
|
|
202
|
+
*"same as '--scm git' Uses git to
|
|
199
203
|
checkout/export the main project".lines_by_width(options[:summary_width])
|
|
200
204
|
) {sub_options[:scm] = main_options[:scm] = 'git'}
|
|
201
205
|
end
|
|
@@ -205,18 +209,22 @@ module Externals
|
|
|
205
209
|
end
|
|
206
210
|
|
|
207
211
|
#this is a test helper method
|
|
212
|
+
# TODO: can we move it to the test suite, then?
|
|
208
213
|
def self.add_all
|
|
214
|
+
# :nocov:
|
|
209
215
|
puts `git add .`
|
|
210
216
|
raise unless $? == 0
|
|
217
|
+
# :nocov:
|
|
211
218
|
end
|
|
212
219
|
|
|
213
220
|
def ignore_contains? path
|
|
214
221
|
text = ignore_text(path)
|
|
215
|
-
text.split(
|
|
222
|
+
text.split("\n").detect {|r| r.strip == path.strip}
|
|
216
223
|
end
|
|
217
224
|
|
|
218
|
-
def ignore_text(
|
|
225
|
+
def ignore_text(_path = nil)
|
|
219
226
|
return '' unless File.exist?('.gitignore')
|
|
227
|
+
|
|
220
228
|
retval = ''
|
|
221
229
|
open('.gitignore') do |f|
|
|
222
230
|
retval = f.read
|
|
@@ -227,7 +235,7 @@ module Externals
|
|
|
227
235
|
def ignore_rows(path)
|
|
228
236
|
rows = ignore_text(path) || ''
|
|
229
237
|
|
|
230
|
-
rows = rows.split(
|
|
238
|
+
rows = rows.split("\n")
|
|
231
239
|
|
|
232
240
|
rows.delete_if {|row| row =~ /^\s*$/}
|
|
233
241
|
|
|
@@ -248,14 +256,18 @@ module Externals
|
|
|
248
256
|
|
|
249
257
|
def drop_from_ignore path
|
|
250
258
|
ir = ignore_rows(path)
|
|
251
|
-
rows = ir.
|
|
259
|
+
rows = ir.reject {|row| row.strip == path.strip}
|
|
252
260
|
|
|
253
261
|
if rows.size == ir.size
|
|
262
|
+
# :nocov:
|
|
254
263
|
raise "row not found matching #{path} in .gitignore"
|
|
264
|
+
# :nocov:
|
|
255
265
|
end
|
|
256
266
|
|
|
257
267
|
if ir.size - rows.size != 1
|
|
268
|
+
# :nocov:
|
|
258
269
|
raise "More than one row found matching #{path} in .gitignore"
|
|
270
|
+
# :nocov:
|
|
259
271
|
end
|
|
260
272
|
|
|
261
273
|
open('.gitignore', 'w') do |f|
|
|
@@ -279,11 +291,10 @@ module Externals
|
|
|
279
291
|
end
|
|
280
292
|
end
|
|
281
293
|
|
|
282
|
-
def extract_name
|
|
283
|
-
if
|
|
294
|
+
def extract_name string
|
|
295
|
+
if string =~ /([^\/:]+?)(?:\.git|\.bundle)?$/
|
|
284
296
|
$1
|
|
285
297
|
end
|
|
286
298
|
end
|
|
287
|
-
|
|
288
299
|
end
|
|
289
300
|
end
|