ext 1.1.3 → 2.1.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 +48 -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 +27 -21
- data/lib/externals/ext.rb +147 -175
- data/lib/externals/extensions/file_utils.rb +15 -15
- data/lib/externals/extensions/string.rb +7 -10
- data/lib/externals/project.rb +27 -41
- data/lib/externals/scms/git_project.rb +67 -54
- data/lib/externals/scms/svn_project.rb +55 -27
- data/version.rb +4 -0
- metadata +19 -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,18 +46,23 @@ 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
|
+
# simplecov:disable
|
|
55
57
|
raise "thought I found the row, but didn't"
|
|
58
|
+
# simplecov:enable
|
|
56
59
|
end
|
|
60
|
+
|
|
57
61
|
rows[found] = "#{$1}#{value}#{$2}"
|
|
58
62
|
else
|
|
59
63
|
rows << "#{key} = #{value}"
|
|
60
64
|
end
|
|
65
|
+
|
|
61
66
|
value
|
|
62
67
|
end
|
|
63
68
|
|
|
@@ -69,6 +74,7 @@ module Externals
|
|
|
69
74
|
rows.each_with_index do |row, index|
|
|
70
75
|
if row =~ SETTING_REGEX && key == $1
|
|
71
76
|
raise "found #{key} twice!" if found
|
|
77
|
+
|
|
72
78
|
found = index
|
|
73
79
|
end
|
|
74
80
|
end
|
|
@@ -76,8 +82,11 @@ module Externals
|
|
|
76
82
|
if found
|
|
77
83
|
value = self[key]
|
|
78
84
|
if rows[found] !~ SET_SETTING_REGEX
|
|
85
|
+
# simplecov:disable
|
|
79
86
|
raise "thought I found the row, but didn't"
|
|
87
|
+
# simplecov:enable
|
|
80
88
|
end
|
|
89
|
+
|
|
81
90
|
rows.delete rows[found]
|
|
82
91
|
end
|
|
83
92
|
value
|
|
@@ -86,17 +95,11 @@ module Externals
|
|
|
86
95
|
def [] key
|
|
87
96
|
setting(key)
|
|
88
97
|
end
|
|
98
|
+
|
|
89
99
|
def []= key, value
|
|
90
100
|
set_setting(key, value)
|
|
91
101
|
end
|
|
92
102
|
|
|
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
103
|
def to_s
|
|
101
104
|
"[#{title}]\n#{rows.join("\n")}"
|
|
102
105
|
end
|
|
@@ -117,7 +120,7 @@ module Externals
|
|
|
117
120
|
def []= title, hash
|
|
118
121
|
add_empty_section title
|
|
119
122
|
section = self[title]
|
|
120
|
-
hash.each_pair do |key,value|
|
|
123
|
+
hash.each_pair do |key, value|
|
|
121
124
|
section[key] = value
|
|
122
125
|
end
|
|
123
126
|
end
|
|
@@ -126,12 +129,14 @@ module Externals
|
|
|
126
129
|
sec = sections.detect{|section| section.title == sec}
|
|
127
130
|
|
|
128
131
|
raise "No section found in config file for #{sec}" unless sec
|
|
132
|
+
|
|
129
133
|
sections.delete(sec)
|
|
130
134
|
end
|
|
131
135
|
|
|
132
|
-
def add_empty_section
|
|
136
|
+
def add_empty_section title
|
|
133
137
|
raise "Section already exists" if self[title]
|
|
134
|
-
|
|
138
|
+
|
|
139
|
+
sections << Section.new("[#{title}]", "")
|
|
135
140
|
end
|
|
136
141
|
|
|
137
142
|
def removed_project_paths other_config
|
|
@@ -156,12 +161,14 @@ module Externals
|
|
|
156
161
|
file_string.each_line {|line| titles << line if line =~ SECTION_TITLE_REGEX}
|
|
157
162
|
bodies = file_string.split SECTION_TITLE_REGEX_NO_GROUPS
|
|
158
163
|
|
|
159
|
-
if titles.
|
|
164
|
+
if !titles.empty? && !bodies.empty?
|
|
160
165
|
if titles.size + 1 != bodies.size
|
|
166
|
+
# simplecov:disable
|
|
161
167
|
raise "bodies and sections do not match up"
|
|
168
|
+
# simplecov:enable
|
|
162
169
|
end
|
|
163
170
|
|
|
164
|
-
bodies = bodies[1..
|
|
171
|
+
bodies = bodies[1..]
|
|
165
172
|
|
|
166
173
|
(0...(bodies.size)).each do |index|
|
|
167
174
|
sections << Section.new(titles[index], bodies[index])
|
|
@@ -171,13 +178,12 @@ module Externals
|
|
|
171
178
|
|
|
172
179
|
def write path = ".externals"
|
|
173
180
|
raise "no path given" unless path
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
end
|
|
181
|
+
|
|
182
|
+
File.write(path, to_s)
|
|
177
183
|
end
|
|
178
184
|
|
|
179
185
|
def to_s
|
|
180
|
-
sections.
|
|
186
|
+
sections.join("\n\n")
|
|
181
187
|
end
|
|
182
188
|
end
|
|
183
189
|
end
|