syncwrap 2.1.2 → 2.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b61d21a9dbd121278e72c2c97471eac0d5ccb1ff
4
- data.tar.gz: d91d9ac9856658122583990d638bdf67ce9369e4
3
+ metadata.gz: e03ea268f99e5d4fbb0f77975dfb7ddf89652ac1
4
+ data.tar.gz: 690f532e095db3ef3f15be5e22c15e9c93848e9f
5
5
  SHA512:
6
- metadata.gz: 1ab6c7a098c66a0b5d0bb9e8affad2008608e93fd6586a91ef95c36e6ef09ce378578a7447cf546cd7da0de31a1c22b2b99415f3c42b5f37349915f6a115a3cf
7
- data.tar.gz: 2d0bb9f3230bf8c917e9794a90c9a268b8152ef90a6264dccf53e2b07a739257b31523e0bbf35e359fb868e6eb22c391ffd09a64fd83028f37418506ca8eb6c0
6
+ metadata.gz: 69cff80b28bba560719fd9564e285f586561fda5e531e83f3398c401a7c1d9a61006e66c1f3b97821ccc9c8f54691a57d1e63597bb44429bb28a7915614bb351
7
+ data.tar.gz: 8619b3b04a73e551c52feba0e97a451b40521ddf4436a84a0213f7569eb855350979766720cd42b0d8879a0bf26942fe47efb0bfcd991b9b5c9fbd9612c4e335
data/History.rdoc CHANGED
@@ -1,3 +1,12 @@
1
+ === 2.1.3 (2014-7-8)
2
+ * Use sudo instead of --rsync-path=sudo... for :user on localhost
3
+ * Cleanup the environment for gem_install on different ruby, when
4
+ localhost bundler is in play.
5
+ * Fix RubySupport#gem_install count regex (used with :check)
6
+ * Remove obsolete accept: 0 in gem_install :check capture
7
+ * Upgrade default CRubyVM to 2.0.0-p481
8
+ * Add CRubyVM 2.1.x version support
9
+
1
10
  === 2.1.2 (2014-4-21)
2
11
  * Fix Network.dns_search (alias dns_domain) to resolve.conf support
3
12
 
data/lib/syncwrap/base.rb CHANGED
@@ -15,7 +15,7 @@
15
15
  #++
16
16
 
17
17
  module SyncWrap
18
- VERSION='2.1.2'
18
+ VERSION='2.1.3'
19
19
 
20
20
  GEM_ROOT = File.dirname(File.dirname(File.dirname(__FILE__))) # :nodoc:
21
21
  end
@@ -42,9 +42,12 @@ module SyncWrap
42
42
  class CRubyVM < Component
43
43
  include RubySupport
44
44
 
45
- # The ruby version to install, like it appears in source packages
46
- # from ruby-lang.org.
47
- # (Default: 2.0.0-p451)
45
+ # The ruby version to install, as it appears in source packages
46
+ # from ruby-lang.org. Note that starting with 2.1.0, the patch
47
+ # release (p#) no longer appears in package names.
48
+ # (Default: 2.0.0-p481)
49
+ #
50
+ # Example values: '2.0.0-p481', '2.1.2'
48
51
  attr_accessor :ruby_version
49
52
 
50
53
  # If true, attempt to uninstall any pre-existing distro packaged
@@ -53,7 +56,7 @@ module SyncWrap
53
56
  attr_accessor :do_uninstall_distro_ruby
54
57
 
55
58
  def initialize( opts = {} )
56
- @ruby_version = "2.0.0-p451"
59
+ @ruby_version = "2.0.0-p481"
57
60
  @do_uninstall_distro_ruby = true
58
61
 
59
62
  super
@@ -68,8 +71,9 @@ module SyncWrap
68
71
  "#{local_root}/bin/ruby"
69
72
  end
70
73
 
71
- def compact_version
72
- ruby_version.sub( '-', '' )
74
+ # Return ruby_version as an array of Integer values
75
+ def ruby_version_a
76
+ ruby_version.split( /[.\-p]+/ ).map( &:to_i )
73
77
  end
