drupid 1.0.1 → 1.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.
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
- # Copyright (c) 2012 Lifepillar
3
+ # Copyright (c) 2012-2013 Lifepillar
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the "Software"), to deal
@@ -59,7 +59,7 @@ module Drupid
59
59
  class <<self
60
60
  def blue; bold 34; end
61
61
  def white; bold 39; end
62
- def red; underline 31; end
62
+ def red; color 31; end
63
63
  def yellow; bold 33; end
64
64
  def purple; bold 35; end
65
65
  def reset; escape 0; end
@@ -90,12 +90,12 @@ module Drupid
90
90
 
91
91
  # Print a warning message.
92
92
  def owarn warning
93
- puts "#{Tty.red}Warning#{Tty.reset}: #{warning}"
93
+ puts "#{Tty.red}Warn#{Tty.reset}: #{warning}"
94
94
  end
95
95
 
96
96
  # Prints an error message.
97
97
  def ofail error, *info
98
- puts "#{Tty.red}Error#{Tty.reset}: #{error}"
98
+ puts "#{Tty.red}Fail#{Tty.reset}: #{error}"
99
99
  puts info unless info.empty?
100
100
  end
101
101
 
@@ -119,7 +119,7 @@ module Drupid
119
119
  # Prints a notice if in verbose mode.
120
120
  def blah notice
121
121
  return unless $VERBOSE
122
- puts notice.to_s
122
+ puts "#{Tty.green}==>#{Tty.reset} #{notice}"
123
123
  end
124
124
 
125
125
  # Executes a command. Returns the output of the command.
@@ -140,6 +140,7 @@ module Drupid
140
140
  cmd << ' >' + Shellwords.shellescape(opts[:out]) if opts[:out]
141
141
  cmd << ' 2>' + Shellwords.shellescape(opts[:err]) if opts[:err]
142
142
  cmd << ' 2>&1' if opts[:redirect_stderr_to_stdout]
143
+ debug "Pwd: #{Dir.pwd}"
143
144
  debug cmd
144
145
  return cmd if opts[:dry]
145
146
  output = %x|#{cmd}| # Run baby run!
@@ -152,9 +153,6 @@ module Drupid
152
153
 
153
154
  def curl *args
154
155
  curl = Pathname.new(which 'curl')
155
- raise "curl not found" unless curl.exist?
156
- raise "curl is not executable" unless curl.executable?
157
-
158
156
  args = ['-qf#LA', DRUPID_USER_AGENT, *args]
159
157
  args << "--insecure" #if MacOS.version < 10.6
160
158
  args << "--silent" unless $VERBOSE
@@ -241,7 +239,7 @@ module Drupid
241
239
  yield
242
240
  ensure
243
241
  FileUtils.chdir wd
244
- tmp.rmtree
242
+ dont_debug { tmp.rmtree }
245
243
  end
246
244
  end
247
245
 
@@ -296,6 +294,17 @@ module Drupid
296
294
  p.open("w") { |f| f.write(content) }
297
295
  end
298
296
 
297
+ # Temporarily forces $DEBUG = false in the given block.
298
+ #
299
+ # This is used to suppress some harmless but annoying exception messages
300
+ # from some methods, e.g., FileUtils.mkpath.
301
+ def dont_debug
302
+ saved_debug = $DEBUG
303
+ $DEBUG = false
304
+ yield
305
+ $DEBUG = saved_debug
306
+ end
307
+
299
308
  end # Utils
300
309
  end # Drupid
301
310
 
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
- # Copyright (c) 2012 Lifepillar
3
+ # Copyright (c) 2012-2013 Lifepillar
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the "Software"), to deal
@@ -121,7 +121,27 @@ module Drupid
121
121
  # Returns true if this version represents a development snapshot;
122
122
  # returns false otherwise.
123
123
  def development_snapshot?
124
- 'x' == @patchlevel
124
+ 'x' == @patchlevel or DEVELOPMENT == @extra_type
125
+ end
126
+
127
+ # Returns true if this a stable version (e.g., '8.x-1.0').
128
+ def stable?
129
+ EMPTY == @extra_type and 'x' != @patchlevel
130
+ end
131
+
132
+ # Returns true if this is a release candidate (e.g., '8.x-1.0-rc1').
133
+ def release_candidate?
134
+ RC == @extra_type
135
+ end
136
+
137
+ # Returns true if this is an alpha release (e.g., '8.x-1.0-alpha1').
138
+ def alpha?
139
+ ALPHA == @extra_type
140
+ end
141
+
142
+ # Returns true if this is a beta release (e.g., '8.x-1.0-beta1').
143
+ def beta?
144
+ BETA == @extra_type
125
145
  end
