devstructure 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,13 +4,7 @@
4
4
  require 'devstructure'
5
5
  require 'devstructure/blueprint'
6
6
 
7
- # *HERE BE DRAGONS* The 1.4.3 version of the JSON gem is crap-tastic,
8
- # which forces me to pin to 1.4.2, which in turn forces me to load
9
- # RubyGems manually here, which in turn pretty much makes me cry.
10
- require 'rubygems'
11
- gem 'json', '= 1.4.2'
12
7
  require 'json'
13
-
14
8
  require 'net/http'
15
9
  require 'net/https'
16
10
  require 'openssl'
@@ -124,7 +124,6 @@ class DevStructure::Blueprint < Hash
124
124
  when /^rubygems(\d+\.\d+(?:\.\d+)?)$/
125
125
  b.packages["apt"]["_packages"]["ruby#{$1}-dev"] =
126
126
  packages["apt"]["_packages"]["ruby#{$1}-dev"]
127
-
128
127
  end
129
128
  }
130
129
  )
@@ -139,7 +138,7 @@ class DevStructure::Blueprint < Hash
139
138
  disclaimer = <<EOF
140
139
  \#
141
140
  \# #{owner}'s #{name}
142
- \# http#{token ? "s" : ""}://devstructure.com/blueprints/#{owner}/#{name}
141
+ \# https://devstructure.com/blueprints/#{owner}/#{name}
143
142
  EOF
144
143
  if token
145
144
  disclaimer << <<EOF
@@ -215,7 +214,7 @@ EOF
215
214
  io.printf "#{command}\n", package, version
216
215
  if "apt" == manager \
217
216
  && package =~ /^rubygems(\d+\.\d+(?:\.\d+)?)$/ \
218
- && "1.8" == $1
217
+ && rubygems_update?
219
218
  io.puts \
220
219
  "/usr/bin/gem#{$1} install --no-rdoc --no-ri rubygems-update"
221
220
  io.puts "/usr/bin/ruby#{$1} $(PATH=\"$PATH:/var/lib/gems/#{
@@ -346,7 +345,7 @@ EOF
346
345
 
347
346
  # However, if this package happens to be RubyGems, we introduce
348
347
  # a couple of new resources that update it to the latest version.
349
- if package =~ /^rubygems(\d+\.\d+(?:\.\d+)?)$/ && "1.8" == $1
348
+ if package =~ /^rubygems(\d+\.\d+(?:\.\d+)?)$/ && rubygems_update?
350
349
  manifest[manager] << Puppet::Package.new("rubygems-update",
351
350
  :require => Puppet::Package["rubygems1.8"],
352
351
  :provider => :gem,
@@ -380,7 +379,7 @@ EOF
380
379
  manifest[manager] << Puppet::Exec.new(
381
380
  sprintf(command, package, version),
382
381
  :creates =>
383
- "/usr/lib/ruby/gems/#{ruby_version}/gems/#{package}-#{version}",
382
+ "#{rubygems_path}/#{ruby_version}/gems/#{package}-#{version}",
384
383
  :require => [
385
384
  Puppet::Class[managers[manager]],
386
385
  Puppet::Package[manager],
@@ -496,7 +495,7 @@ EOF
496
495
  # install.
497
496
  when "apt"
498
497
  cookbook.apt_package package, :version => version
499
- if package =~ /^rubygems(\d+\.\d+(?:\.\d+)?)$/ && "1.8" == $1
498
+ if package =~ /^rubygems(\d+\.\d+(?:\.\d+)?)$/ && rubygems_update?
500
499
  v = $1
501
500
  cookbook.gem_package "rubygems-update",
502
501
  :gem_binary => "/usr/bin/gem#{v}"
@@ -596,4 +595,26 @@ EOF
596
595
 
597
596
  end
598
597
 
598
+ # Return this release's codename.
599
+ def lsb_release_codename
600
+ @lsb_release_codename if defined?(@lsb_release_codename)
601
+ /\t(\w+)$/ =~ `/usr/bin/lsb_release -c`
602
+ @lsb_release_codename = $1
603
+ end
604
+
605
+ # Lucid and older need the rubygems-update gem.
606
+ def rubygems_update?
607
+ lsb_release_codename[0] < "m"[0]
608
+ end
609
+
610
+ # Platforms that need the rubygems-update gem install gems in a different
611
+ # location than typical Debian-based systems.
612
+ def rubygems_path
613
+ if rubygems_update?
614
+ "/usr/lib/ruby/gems"
615
+ else
616
+ "/var/lib/gems"
617
+ end
618
+ end
619
+
599
620
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devstructure
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 3
10
- version: 0.5.3
9
+ - 4
10
+ version: 0.5.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Richard Crowley
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-04 00:00:00 +00:00
18
+ date: 2010-11-05 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -38,14 +38,14 @@ dependencies:
38
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
- - - "="
41
+ - - ~>
42
42
  - !ruby/object:Gem::Version
43
- hash: 3
43
+ hash: 11
44
44
  segments:
45
45
  - 1
46
46
  - 4
47
- - 2
48
- version: 1.4.2
47
+ - 6
48
+ version: 1.4.6
49
49
  type: :runtime
50
50
  version_requirements: *id002
51
51
  - !ruby/object:Gem::Dependency