74
78
 
75
79
  # If the current ruby_command is not at the desired ruby_version,
@@ -77,7 +81,7 @@ module SyncWrap
77
81
  def install_ruby
78
82
  cond = <<-SH
79
83
  rvr=`[ -x #{ruby_command} ] &&
80
- #{ruby_command} -v | grep -o -E '[0-9]+(\\.[0-9]+)+(p[0-9]+)?' \
84
+ #{ruby_command} -v | grep -o -E '#{version_pattern}' \
81
85
  || true`
82
86
  if [ "$rvr" != "#{compact_version}" ]; then
83
87
  SH
@@ -92,9 +96,9 @@ module SyncWrap
92
96
 
93
97
  def uninstall_distro_ruby
94
98
  if distro.is_a?( RHEL )
95
- dist_uninstall( %w[ ruby ruby18 ruby19 ruby20 ] )
99
+ dist_uninstall( %w[ ruby ruby18 ruby19 ruby20 ruby21 ] )
96
100
  else
97
- dist_uninstall( %w[ ruby ruby1.8 ruby1.9 ruby1.9.1 ruby1.9.3 ruby2.0 ] )
101
+ dist_uninstall( %w[ ruby ruby1.8 ruby1.9 ruby1.9.1 ruby1.9.3 ruby2.0 ruby2.1 ] )
98
102
  end
99
103
  end
100
104
 
@@ -102,6 +106,21 @@ module SyncWrap
102
106
 
103
107
  protected
104
108
 
109
+ def compact_version
110
+ ruby_version.sub( '-', '' )
111
+ end
112
+
113
+ def version_pattern
114
+ if ( ruby_version_a <=> [2,1] ) > 0
115
+ # Starting with 2.1.x, the p# (patch number) is no longer used
116
+ # for download, won't be in ruby_version, and shouldn't be
117
+ # used for version comparison.
118
+ '[0-9]+(\.[0-9]+)+'
119
+ else
120
+ '[0-9]+(\.[0-9]+)+(p[0-9]+)?'
121
+ end
122
+ end
123
+
105
124
  def install_build_deps
106
125
  if distro.is_a?( RHEL )
