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
|
@@ -3,7 +3,6 @@ module Externals
|
|
|
3
3
|
SECTION_TITLE_REGEX_NO_GROUPS = /^\s*\[(?:[^\]]*)\]\s*$/
|
|
4
4
|
SECTION_TITLE_REGEX = /^\s*\[([^\]]*)\]\s*$/
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
class Section
|
|
8
7
|
attr_accessor :title_string, :body_string, :title, :rows
|
|
9
8
|
|
|
@@ -15,12 +14,11 @@ module Externals
|
|
|
15
14
|
|
|
16
15
|
raise "Invalid section title: #{title_string}" unless title
|
|
17
16
|
|
|
18
|
-
self.rows = body_string.strip.split(
|
|
17
|
+
self.rows = body_string.strip.split("\n")
|
|
19
18
|
end
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
SET_SETTING_REGEX = /^(\s*(?:[\.\w-]+)\s*=\s*)(?:[^#\n]*)(#[^\n]*)?$/
|
|
20
|
+
SETTING_REGEX = /^\s*([.\w-]+)\s*=\s*([^#\n]*)(?:#[^\n]*)?$/
|
|
21
|
+
SET_SETTING_REGEX = /^(\s*(?:[.\w-]+)\s*=\s*)(?:[^#\n]*)(#[^\n]*)?$/
|
|
24
22
|
|
|
25
23
|
def attributes
|
|
26
24
|
retval = {}
|
|
@@ -31,6 +29,7 @@ module Externals
|
|
|
31
29
|
end
|
|
32
30
|
retval
|
|
33
31
|
end
|
|
32
|
+
|
|
34
33
|
def setting key
|
|
35
34
|
rows.each do |row|
|
|
36
35
|
if row =~ SETTING_REGEX && key.to_s == $1
|
|
@@ -39,6 +38,7 @@ module Externals
|
|
|
39
38
|
end
|
|
40
39
|
nil
|
|
41
40
|
end
|
|
41
|
+
|
|
42
42
|
def set_setting key, value
|
|
43
43
|
key = key.to_s
|
|
44
44
|
found = nil
|
|
@@ -46,14 +46,18 @@ module Externals
|
|
|
46
46
|
rows.each_with_index do |row, index|
|
|
47
47
|
if row =~ SETTING_REGEX && key == $1
|
|
48
48
|
raise "found #{key} twice!" if found
|
|
49
|
+
|
|
49
50
|
found = index
|
|
50
51
|
end
|
|
51
52
|
end
|
|
52
53
|
|
|
53
54
|
if found
|
|
54
55
|
if rows[found] !~ SET_SETTING_REGEX
|
|
56
|
+
# :nocov:
|
|
55
57
|
raise "thought I found the row, but didn't"
|
|
58
|
+
# :nocov:
|
|
56
59
|
end
|
|
60
|
+
|
|
57
61
|
rows[found] = "#{$1}#{value}#{$2}"
|
|
58
62
|
else
|
|
59
63
|
rows << "#{key} = #{value}"
|
|
@@ -69,6 +73,7 @@ module Externals
|
|
|
69
73
|
rows.each_with_index do |row, index|
|
|
70
74
|
if row =~ SETTING_REGEX && key == $1
|
|
71
75
|
raise "found #{key} twice!" if found
|
|
76
|
+
|
|
72
77
|
found = index
|
|
73
78
|
end
|
|
74
79
|
end
|
|
@@ -76,8 +81,11 @@ module Externals
|
|
|
76
81
|
if found
|
|
77
82
|
value = self[key]
|
|
78
83
|
if rows[found] !~ SET_SETTING_REGEX
|
|
84
|
+
# :nocov:
|
|
79
85
|
raise "thought I found the row, but didn't"
|
|
86
|
+
# :nocov:
|
|
80
87
|
end
|
|
88
|
+
|
|
81
89
|
rows.delete rows[found]
|
|
82
90
|
end
|
|
83
91
|
value
|
|
@@ -86,17 +94,11 @@ module Externals
|
|
|
86
94
|
def [] key
|
|
87
95
|
setting(key)
|
|
88
96
|
end
|
|
97
|
+
|
|
89
98
|
def []= key, value
|
|
90
99
|
set_setting(key, value)
|
|
91
100
|
end
|
|
92
101
|
|
|
93
|
-
def add_row(row)
|
|
94
|
-
rows << row
|
|
95
|
-
|
|
96
|
-
self.body_string = body_string.chomp + "\n#{row}\n"
|
|
97
|
-
#clear_caches
|
|
98
|
-
end
|
|
99
|
-
|
|
100
102
|
def to_s
|
|
101
103
|
"[#{title}]\n#{rows.join("\n")}"
|
|
102
104
|
end
|
|
@@ -117,7 +119,7 @@ module Externals
|
|
|
117
119
|
def []= title, hash
|
|
118
120
|
add_empty_section title
|
|
119
121
|
section = self[title]
|
|
120
|
-
hash.each_pair do |key,value|
|
|
122
|
+
hash.each_pair do |key, value|
|
|
121
123
|
section[key] = value
|
|
122
124
|
end
|
|
123
125
|
end
|
|
@@ -126,12 +128,14 @@ module Externals
|
|
|
126
128
|
sec = sections.detect{|section| section.title == sec}
|
|
127
129
|
|
|
128
130
|
raise "No section found in config file for #{sec}" unless sec
|
|
131
|
+
|
|
129
132
|
sections.delete(sec)
|
|
130
133
|
end
|
|
131
134
|
|
|
132
|
-
def add_empty_section
|
|
135
|
+
def add_empty_section title
|
|
133
136
|
raise "Section already exists" if self[title]
|
|
134
|
-
|
|
137
|
+
|
|
138
|
+
sections << Section.new("[#{title}]", "")
|
|
135
139
|
end
|
|
136
140
|
|
|
137
141
|
def removed_project_paths other_config
|
|
@@ -156,12 +160,14 @@ module Externals
|
|
|
156
160
|
file_string.each_line {|line| titles << line if line =~ SECTION_TITLE_REGEX}
|
|
157
161
|
bodies = file_string.split SECTION_TITLE_REGEX_NO_GROUPS
|
|
158
162
|
|
|
159
|
-
if titles.
|
|
163
|
+
if !titles.empty? && !bodies.empty?
|
|
160
164
|
if titles.size + 1 != bodies.size
|
|
165
|
+
# :nocov:
|
|
161
166
|
raise "bodies and sections do not match up"
|
|
167
|
+
# :nocov:
|
|
162
168
|
end
|
|
163
169
|
|
|
164
|
-
bodies = bodies[1..
|
|
170
|
+
bodies = bodies[1..]
|
|
165
171
|
|
|
166
172
|
(0...(bodies.size)).each do |index|
|
|
167
173
|
sections << Section.new(titles[index], bodies[index])
|
|
@@ -171,13 +177,12 @@ module Externals
|
|
|
171
177
|
|
|
172
178
|
def write path = ".externals"
|
|
173
179
|
raise "no path given" unless path
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
end
|
|
180
|
+
|
|
181
|
+
File.write(path, to_s)
|
|
177
182
|
end
|
|
178
183
|
|
|
179
184
|
def to_s
|
|
180
|
-
sections.
|
|
185
|
+
sections.join("\n\n")
|
|
181
186
|
end
|
|
182
187
|
end
|
|
183
188
|
end
|