mspac 0.1.6 → 0.1.7
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/bin/mspac +134 -58
- data/lib/mspac/pellet.rb +1 -0
- data/lib/mspac/version_control.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d5a3955b6bd3f52aeb79bcd9203ba0e18761100
|
4
|
+
data.tar.gz: 58d343c04ae9e2839dabb5ae40d50ea6a6a8d2d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01cc8be8b59bb4ec74aa751b0f73235ca0d13405ca2fee19b7585d5895a4d09c5746d8dc2a9fd8a81d1ea59a3ef850e02abf20b2f43323eb80b97a28a134f7c0
|
7
|
+
data.tar.gz: e190d0e2d9ef39a93cde48d73b9e57b227c6779fa5a056755db47eb660db9c4c614e7e0b17d36b16b082622eb96dd617c125e6872bf546ec01f27d505c8e4e6d
|
data/bin/mspac
CHANGED
@@ -26,13 +26,18 @@ end
|
|
26
26
|
|
27
27
|
def parse(args)
|
28
28
|
options = Hash.new
|
29
|
+
options["operation"] = nil
|
30
|
+
|
31
|
+
# Sync options
|
29
32
|
options["clean"] = false
|
30
33
|
options["force"] = false
|
31
|
-
options["nosave"] = false
|
32
|
-
options["operation"] = nil
|
33
34
|
options["refresh"] = false
|
35
|
+
options["regex"] = false
|
34
36
|
options["upgrade"] = false
|
35
37
|
|
38
|
+
# Remove options
|
39
|
+
options["nosave"] = false
|
40
|
+
|
36
41
|
parser = OptionParser.new do |opts|
|
37
42
|
opts.banner =
|
38
43
|
"Usage: #{File.basename($0)} <operation> [OPTIONS] " \
|
@@ -101,12 +106,7 @@ def parse(args)
|
|
101
106
|
"Remove pellets that are no longer installed",
|
102
107
|
"from the cache"
|
103
108
|
) do
|
104
|
-
|
105
|
-
options["clean"] = true
|
106
|
-
else
|
107
|
-
puts opts
|
108
|
-
exit MsPacExit::INVALID_OPERATION
|
109
|
-
end
|
109
|
+
options["clean"] = true
|
110
110
|
end
|
111
111
|
|
112
112
|
opts.on(
|
@@ -114,65 +114,30 @@ def parse(args)
|
|
114
114
|
"--force",
|
115
115
|
"Force a reinstall/recompilation of the pellet"
|
116
116
|
) do
|
117
|
-
|
118
|
-
options["force"] = true
|
119
|
-
else
|
120
|
-
puts opts
|
121
|
-
exit MsPacExit::INVALID_OPERATION
|
122
|
-
end
|
117
|
+
options["force"] = true
|
123
118
|
end
|
124
119
|
|
125
120
|
opts.on(
|
126
121
|
"-s",
|
127
|
-
"--search
|
122
|
+
"--search",
|
128
123
|
"Search each pellet for names matching the",
|
129
124
|
"provided regex and display them"
|
130
|
-
) do
|
131
|
-
|
132
|
-
(options["operation"] == Operation::SYNC) &&
|
133
|
-
!options["upgrade"]
|
134
|
-
)
|
135
|
-
options["regex"] = regex
|
136
|
-
else
|
137
|
-
puts opts
|
138
|
-
exit MsPacExit::INVALID_OPERATION
|
139
|
-
end
|
125
|
+
) do
|
126
|
+
options["regex"] = true
|
140
127
|
end
|
141
128
|
|
142
129
|
opts.on("-u", "--sysupgrade", "Upgrade all pellets") do
|
143
|
-
|
144
|
-
(options["operation"] == Operation::SYNC) &&
|
145
|
-
!options.has_key?("regex")
|
146
|
-
)
|
147
|
-
options["upgrade"] = true
|
148
|
-
else
|
149
|
-
puts opts
|
150
|
-
exit MsPacExit::INVALID_OPERATION
|
151
|
-
end
|
130
|
+
options["upgrade"] = true
|
152
131
|
end
|
153
132
|
|
154
133
|
opts.on("-y", "--refresh", "Refresh available pellets") do
|
155
|
-
|
156
|
-
options["refresh"] = true
|
157
|
-
else
|
158
|
-
puts opts
|
159
|
-
exit MsPacExit::INVALID_OPERATION
|
160
|
-
end
|
134
|
+
options["refresh"] = true
|
161
135
|
end
|
162
136
|
|
163
137
|
opts.on("", "REMOVE OPTIONS")
|
164
138
|
|
165
|
-
opts.on(
|
166
|
-
"
|
167
|
-
"--nosave",
|
168
|
-
"Completely remove pellet"
|
169
|
-
) do
|
170
|
-
if (options["operation"] == Operation::REMOVE)
|
171
|
-
options["nosave"] = true
|
172
|
-
else
|
173
|
-
puts opts
|
174
|
-
exit MsPacExit::INVALID_OPERATION
|
175
|
-
end
|
139
|
+
opts.on("-n", "--nosave", "Completely remove pellet") do
|
140
|
+
options["nosave"] = true
|
176
141
|
end
|
177
142
|
end
|
178
143
|
|
@@ -192,16 +157,126 @@ def parse(args)
|
|
192
157
|
exit MsPacExit::MISSING_ARGUMENT
|
193
158
|
end
|
194
159
|
|
195
|
-
options
|
196
|
-
|
197
|
-
if (options.has_key?("regex") && !options["pellets"].empty?)
|
160
|
+
if (!validate(options))
|
198
161
|
puts parser
|
199
162
|
exit MsPacExit::INVALID_OPERATION
|
200
163
|
end
|
201
164
|
|
165
|
+
options["pellets"] = args
|
166
|
+
|
202
167
|
return options
|
203
168
|
end
|
204
169
|
|
170
|
+
def validate(options)
|
171
|
+
case options["operation"]
|
172
|
+
when Operation::LIST_CACHED
|
173
|
+
if (
|
174
|
+
options["clean"] ||
|
175
|
+
options["force"] ||
|
176
|
+
options["nosave"] ||
|
177
|
+
options["refresh"] ||
|
178
|
+
options["regex"] ||
|
179
|
+
options["upgrade"]
|
180
|
+
)
|
181
|
+
return false
|
182
|
+
end
|
183
|
+
when Operation::LIST_INSTALLED
|
184
|
+
if (
|
185
|
+
options["clean"] ||
|
186
|
+
options["force"] ||
|
187
|
+
options["nosave"] ||
|
188
|
+
options["refresh"] ||
|
189
|
+
options["regex"] ||
|
190
|
+
options["upgrade"]
|
191
|
+
)
|
192
|
+
return false
|
193
|
+
end
|
194
|
+
when Operation::LIST_PELLETS
|
195
|
+
if (
|
196
|
+
options["clean"] ||
|
197
|
+
options["force"] ||
|
198
|
+
options["nosave"] ||
|
199
|
+
options["refresh"] ||
|
200
|
+
options["regex"] ||
|
201
|
+
options["upgrade"]
|
202
|
+
)
|
203
|
+
return false
|
204
|
+
end
|
205
|
+
when Operation::LOCK
|
206
|
+
if (
|
207
|
+
options["clean"] ||
|
208
|
+
options["force"] ||
|
209
|
+
options["nosave"] ||
|
210
|
+
options["refresh"] ||
|
211
|
+
options["regex"] ||
|
212
|
+
options["upgrade"]
|
213
|
+
)
|
214
|
+
return false
|
215
|
+
end
|
216
|
+
when Operation::REMOVE
|
217
|
+
if (
|
218
|
+
options["clean"] ||
|
219
|
+
options["force"] ||
|
220
|
+
options["refresh"] ||
|
221
|
+
options["regex"] ||
|
222
|
+
options["upgrade"]
|
223
|
+
)
|
224
|
+
return false
|
225
|
+
end
|
226
|
+
when Operation::SYNC
|
227
|
+
return false if (options["nosave"])
|
228
|
+
|
229
|
+
if (options["clean"])
|
230
|
+
if (
|
231
|
+
options["force"] ||
|
232
|
+
options["regex"] ||
|
233
|
+
options["upgrade"]
|
234
|
+
)
|
235
|
+
return false
|
236
|
+
end
|
237
|
+
elsif (options["force"])
|
238
|
+
if (
|
239
|
+
options["clean"] ||
|
240
|
+
options["regex"] ||
|
241
|
+
options["upgrade"]
|
242
|
+
)
|
243
|
+
return false
|
244
|
+
end
|
245
|
+
elsif (options["regex"])
|
246
|
+
if (
|
247
|
+
options["clean"] ||
|
248
|
+
options["force"] ||
|
249
|
+
options["upgrade"]
|
250
|
+
)
|
251
|
+
return false
|
252
|
+
end
|
253
|
+
elsif (options["upgrade"])
|
254
|
+
if (
|
255
|
+
options["clean"] ||
|
256
|
+
options["force"] ||
|
257
|
+
options["regex"]
|
258
|
+
)
|
259
|
+
return false
|
260
|
+
end
|
261
|
+
end
|
262
|
+
when Operation::UNLOCK
|
263
|
+
if (
|
264
|
+
options["clean"] ||
|
265
|
+
options["force"] ||
|
266
|
+
options["nosave"] ||
|
267
|
+
options["refresh"] ||
|
268
|
+
options["regex"] ||
|
269
|
+
options["upgrade"]
|
270
|
+
)
|
271
|
+
return false
|
272
|
+
end
|
273
|
+
else
|
274
|
+
return false
|
275
|
+
end
|
276
|
+
|
277
|
+
return true
|
278
|
+
end
|
279
|
+
|
205
280
|
# Parse CLI args
|
206
281
|
options = parse(ARGV)
|
207
282
|
|
@@ -220,16 +295,17 @@ begin
|
|
220
295
|
when Operation::REMOVE
|
221
296
|
mspac.remove(options["pellets"], options["nosave"])
|
222
297
|
when Operation::SYNC
|
223
|
-
mspac.clean if (options["clean"])
|
224
298
|
mspac.refresh if (options["refresh"])
|
225
299
|
|
226
|
-
if (options
|
227
|
-
mspac.
|
300
|
+
if (options["clean"])
|
301
|
+
mspac.clean
|
302
|
+
elsif (options["regex"])
|
303
|
+
mspac.search(options["pellets"].join(" "))
|
228
304
|
elsif (options["upgrade"])
|
229
305
|
mspac.upgrade
|
230
306
|
else
|
231
307
|
unless (
|
232
|
-
|
308
|
+
options["refresh"] &&
|
233
309
|
(options["pellets"].nil? || options["pellets"].empty?)
|
234
310
|
)
|
235
311
|
mspac.install(options["pellets"], options["force"])
|
data/lib/mspac/pellet.rb
CHANGED
@@ -10,6 +10,19 @@ class MsPac::VersionControl
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
def ignore_file_perms(name)
|
14
|
+
Dir.chdir(name) do
|
15
|
+
case @vcs
|
16
|
+
when "git"
|
17
|
+
system("git config core.filemode false")
|
18
|
+
when "hg"
|
19
|
+
# do nothing
|
20
|
+
else
|
21
|
+
raise Error::UnsupportedVCSError.new(@vcs)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
13
26
|
def initialize(vcs)
|
14
27
|
case vcs
|
15
28
|
when "bzr"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mspac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Whittaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: scoobydoo
|