126
146
 
127
147
  # A synonym for self.short.
@@ -155,6 +175,10 @@ module Drupid
155
175
  @extra_num == other.extra_num
156
176
  end
157
177
 
178
+ # Compares two versions according the their "natural" ordering.
179
+ #
180
+ # According to this ordering, '1.x-dev' < '1.0-unstable6' <
181
+ # '1.0-alpha4' < '1.0-beta0' < '1.0-rc1' < '1.0' <'2.x-dev'.
158
182
  def <=>(w)
159
183
  c = @core <=> w.core
160
184
  if 0 == c
@@ -175,6 +199,29 @@ module Drupid
175
199
  c
176
200
  end
177
201
 
202
+ # Compares two versions to determine which is "better".
203
+ # Returns -1 if self is better than w, 0 when they are
204
+ # the same equivalent, 1 when w is better than w.
205
+ #
206
+ # By our own definitions, stable versions (e.g., '1.0') are
207
+ # better than release candidates (e.g., ('1.1-rc1'), which are
208
+ # better than beta releases (e.g., '1.2-beta2'), which are better than
209
+ # alpha releases (e.g., '1.3-alpha1'), which are better than
210
+ # unstable releases (e.g., '1.4-unstable10'), which are better
211
+ # than development snapshots (e.g., '2.x-dev'), which are better
212
+ # than anything else (e.g., '3.x').
213
+ def better(w)
214
+ if ('x' == @patchlevel and EMPTY == @extra_type) or (EMPTY == w.extra_type and 'x' == w.patchlevel)
215
+ c = (self <=> w)
216
+ else
217
+ c = @extra_type <=> w.extra_type
218
+ if 0 == c
219
+ c = (self <=> w)
220
+ end
221
+ end
222
+ c
223
+ end
224
+
178
225
  def extra
179
226
  case @extra_type
180
227
  when EMPTY then t = ''
@@ -198,7 +245,6 @@ module Drupid
198
245
  def encode_extra(e)
199
246
  @extra_string = e.start_with?('-') ? e.sub(/-/, '') : e
200
247
  if e.match(/dev(\d*)$/)
201
- @patchlevel = 'x'
202
248
  @extra_type = DEVELOPMENT
203
249
  @extra_num = ($~[1] == '') ? UNKNOWN : $~[1].to_i
204
250
  return
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drupid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
5
- prerelease:
4
+ version: 1.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Lifepillar
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-11-05 00:00:00.000000000 Z
11
+ date: 2013-09-01 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rgl
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.4.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.4.0
30
27
  description: Drupid keeps a Drush makefile in sync with a Drupal distribution.
@@ -34,6 +31,7 @@ executables:
34
31
  extensions: []
35
32
  extra_rdoc_files: []
36
33
  files:
34
+ - lib/drupid.rb
37
35
  - lib/drupid/component.rb
38
36
  - lib/drupid/download_strategy.rb
39
37
  - lib/drupid/drush.rb
@@ -47,30 +45,29 @@ files:
47
45
  - lib/drupid/updater.rb
48
46
  - lib/drupid/utils.rb
49
47
  - lib/drupid/version.rb
50
- - lib/drupid.rb
51
48
  - bin/drupid
52
49
  homepage: http://lifepillar.com
53
- licenses: []
50
+ licenses:
51
+ - MIT
52
+ metadata: {}
54
53
  post_install_message:
55
54
  rdoc_options: []
56
55
  require_paths:
57
56
  - lib
58
57
  required_ruby_version: !ruby/object:Gem::Requirement
59
- none: false
60
58
  requirements:
61
- - - ! '>='
59
+ - - '>='
62
60
  - !ruby/object:Gem::Version
63
61
  version: '0'
64
62
  required_rubygems_version: !ruby/object:Gem::Requirement
65
- none: false
66
63
  requirements:
67
- - - ! '>='
64
+ - - '>='
68
65
  - !ruby/object:Gem::Version
69
66
  version: '0'
70
67
  requirements: []
71
68
  rubyforge_project:
72
- rubygems_version: 1.8.21
69
+ rubygems_version: 2.0.3
73
70
  signing_key:
74
- specification_version: 3
71
+ specification_version: 4
75
72
  summary: The not-so-smart Drupal bundler!
76
73
  test_files: []