107
126
  dist_install( %w[ gcc make autoconf zlib-devel
@@ -31,6 +31,8 @@ module SyncWrap
31
31
 
32
32
  def rsync_args( host, srcs, target, opts = {} ) # :doc:
33
33
 
34
+ cmd = [ 'rsync' ]
35
+
34
36
  # -i --itemize-changes, used for counting changed files
35
37
  flags = %w[ -i ]
36
38
 
@@ -74,11 +76,16 @@ module SyncWrap
74
76
  if opts[ :user ]
75
77
  # Use sudo to place files at remote.
76
78
  user = opts[ :user ].to_s
77
- flags << ( if user != 'root'
78
- "--rsync-path=sudo -u #{user} rsync"
79
- else
80
- "--rsync-path=sudo rsync"
81
- end )
79
+ scmd = if user == 'root'
80
+ %w[ sudo rsync ]
81
+ else
82
+ [ 'sudo', '-u', user, 'rsync' ]
83
+ end
84
+ if host == 'localhost'
85
+ cmd = scmd
86
+ else
87
+ flags << "--rsync-path=#{scmd.join ' '}"
88
+ end
82
89
  end
83
90
 
84
91
  excludes = Array( opts[ :excludes ] )
@@ -94,7 +101,7 @@ module SyncWrap
94
101
 
95
102
  target = [ host, target ].join(':') unless host == 'localhost'
96
103
 
97
- [ 'rsync', flags, srcs, target ].flatten.compact
104
+ [ *cmd, *flags, *srcs, target ]
98
105
  end
99
106
 
100
107
  def expand_implied_target( srcs ) # :doc:
@@ -79,18 +79,20 @@ module SyncWrap
79
79
 
80
80
  shopts = opts[ :user_install ] ? {} : {user: :root}
81
81
 
82
- if opts[ :check ]
83
- _,out = capture( cmd, shopts.merge!( accept: 0 ) )
84
-
85
- count = 0
86
- out.split( "\n" ).each do |oline|
87
- if oline =~ /^\s+(\d+)\s+gem(s)?\s+installed/
88
- count = $1.to_i
82
+ clean_env( opts[ :user_install ] ) do
83
+ if opts[ :check ]
84
+ _,out = capture( cmd, shopts )
85
+
86
+ count = 0
87
+ out.split( "\n" ).each do |oline|
88
+ if oline =~ /^\s*(\d+)\s+gem(s)?\s+installed/
89
+ count = $1.to_i
90
+ end
89
91
  end
92
+ count
93
+ else
94
+ sh( cmd, shopts )
90
95
  end
91
- count
92
- else
93
- sh( cmd, shopts )
94
96
  end
95
97
 
96
98
  end
@@ -105,6 +107,29 @@ module SyncWrap
105
107
  Array( reqs ).flatten.compact.map { |req| "-v'#{req}'" }
106
108
  end
107
109
 
110
+ # Execute within Bundler clean environment if Bundler is defined,
111
+ # doit is passed true (i.e. :user_install, sudo restricted
112
+ # environment should also avoid the issue), and running on
113
+ # localhost. Otherwise gem_install may fail attempting to reload
114
+ # the wrong bundle/r in the shell sub-process.
115
+ def clean_env( doit )
116
+ ret = nil
117
+ if defined?( ::Bundler ) && doit && host.name.to_s == 'localhost'
118
+ ::Bundler.with_clean_env do
119
+ # Oddly, GEM_HOME remains in clean_env even when bundler
120
+ # adds it. Unfortunately now it is hard to tell whom added
121
+ # it. Best guess given not using RVM, etc. is to delete and
122
+ # let return from block restore it.
123
+ ENV.delete( 'GEM_HOME' )
124
+ ret = yield
125
+ flush # otherwise may be deferred till outside of clean block
126
+ end
127
+ else
128
+ ret = yield
129
+ end
130
+ ret
131
+ end
132
+
108
133
  end
109
134
 
110
135
  end
@@ -95,6 +95,32 @@ class TestContextRput < MiniTest::Unit::TestCase
95
95
  end
96
96
  end
97
97
 
98
+ def test_rput_file_sudo_root
99
+ skip unless TestOptions::SAFE_SUDO
100
+ begin
101
+ FileUtils.mkdir_p( "#{TEST_DIR}/root" )
102
+ host = sp.host( 'localhost' )
103
+ 2.times do |i|
104
+ ctx = TestContext.new( host, sp.default_options )
105
+ ctx.with do
106
+ changes = ctx.rput( 'd1/bar', "#{TEST_DIR}/root/d2/", user: :root )
107
+ if i == 0
108
+ assert_equal( %w[ bar ], changes.map { |c| c[1] } )
109
+ else
110
+ assert_empty( changes )
111
+ end
112
+ assert_equal( 0, File.stat( "#{TEST_DIR}/root/d2" ).uid )
113
+ assert_equal( 0, File.stat( "#{TEST_DIR}/root/d2/bar" ).uid )
114
+ assert_equal( IO.read( "#{SYNC_DIR}/d1/bar" ),
115
+ IO.read( "#{TEST_DIR}/root/d2/bar" ) )
116
+ end
117
+ assert_equal( 1, ctx.rsync_count )
118
+ end
119
+ ensure
120
+ system "sudo rm -rf #{TEST_DIR}/root"
121
+ end
122
+ end
123
+
98
124
  def test_rput_erb_no_suffix
99
125
  host = sp.host( 'localhost' )
100
126
  2.times do |i|
metadata CHANGED
@@ -1,151 +1,151 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syncwrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Kellum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-21 00:00:00.000000000 Z
11
+ date: 2014-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: term-ansicolor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.2.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.2.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: tins
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.13.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.13.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: aws-sdk
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 1.34.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.34.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: json
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: 1.7.1
62
- - - <
62
+ - - "<"
63
63
  - !ruby/object:Gem::Version
64
64
  version: '1.9'
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - '>='
69
+ - - ">="
70
70
  - !ruby/object:Gem::Version
71
71
  version: 1.7.1
72
- - - <
72
+ - - "<"
73
73
  - !ruby/object:Gem::Version
74
74
  version: '1.9'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: nokogiri
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - '>='
79
+ - - ">="
80
80
  - !ruby/object:Gem::Version
81
81
  version: 1.5.9
82
- - - <
82
+ - - "<"
83
83
  - !ruby/object:Gem::Version
84
84
  version: '1.7'
85
85
  type: :runtime
86
86
  prerelease: false
87
87
  version_requirements: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - '>='
89
+ - - ">="
90
90
  - !ruby/object:Gem::Version
91
91
  version: 1.5.9
92
- - - <
92
+ - - "<"
93
93
  - !ruby/object:Gem::Version
94
94
  version: '1.7'
95
95
  - !ruby/object:Gem::Dependency
96
96
  name: uuidtools
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - ~>
99
+ - - "~>"
100
100
  - !ruby/object:Gem::Version
101
101
  version: 2.1.3
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - ~>
106
+ - - "~>"
107
107
  - !ruby/object:Gem::Version
108
108
  version: 2.1.3
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: minitest
111
111
  requirement: !ruby/object:Gem::Requirement
112
112
  requirements:
113
- - - ~>
113
+ - - "~>"
114
114
  - !ruby/object:Gem::Version
115
115
  version: 4.7.4
116
116
  type: :development
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
- - - ~>
120
+ - - "~>"
121
121
  - !ruby/object:Gem::Version
122
122
  version: 4.7.4
123
123
  - !ruby/object:Gem::Dependency
124
124
  name: rdoc
125
125
  requirement: !ruby/object:Gem::Requirement
126
126
  requirements:
127
- - - ~>
127
+ - - "~>"
128
128
  - !ruby/object:Gem::Version
129
129
  version: 4.0.1
130
130
  type: :development
131
131
  prerelease: false
132
132
  version_requirements: !ruby/object:Gem::Requirement
133
133
  requirements:
134
- - - ~>
134
+ - - "~>"
135
135
  - !ruby/object:Gem::Version
136
136
  version: 4.0.1
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: rjack-tarpit
139
139
  requirement: !ruby/object:Gem::Requirement
140
140
  requirements:
141
- - - ~>
141
+ - - "~>"
142
142
  - !ruby/object:Gem::Version
143
143
  version: '2.1'
144
144
  type: :development
145
145
  prerelease: false
146
146
  version_requirements: !ruby/object:Gem::Requirement
147
147
  requirements:
148
- - - ~>
148
+ - - "~>"
149
149
  - !ruby/object:Gem::Version
150
150
  version: '2.1'
151
151
  description: A rather direct provisioning and deployment system in ruby, bash over
@@ -175,26 +175,16 @@ files:
175
175
  - examples/hello.rb
176
176
  - examples/hello_binding.rb
177
177
  - examples/jruby.rb
178
- - examples/rput.rb
179
178
  - examples/private/aws.json
179
+ - examples/rput.rb
180
180
  - examples/sync/home/bob/.ssh/authorized_keys
181
181
  - examples/sync/tmp/sample.erb
182
- - lib/syncwrap/base.rb
183
182
  - lib/syncwrap.rb
184
183
  - lib/syncwrap/amazon_ec2.rb
185
184
  - lib/syncwrap/amazon_ws.rb
185
+ - lib/syncwrap/base.rb
186
186
  - lib/syncwrap/cli.rb
187
187
  - lib/syncwrap/component.rb
188
- - lib/syncwrap/context.rb
189
- - lib/syncwrap/distro.rb
190
- - lib/syncwrap/formatter.rb
191
- - lib/syncwrap/git_help.rb
192
- - lib/syncwrap/host.rb
193
- - lib/syncwrap/main.rb
194
- - lib/syncwrap/path_util.rb
195
- - lib/syncwrap/rsync.rb
196
- - lib/syncwrap/ruby_support.rb
197
- - lib/syncwrap/shell.rb
198
188
  - lib/syncwrap/components/commercial_jdk.rb
199
189
  - lib/syncwrap/components/cruby_vm.rb
200
190
  - lib/syncwrap/components/etc_hosts.rb
@@ -212,10 +202,20 @@ files:
212
202
  - lib/syncwrap/components/run_user.rb
213
203
  - lib/syncwrap/components/ubuntu.rb
214
204
  - lib/syncwrap/components/users.rb
215
- - sync/etc/gemrc
216
- - sync/etc/hosts.erb
205
+ - lib/syncwrap/context.rb
206
+ - lib/syncwrap/distro.rb
207
+ - lib/syncwrap/formatter.rb
208
+ - lib/syncwrap/git_help.rb
209
+ - lib/syncwrap/host.rb
210
+ - lib/syncwrap/main.rb
211
+ - lib/syncwrap/path_util.rb
212
+ - lib/syncwrap/rsync.rb
213
+ - lib/syncwrap/ruby_support.rb
214
+ - lib/syncwrap/shell.rb
217
215
  - sync/etc/corosync/corosync.conf
218
216
  - sync/etc/corosync/uidgid.d/qpid
217
+ - sync/etc/gemrc
218
+ - sync/etc/hosts.erb
219
219
  - sync/etc/init.d/iyyov.erb
220
220
  - sync/etc/init.d/qpidd
221
221
  - sync/etc/sysconfig/pgsql/postgresql.erb
@@ -237,11 +237,15 @@ files:
237
237
  - sync/src/hashdot/profiles/jruby.hdp.erb
238
238
  - sync/src/hashdot/profiles/shortlived.hdp
239
239
  - sync/usr/local/etc/qpidd.conf
240
- - sync/var/iyyov/jobs.rb.erb
241
240
  - sync/var/iyyov/default/config.rb
242
241
  - sync/var/iyyov/default/daemon.rb.erb
242
+ - sync/var/iyyov/jobs.rb.erb
243
243
  - test/muddled_sync.rb
244
244
  - test/setup.rb
245
+ - test/sync/d1/bar
246
+ - test/sync/d1/foo.erb
247
+ - test/sync/d3/d2/bar
248
+ - test/sync/d3/d2/foo.erb
245
249
  - test/test_components.rb
246
250
  - test/test_context.rb
247
251
  - test/test_context_rput.rb
@@ -250,32 +254,28 @@ files:
250
254
  - test/test_space.rb
251
255
  - test/test_space_main.rb
252
256
  - test/zfile
253
- - test/sync/d1/bar
254
- - test/sync/d1/foo.erb
255
- - test/sync/d3/d2/bar
256
- - test/sync/d3/d2/foo.erb
257
257
  homepage: http://github.com/dekellum/syncwrap
258
258
  licenses: []
259
259
  metadata: {}
260
260
  post_install_message:
261
261
  rdoc_options:
262
- - --main
262
+ - "--main"
263
263
  - README.rdoc
264
264
  require_paths:
265
265
  - lib
266
266
  required_ruby_version: !ruby/object:Gem::Requirement
267
267
  requirements:
268
- - - '>='
268
+ - - ">="
269
269
  - !ruby/object:Gem::Version
270
270
  version: 1.9.1
271
271
  required_rubygems_version: !ruby/object:Gem::Requirement
272
272
  requirements:
273
- - - '>='
273
+ - - ">="
274
274
  - !ruby/object:Gem::Version
275
275
  version: '0'
276
276
  requirements: []
277
277
  rubyforge_project:
278
- rubygems_version: 2.0.14
278
+ rubygems_version: 2.2.2
279
279
  signing_key:
280
280
  specification_version: 4
281
281
  summary: A rather direct provisioning and deployment system in ruby, bash over ssh,