drupid 1.1.4 → 1.1.5
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/.gitignore +1 -0
- data/README.md +7 -1
- data/bin/drupid +39 -11
- data/lib/drupid/platform.rb +13 -6
- data/lib/drupid/project.rb +36 -3
- data/lib/drupid/project_version.rb +1 -0
- data/lib/drupid/updater.rb +3 -2
- data/lib/drupid/version.rb +1 -1
- data/test/test_drupid_project.rb +57 -0
- data/test/test_drupid_version.rb +3 -0
- metadata +2 -3
- data/.rbenv-version +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dc45daa92f00ed660abef03c9031212b8433d5b
|
4
|
+
data.tar.gz: 972e0442163ec44466742815af5d43840b985e2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0f9595fbf2805230ad0ab97dd5faaaf7952913d57501ad31948b39c70cc26558b66b503cb2e7517d7cfff609bac9cbbf5b3ce744dbbc0ca1c1888fffeb8f0fd
|
7
|
+
data.tar.gz: 5645d7f1ed88561d9db064d4e241e39dc37cec435b8b5b82d50d67e90d3978c57d88d30378f2ba008afb7c6082aa010a86de94ceaa6fe7f222ca704153271448
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -9,6 +9,12 @@ Drupid is a better replacement for [Drush](https://github.com/drush-ops/drush) `
|
|
9
9
|
|
10
10
|
### Release Notes ###
|
11
11
|
|
12
|
+
#### Version 1.1.5 (2013/9/3) ####
|
13
|
+
|
14
|
+
- Fixed a regression that caused `--edit` to accept only URLs. Now it is possible to use project names again (e.g., `drupid -e drupal-8.x` now works).
|
15
|
+
- Various optimizations for `drupid --edit`: in particular, Drupal projects are now cached and temporary folders are not unnecessarily cleaned up. This results in better performance, especially for patching big projects like Drupal itself.
|
16
|
+
- Other bug fixes.
|
17
|
+
|
12
18
|
#### Version 1.1.4 (2013/9/2) ####
|
13
19
|
|
14
20
|
- Fixed a regression which, in some circumstances, caused an uncaught exception upon checking whether a project is installed.
|
@@ -61,4 +67,4 @@ or
|
|
61
67
|
|
62
68
|
To run a single test:
|
63
69
|
|
64
|
-
ruby -Itest -Ilib test/test_NAME.rb --name '<test method name>'
|
70
|
+
bundle exec ruby -Itest -Ilib test/test_NAME.rb --name '<test method name>'
|
data/bin/drupid
CHANGED
@@ -62,9 +62,9 @@ module Drupid
|
|
62
62
|
" with a Drupal platform, and more!\n" +
|
63
63
|
"Usage:\n" +
|
64
64
|
"drupid -s <MAKEFILE> -p <DIRECTORY> [-cdDflnSuv]\n" +
|
65
|
-
"drupid --clear-cache [-
|
66
|
-
"drupid --edit [<URL>] [-
|
67
|
-
"drupid --graph -p <DIRECTORY> [-
|
65
|
+
"drupid --clear-cache [-Dnv]\n" +
|
66
|
+
"drupid --edit [<URL>] [-Dv] [-o <FILE>]\n" +
|
67
|
+
"drupid --graph -p <DIRECTORY> [-DSv]\n" +
|
68
68
|
"drupid --help\n" +
|
69
69
|
"drupid --version"
|
70
70
|
o.on('-s', '--spec MAKEFILE', 'Path to a drush .make file.') do |p|
|
@@ -197,19 +197,40 @@ module Drupid
|
|
197
197
|
|
198
198
|
def patch_interactive
|
199
199
|
patch = ''
|
200
|
+
wd = nil
|
201
|
+
cleanup = false
|
200
202
|
if @options[:edit]
|
201
|
-
|
202
|
-
|
203
|
+
tmp = Pathname.new `mktemp -d /tmp/temp_item-XXXXXX`.strip
|
204
|
+
if @options[:edit] !~ /:\/\// # not a URL
|
205
|
+
begin
|
206
|
+
proj = Project.from_s(@options[:edit])
|
207
|
+
rescue NotDrupalVersionError
|
208
|
+
odie "#{@options[:edit]} is not a valid project name (core version required)."
|
209
|
+
end
|
210
|
+
ohai "Fetching #{proj.extended_name}"
|
211
|
+
begin
|
212
|
+
proj.fetch
|
213
|
+
rescue Exception => ex
|
214
|
+
debug ex.message
|
215
|
+
odie "#{proj.extended_name} could not be fetched."
|
216
|
+
end
|
217
|
+
debug "Copying from #{proj.cached_location} to #{tmp}"
|
218
|
+
dont_debug { wd = proj.cached_location.ditto tmp }
|
219
|
+
else
|
203
220
|
dl = Drupid.makeDownloader @options[:edit], tmp, File.basename(@options[:edit])
|
204
221
|
ohai "Fetching #{@options[:edit]}"
|
205
|
-
|
222
|
+
begin
|
223
|
+
dl.fetch
|
224
|
+
rescue Exception => ex
|
225
|
+
debug ex.message
|
226
|
+
odie "Could not fetch #{@options[:edit]}."
|
227
|
+
end
|
206
228
|
dl.stage
|
207
229
|
wd = dl.staged_path
|
208
|
-
rescue => ex
|
209
|
-
odie "Error retrieving #{@options[:edit]}: #{ex}"
|
210
230
|
end
|
211
|
-
else
|
231
|
+
else # Patching in current directory
|
212
232
|
wd = Pathname.pwd
|
233
|
+
cleanup = true
|
213
234
|
end
|
214
235
|
git_repo = (wd + '.git').exist?
|
215
236
|
Dir.chdir wd.to_s do
|
@@ -220,6 +241,7 @@ module Drupid
|
|
220
241
|
end
|
221
242
|
else
|
222
243
|
begin
|
244
|
+
ohai "Creating Git repo"
|
223
245
|
blah "Initializing temporary git repo inside #{wd}"
|
224
246
|
git 'init'
|
225
247
|
git 'add', '-A'
|
@@ -234,8 +256,14 @@ module Drupid
|
|
234
256
|
git 'add', '-A'
|
235
257
|
patch = git 'diff', '--binary', 'HEAD'
|
236
258
|
ensure
|
237
|
-
|
238
|
-
|
259
|
+
if cleanup
|
260
|
+
ohai "Cleaning up"
|
261
|
+
if git_repo
|
262
|
+
git 'reset', '--hard'
|
263
|
+
else
|
264
|
+
FileUtils.rmtree '.git'
|
265
|
+
end
|
266
|
+
end
|
239
267
|
end
|
240
268
|
end
|
241
269
|
# Show/write patch
|
data/lib/drupid/platform.rb
CHANGED
@@ -190,8 +190,13 @@ module Drupid
|
|
190
190
|
@projects.values.select { |p| p.core_project? }.each { |p| yield p }
|
191
191
|
end
|
192
192
|
|
193
|
-
# Creates
|
193
|
+
# Creates an SVG image depicting the relationships
|
194
194
|
# among the projects in this platform.
|
195
|
+
#
|
196
|
+
# *Requires*: the <tt>dot</tt> program. Without <tt>dot</tt>,
|
197
|
+
# only a <tt>.dot</tt> file is created, but no SVG image.
|
198
|
+
#
|
199
|
+
# Returns the name of the created file.
|
195
200
|
def dependency_graph
|
196
201
|
silence_warnings do
|
197
202
|
begin
|
@@ -201,10 +206,6 @@ module Drupid
|
|
201
206
|
odie "Please install the RGL gem with 'gem install rgl'"
|
202
207
|
end
|
203
208
|
end
|
204
|
-
if `which dot 2>/dev/null`.chomp.empty?
|
205
|
-
owarn "The 'dot' program is required to get an SVG image."
|
206
|
-
owarn "Without it you will only get a .dot file."
|
207
|
-
end
|
208
209
|
analyze
|
209
210
|
# We use this instead of a dag, because there may be circular dependencies...
|
210
211
|
graph = ::RGL::DirectedAdjacencyGraph.new
|
@@ -223,7 +224,13 @@ module Drupid
|
|
223
224
|
graph.add_edge(p.name, depname)
|
224
225
|
end
|
225
226
|
end
|
226
|
-
graph.write_to_graphic_file('svg')
|
227
|
+
outfile = graph.write_to_graphic_file('svg')
|
228
|
+
if which('dot').nil?
|
229
|
+
owarn "The 'dot' program is required to get an SVG image."
|
230
|
+
return outfile.sub('.svg','.dot')
|
231
|
+
else
|
232
|
+
return outfile
|
233
|
+
end
|
227
234
|
end
|
228
235
|
|
229
236
|
private
|
data/lib/drupid/project.rb
CHANGED
@@ -271,12 +271,39 @@ module Drupid
|
|
271
271
|
super(name)
|
272
272
|
@core = VersionCore.new(core_num)
|
273
273
|
@core_project = ('drupal' == @name) ? true : nil
|
274
|
-
@version = vers ? Version.from_s(@core.to_s + '-' + vers)
|
274
|
+
@version = (vers.nil? or vers.empty?) ? nil : Version.from_s(@core.to_s + '-' + vers)
|
275
275
|
@proj_type = ('drupal' == @name) ? 'drupal' : nil
|
276
276
|
@info_file = nil
|
277
277
|
@release_xml = nil
|
278
278
|
end
|
279
279
|
|
280
|
+
# Creates a new Project instance from the specified string.
|
281
|
+
# Note that the string must at least contain the core version of the project.
|
282
|
+
#
|
283
|
+
# Raises a Drupid::NotDrupalVersionError if the string cannot be parsed.
|
284
|
+
#
|
285
|
+
# Examples:
|
286
|
+
# proj = Drupid::Project.from_s 'drupal-7.23'
|
287
|
+
# proj = Drupid::Project.from_s 'drupal-8.x'
|
288
|
+
# proj = Drupid::Project.from_s 'media-7.x'
|
289
|
+
# proj = Drupid::Project.from_s 'tao-7.x-3.0-beta4'
|
290
|
+
def self.from_s p
|
291
|
+
matchdata = p.match(/^([^-\/]+)[-\/](\d+.*)$/)
|
292
|
+
raise NotDrupalVersionError if matchdata.nil?
|
293
|
+
name = matchdata[1]
|
294
|
+
vers = nil
|
295
|
+
if ('drupal' == name) and (matchdata[2] =~ /^(\d+)\.(\d+)/) # e.g., drupal-8.0-dev
|
296
|
+
core = $1.to_i
|
297
|
+
vers = matchdata[2]
|
298
|
+
else
|
299
|
+
matchversion = matchdata[2].match(/^(\d+)\.x-?(.*)/)
|
300
|
+
raise NotDrupalVersionError if matchversion.nil?
|
301
|
+
core = matchversion[1].to_i
|
302
|
+
vers = matchversion[2]
|
303
|
+
end
|
304
|
+
Project.new(name, core, vers)
|
305
|
+
end
|
306
|
+
|
280
307
|
# Returns true if a version is specified for this project, false otherwise.
|
281
308
|
def has_version?
|
282
309
|
nil != @version
|
@@ -332,6 +359,7 @@ module Drupid
|
|
332
359
|
#
|
333
360
|
# Retrieves the release information for this project from http://updates.drupal.org.
|
334
361
|
def update_download_url
|
362
|
+
return unless self.has_version?
|
335
363
|
self.fetch_release_history if @release_xml.nil?
|
336
364
|
return if @release_xml.nil?
|
337
365
|
if @release_xml.at_xpath('/project/releases/release/files/file/variant').nil?
|
@@ -355,9 +383,14 @@ module Drupid
|
|
355
383
|
dont_debug do
|
356
384
|
@release_xml = Nokogiri::XML(open("http://updates.drupal.org/release-history/#{self.name}/#{self.core}"))
|
357
385
|
end
|
358
|
-
|
386
|
+
if @release_xml.at_xpath('/error')
|
387
|
+
debug "No release history for the given project"
|
388
|
+
@relese_xml = nil
|
389
|
+
else
|
390
|
+
debug "Release history retrieved"
|
391
|
+
end
|
359
392
|
rescue => ex
|
360
|
-
owarn "Could not
|
393
|
+
owarn "Could not fetch release history for #{self.extended_name}"
|
361
394
|
debug "fetch_release_history: #{ex}"
|
362
395
|
@release_xml = nil
|
363
396
|
end
|
@@ -99,6 +99,7 @@ module Drupid
|
|
99
99
|
RC = 16
|
100
100
|
EMPTY = 32
|
101
101
|
|
102
|
+
# Initializes a Version object from a core number and a short version.
|
102
103
|
def initialize(core_num, v)
|
103
104
|
raise 'Drupal version is not a string.' unless v.is_a?(String)
|
104
105
|
@core = Drupid::VersionCore.new(core_num)
|
data/lib/drupid/updater.rb
CHANGED
@@ -597,10 +597,11 @@ module Drupid
|
|
597
597
|
end
|
598
598
|
|
599
599
|
def msg
|
600
|
+
spc = ' ' * [0, 8 - @label.length].max
|
600
601
|
if old_project = platform.get_project(component.name)
|
601
|
-
"#{Tty.blue}[#{@label}]#{Tty.white}
|
602
|
+
"#{Tty.blue}[#{@label}]#{Tty.white}#{spc}#{component.name}: #{old_project.version.long} => #{component.version.long}#{Tty.reset} (#{platform.dest_path(component)})"
|
602
603
|
else
|
603
|
-
"#{Tty.blue}[#{@label}]#{Tty.white}
|
604
|
+
"#{Tty.blue}[#{@label}]#{Tty.white}#{spc}#{component.name}: => #{component.version.long}#{Tty.reset} (#{platform.dest_path(component)})"
|
604
605
|
end
|
605
606
|
end
|
606
607
|
|
data/lib/drupid/version.rb
CHANGED
data/test/test_drupid_project.rb
CHANGED
@@ -233,6 +233,63 @@ class TestDrupidProject < Minitest::Test
|
|
233
233
|
refute p.has_version?
|
234
234
|
end
|
235
235
|
|
236
|
+
def test_project_from_s_1
|
237
|
+
p = Drupid::Project.from_s 'drupal-8.x'
|
238
|
+
assert_instance_of Drupid::Project, p
|
239
|
+
assert_equal 'drupal', p.name
|
240
|
+
assert_equal 8, p.core.to_i
|
241
|
+
refute p.has_version?
|
242
|
+
assert_equal 'drupal', p.proj_type
|
243
|
+
end
|
244
|
+
|
245
|
+
def test_project_from_s_2
|
246
|
+
p = Drupid::Project.from_s 'drupal-7.23'
|
247
|
+
assert_instance_of Drupid::Project, p
|
248
|
+
assert_equal 'drupal', p.name
|
249
|
+
assert_equal 7, p.core.to_i
|
250
|
+
assert p.has_version?
|
251
|
+
assert_equal '7.23', p.version.short
|
252
|
+
assert_equal '7.x-7.23', p.version.long
|
253
|
+
assert_equal 'drupal', p.proj_type
|
254
|
+
end
|
255
|
+
|
256
|
+
def test_project_from_s_3
|
257
|
+
p = Drupid::Project.from_s 'drupal-7.24-dev'
|
258
|
+
assert_instance_of Drupid::Project, p
|
259
|
+
assert_equal 'drupal', p.name
|
260
|
+
assert_equal 7, p.core.to_i
|
261
|
+
assert p.has_version?
|
262
|
+
assert_equal '7.24-dev', p.version.short
|
263
|
+
assert_equal '7.x-7.24-dev', p.version.long
|
264
|
+
assert_equal 'drupal', p.proj_type
|
265
|
+
end
|
266
|
+
|
267
|
+
def test_project_from_s_4
|
268
|
+
p = Drupid::Project.from_s 'media-7.x'
|
269
|
+
assert_instance_of Drupid::Project, p
|
270
|
+
assert_equal 'media', p.name
|
271
|
+
assert_equal 7, p.core.to_i
|
272
|
+
refute p.has_version?
|
273
|
+
assert_nil p.proj_type
|
274
|
+
end
|
275
|
+
|
276
|
+
def test_project_from_s_5
|
277
|
+
p = Drupid::Project.from_s 'tao-7.x-3.0-beta4'
|
278
|
+
assert_instance_of Drupid::Project, p
|
279
|
+
assert_equal 'tao', p.name
|
280
|
+
assert_equal 7, p.core.to_i
|
281
|
+
assert p.has_version?
|
282
|
+
assert_equal '3.0-beta4', p.version.short
|
283
|
+
assert_equal '7.x-3.0-beta4', p.version.long
|
284
|
+
assert_nil p.proj_type
|
285
|
+
end
|
286
|
+
|
287
|
+
def test_project_from_wrong_string
|
288
|
+
assert_raises Drupid::NotDrupalVersionError do
|
289
|
+
Drupid::Project.from_s 'media-2.0-unstable7' # no core version
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
236
293
|
def test_project_version
|
237
294
|
p = Drupid::Project.new('foo', 8)
|
238
295
|
p.version = '8.x-1.0'
|
data/test/test_drupid_version.rb
CHANGED
@@ -210,6 +210,9 @@ class TestDrupidVersion < Minitest::Test
|
|
210
210
|
assert_raises Drupid::NotDrupalVersionError do
|
211
211
|
Drupid::Version.from_s '1.0' # missing core number (e.g., '7.x-1.0')
|
212
212
|
end
|
213
|
+
assert_raises Drupid::NotDrupalVersionError do
|
214
|
+
Drupid::Version.from_s '7.x'
|
215
|
+
end
|
213
216
|
assert_raises RuntimeError do
|
214
217
|
Drupid::Version.new(7, 1.0)
|
215
218
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drupid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lifepillar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rgl
|
@@ -75,7 +75,6 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- .bundle/config
|
77
77
|
- .gitignore
|
78
|
-
- .rbenv-version
|
79
78
|
- Gemfile
|
80
79
|
- README.md
|
81
80
|
- Rakefile
|
data/.rbenv-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.0.0-p247
|