syncwrap 2.2.0 → 2.3.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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/History.rdoc +30 -0
  3. data/Manifest.txt +14 -0
  4. data/README.rdoc +15 -5
  5. data/Rakefile +3 -14
  6. data/lib/syncwrap/base.rb +1 -1
  7. data/lib/syncwrap/components/amazon_linux.rb +50 -0
  8. data/lib/syncwrap/components/arch.rb +37 -0
  9. data/lib/syncwrap/components/bundle.rb +111 -0
  10. data/lib/syncwrap/components/bundled_iyyov_daemon.rb +130 -0
  11. data/lib/syncwrap/components/bundler_gem.rb +47 -0
  12. data/lib/syncwrap/components/centos.rb +28 -0
  13. data/lib/syncwrap/components/cruby_vm.rb +3 -6
  14. data/lib/syncwrap/components/debian.rb +89 -0
  15. data/lib/syncwrap/components/hashdot.rb +6 -4
  16. data/lib/syncwrap/components/iyyov.rb +2 -2
  17. data/lib/syncwrap/components/jruby_vm.rb +9 -5
  18. data/lib/syncwrap/components/network.rb +44 -24
  19. data/lib/syncwrap/components/open_jdk.rb +23 -7
  20. data/lib/syncwrap/components/postgresql.rb +77 -31
  21. data/lib/syncwrap/components/puma.rb +146 -0
  22. data/lib/syncwrap/components/qpid.rb +1 -1
  23. data/lib/syncwrap/components/rake_gem.rb +46 -0
  24. data/lib/syncwrap/components/rhel.rb +7 -3
  25. data/lib/syncwrap/components/run_user.rb +7 -3
  26. data/lib/syncwrap/components/source_tree.rb +128 -0
  27. data/lib/syncwrap/components/tarpit_gem.rb +60 -0
  28. data/lib/syncwrap/components/ubuntu.rb +14 -55
  29. data/lib/syncwrap/components/users.rb +1 -2
  30. data/lib/syncwrap/distro.rb +5 -5
  31. data/lib/syncwrap/ruby_support.rb +20 -4
  32. data/lib/syncwrap/version_support.rb +62 -0
  33. data/lib/syncwrap.rb +11 -0
  34. data/sync/postgresql/postgresql.conf.erb +4 -4
  35. data/sync/var/iyyov/default/bundled_daemon.rb.erb +31 -0
  36. data/test/test_components.rb +77 -18
  37. data/test/test_version_support.rb +65 -0
  38. metadata +16 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a94bbce85319bea7ab7ee215feee79a2f33d2b0
4
- data.tar.gz: 8f031221c85ae70474788dfee38e6d5c05e73c3d
3
+ metadata.gz: 31766d4da53365ca66e620737ad154a7ffdcbac9
4
+ data.tar.gz: b18b461aaf1ece566be69c71d217113aa8da8473
5
5
  SHA512:
6
- metadata.gz: e480edaffd434f726454f2721e95816d085dde7b9114378d49877fe15f0bc7a09bb88b7e61c1fd9c7ce331692fa003e3f237b6e948f94e5d46f93297fc144b29
7
- data.tar.gz: 3f4c2eacd8c0e726e91ef71c403c34b5225aaa8c3526d2a6ace7f5c24b8a46af6feabb36ea3d4b903bc59e3405bbfdf239a385d8ac4d0b0b9b9c4f013c5d0c2d
6
+ metadata.gz: 9c95179c17e29b9d1fa2e0690481f7e9548db9c19b20e390995661f82e5bbdd0517c7f7b032d87c55032086ce069497199e0aa08314d14afcbd4f799f048104a
7
+ data.tar.gz: 6b9fe9ed21313705a4604214d4bea5f88d79ff314b3898933383b44269af453454379452733f95fab4228d3f8b253783b6cdd6c6d78e9541e2af95ec99667da5
data/History.rdoc CHANGED
@@ -1,3 +1,33 @@
1
+ === 2.3.0 (2014-9-20)
2
+ * Add SyncWrap::Debian (with Ubuntu as child), SyncWrap::CentOS and
3
+ SyncWrap::AmazonLinux (with RHEL as parent) to form a Distro
4
+ hierarchy with various version properties. Extends distribution
5
+ support and enables better distro-specific defaults (for example in
6
+ PostgreSQL).
7
+ * Add Debian Network and PostgreSQL support
8
+ * SyncWrap::OpenJDK notes on Debian JDK bloat from X11
9
+ * Add preliminary (dev environment) support for SyncWrap::Arch Linux,
10
+ including support in OpenJDK and Hashdot.
11
+ * Add SyncWrap::SourceTree and SyncWrap::Bundle components
12
+ * Add SyncWrap::Puma component
13
+ * Add SyncWrap::BundlerGem, SyncWrap::RakeGem, SyncWrap::TarpitGem
14
+ components
15
+ * Add SyncWrap::BundledIyyovDaemon for Iyyov support for bundled Iyyov
16
+ daemons
17
+ * Fix JRubyVM#gem_install version check
18
+ * Add RubySupport#gem_install support for user_install as specific
19
+ user.
20
+ * Protect various component accessors which should not be visible at
21
+ the Context level.
22
+ * The SyncWrap::PostgreSQL#version deprecated/aliased in favor of
23
+ SyncWrap::PostgreSQL#pg_version
24
+ * SyncWrap::RunUser#make_dir deprecated/aliased in favor of
25
+ SyncWrap::RunUser#mkdir_run_user
26
+ * Introduce SyncWrap::VersionSupport and use for array-version
27
+ comparisons
28
+ * Add TestComponents bash validate assertions, and random permutation
29
+ for changes
30
+
1
31
  === 2.2.0 (2014-7-13)
2
32
  * New SyncWrap::Component#sh :pipefail option to pass bash flag "-o
3
33
  pipefail" to return the first non-zero command return from a
data/Manifest.txt CHANGED
@@ -30,8 +30,16 @@ lib/syncwrap/path_util.rb
30
30
  lib/syncwrap/rsync.rb
31
31
  lib/syncwrap/ruby_support.rb
32
32
  lib/syncwrap/shell.rb
33
+ lib/syncwrap/version_support.rb
34
+ lib/syncwrap/components/amazon_linux.rb
35
+ lib/syncwrap/components/arch.rb
36
+ lib/syncwrap/components/bundle.rb
37
+ lib/syncwrap/components/bundled_iyyov_daemon.rb
38
+ lib/syncwrap/components/bundler_gem.rb
39
+ lib/syncwrap/components/centos.rb
33
40
  lib/syncwrap/components/commercial_jdk.rb
34
41
  lib/syncwrap/components/cruby_vm.rb
42
+ lib/syncwrap/components/debian.rb
35
43
  lib/syncwrap/components/etc_hosts.rb
36
44
  lib/syncwrap/components/geminabox.rb
37
45
  lib/syncwrap/components/hashdot.rb
@@ -42,9 +50,13 @@ lib/syncwrap/components/mdraid.rb
42
50
  lib/syncwrap/components/network.rb
43
51
  lib/syncwrap/components/open_jdk.rb
44
52
  lib/syncwrap/components/postgresql.rb
53
+ lib/syncwrap/components/puma.rb
45
54
  lib/syncwrap/components/qpid.rb
55
+ lib/syncwrap/components/rake_gem.rb
46
56
  lib/syncwrap/components/rhel.rb
47
57
  lib/syncwrap/components/run_user.rb
58
+ lib/syncwrap/components/source_tree.rb
59
+ lib/syncwrap/components/tarpit_gem.rb
48
60
  lib/syncwrap/components/ubuntu.rb
49
61
  lib/syncwrap/components/users.rb
50
62
  sync/etc/gemrc
@@ -70,6 +82,7 @@ sync/src/hashdot/profiles/jruby.hdp.erb
70
82
  sync/src/hashdot/profiles/shortlived.hdp
71
83
  sync/usr/local/etc/qpidd.conf
72
84
  sync/var/iyyov/jobs.rb.erb
85
+ sync/var/iyyov/default/bundled_daemon.rb.erb
73
86
  sync/var/iyyov/default/config.rb
74
87
  sync/var/iyyov/default/daemon.rb.erb
75
88
  test/muddled_sync.rb
@@ -81,6 +94,7 @@ test/test_rsync.rb
81
94
  test/test_shell.rb
82
95
  test/test_space.rb
83
96
  test/test_space_main.rb
97
+ test/test_version_support.rb
84
98
  test/zfile
85
99
  test/sync/d1/bar
86
100
  test/sync/d1/foo.erb
data/README.rdoc CHANGED
@@ -79,11 +79,15 @@ examples directory and LAYOUT.
79
79
 
80
80
  == Components
81
81
 
82
- Components implementing SyncWrap::Distro, to expose common utility
83
- methods like dist_install:
82
+ Component hierarchy implementing SyncWrap::Distro, for common methods
83
+ like dist_install and other distribution-specific behaviors:
84
84
 
85
- * SyncWrap::RHEL (also supports CentOS, Amazon Linux)
86
- * SyncWrap::Ubuntu
85
+ * SyncWrap::Arch (limited support)
86
+ * SyncWrap::Debian
87
+ * SyncWrap::Ubuntu
88
+ * SyncWrap::RHEL
89
+ * SyncWrap::CentOS
90
+ * SyncWrap::AmazonLinux
87
91
 
88
92
  Components implementing \#install:
89
93
 
@@ -104,6 +108,13 @@ Components implementing \#install:
104
108
 
105
109
  * SyncWrap::JRubyVM and/or SyncWrap::CRubyVM (MRI, from source)
106
110
 
111
+ * SyncWrap::BundlerGem, SyncWrap::RakeGem, SyncWrap::TarpitGem - base
112
+ (pre-bundle) Rubygems
113
+
114
+ * SyncWrap::SourceTree, SyncWrap::Bundle
115
+
116
+ * SyncWrap::Puma
117
+
107
118
  * SyncWrap::Iyyov - job scheduler and process monitor with
108
119
  utilities for SyncWrap::IyyovDaemon deployment.
109
120
 
@@ -116,7 +127,6 @@ Components implementing \#install:
116
127
  The above only represents my more recent project needs. Pull requests
117
128
  to add, for example, the following would be well received:
118
129
 
119
- * Bundler install, for example for Sinatra apps
120
130
  * Bluepill
121
131
  * Rails (extra credit: without git fetch or per-host asset compile)
122
132
  * Nginx
data/Rakefile CHANGED
@@ -9,18 +9,7 @@ RJack::TarPit.new( 'syncwrap' ).define_tasks
9
9
 
10
10
  desc "Upload RDOC to Amazon S3 (rdoc.gravitext.com/syncwrap, Oregon)"
11
11
  task :publish_rdoc => [ :clean, :rerdoc ] do
12
- mime_types = {
13
- '*.html' => 'text/html; charset=utf-8',
14
- '*.css' => 'text/css',
15
- '*.js' => 'text/javascript',
16
- '*.png' => 'image/png',
17
- '*.gif' => 'image/gif',
18
- }
19
- mime_types.each do |pat, mime_type|
20
- sh <<-SH
21
- s3cmd sync -P --exclude '*.*' --include '#{pat}' \
22
- -m '#{mime_type}' \
23
- doc/ s3://rdoc.gravitext.com/syncwrap/
24
- SH
25
- end
12
+ sh <<-SH
13
+ aws s3 sync --acl public-read doc/ s3://rdoc.gravitext.com/syncwrap/
14
+ SH
26
15
  end
data/lib/syncwrap/base.rb CHANGED
@@ -15,7 +15,7 @@
15
15
  #++
16
16
 
17
17
  module SyncWrap
18
- VERSION='2.2.0'
18
+ VERSION='2.3.0'
19
19
 
20
20
  GEM_ROOT = File.dirname(File.dirname(File.dirname(__FILE__))) # :nodoc:
21
21
  end
@@ -0,0 +1,50 @@
1
+ #--
2
+ # Copyright (c) 2011-2014 David Kellum
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
5
+ # may not use this file except in compliance with the License. You may
6
+ # obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
+ # implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+ #++
16
+
17
+ require 'syncwrap/components/rhel'
18
+
19
+ module SyncWrap
20
+
21
+ # Customizations for Amazon Linux.
22
+ class AmazonLinux < RHEL
23
+
24
+ # Amazon Linux version, i.e. '2014.03.2'. No default value.
25
+ attr_accessor :amazon_version
26
+
27
+ alias :distro_version :amazon_version
28
+
29
+ # Return RHEL#rhel_version if specified, or provide comparable
30
+ # default RHEL version if #amazon_vesion is specified.
31
+ #
32
+ # History of Amazon Linux releases:
33
+ #
34
+ # * 2011.09 upgraded to glibc 2.12, parity with RHEL 6
35
+ #
36
+ # * 2014.03 upgraded to 2.17, parity with RHEL 7
37
+ #
38
+ # Note however that Amazon is still behind RHEL 7 in other
39
+ # respects (ex: systemd), and is ahead on other packages.
40
+ def rhel_version
41
+ super ||
42
+ ( amazon_version &&
43
+ ( ( version_gte?( amazon_version, [2014,3] ) && '7' ) ||
44
+ ( version_gte?( amazon_version, [2011,9] ) && '6' ) ||
45
+ '5' ) )
46
+ end
47
+
48
+ end
49
+
50
+ end
@@ -0,0 +1,37 @@
1
+ #--
2
+ # Copyright (c) 2011-2014 David Kellum
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
5
+ # may not use this file except in compliance with the License. You may
6
+ # obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
+ # implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+ #++
16
+
17
+ require 'syncwrap/component'
18
+ require 'syncwrap/distro'
19
+
20
+ module SyncWrap
21
+
22
+ # \Arch Linux distro, partial implementation for pacman.
23
+ class Arch < Component
24
+ include SyncWrap::Distro
25
+
26
+ def dist_install( *pkgs )
27
+ opts = pkgs.last.is_a?( Hash ) && pkgs.pop || {}
28
+ sudo "pacman -S --noconfirm #{pkgs.join ' '}"
29
+ end
30
+
31
+ def dist_uninstall( *pkgs )
32
+ sudo "pacman -R --noconfirm #{pkgs.join ' '}"
33
+ end
34
+
35
+ end
36
+
37
+ end
@@ -0,0 +1,111 @@
1
+ #--
2
+ # Copyright (c) 2011-2014 David Kellum
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
5
+ # may not use this file except in compliance with the License. You may
6
+ # obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
+ # implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+ #++
16
+
17
+ require 'syncwrap/component'
18
+
19
+ require 'syncwrap/git_help'
20
+ require 'syncwrap/path_util'
21
+
22
+ module SyncWrap
23
+
24
+ # Provision to `bundle install`, optionally triggered by a state change key.
25
+ #
26
+ # Host component dependencies: RunUser?, SourceTree?, BundlerGem
27
+ class Bundle < Component
28
+ include PathUtil
29
+
30
+ # Path to the Gemfile(.lock)
31
+ # (Default: SourceTree#remote_source_path)
32
+ attr_writer :bundle_path
33
+
34
+ def bundle_path
35
+ @bundle_path || remote_source_path
36
+ end
37
+
38
+ # The path to install bin stubs, if any. If relative, it is
39
+ # relative to #bundle_path.
40
+ # (Default: sbin; directory in #bundle_path)
41
+ # The default is purposefully not 'bin', so as to avoid clashes
42
+ # with source trees that already have a 'bin', for example that
43
+ # contain gem source as well.
44
+ attr_accessor :bundle_install_bin_stubs
45
+
46
+ protected
47
+
48
+ # An optional state key to check, indicating changes requiring
49
+ # bundle install (Default: nil; Example: :source_tree)
50
+ attr_accessor :change_key
51
+
52
+ # Hash of environment key/values to set on call to bundle install
53
+ # (Default: {} -> none)
54
+ attr_accessor :bundle_install_env
55
+
56
+ # User to perform the bundle install
57
+ # (Default: RunUser#run_user)
58
+ attr_writer :bundle_install_user
59
+
60
+ def bundle_install_user
61
+ @bundle_install_user || run_user
62
+ end
63
+
64
+ # The path to bundle install dependencies. If relative, it is
65
+ # relative to #bundle_path.
66
+ # (Default: ~/.gem -> the #bundle_install_user gems)
67
+ attr_accessor :bundle_install_path
68
+
69
+ public
70
+
71
+ def initialize( opts = {} )
72
+ @change_key = nil
73
+ @bundle_path = nil
74
+ @bundle_install_env = {}
75
+ @bundle_install_path = '~/.gem'
76
+ @bundle_install_user = nil
77
+ @bundle_install_bin_stubs = 'sbin'
78
+ super
79
+ end
80
+
81
+ def install
82
+ bundle_install if change_key.nil? || state[ change_key ]
83
+ end
84
+
85
+ def bundle_install
86
+ sh( "( cd #{bundle_path}", close: ')', user: bundle_install_user ) do
87
+ cmd = [ preamble, bundle_command, '_' + bundler_version + '_', 'install' ]
88
+
89
+ if bundle_install_path
90
+ cmd += [ '--path', bundle_install_path ]
91
+ end
92
+
93
+ if bundle_install_bin_stubs
94
+ cmd += [ '--binstubs', bundle_install_bin_stubs ]
95
+ end
96
+
97
+ sh( cmd.join(' '), user: bundle_install_user )
98
+ end
99
+ end
100
+
101
+ protected
102
+
103
+ def preamble
104
+ setters = bundle_install_env.map do |k,v|
105
+ k.to_s + '="' + v.gsub( /["\\]/ ) { |c| '\\' + c } + '"'
106
+ end
107
+ setters.join( ' ' )
108
+ end
109
+
110
+ end
111
+ end
@@ -0,0 +1,130 @@
1
+ #--
2
+ # Copyright (c) 2011-2014 David Kellum
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
5
+ # may not use this file except in compliance with the License. You may
6
+ # obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
+ # implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+ #++
16
+
17
+ require 'syncwrap/component'
18
+
19
+ module SyncWrap
20
+
21
+ # Provision a source/bundle installed, Iyyov launched and monitored jruby
22
+ # daemon using a standard set of conventions. Can be used directly
23
+ # in the common case, or sub-classed as needed.
24
+ #
25
+ # Two :sync_paths files are searched for deployment: a config.rb and
26
+ # a jobs.d/<name>.rb. If concrete or .erb variants of these are not
27
+ # found than an (empty) default/config.rb and a generic
28
+ # default/bundled_daemon.rb.erb are used. Again, these will work in
29
+ # the common case.
30
+ #
31
+ # Host component dependencies: RunUser, <ruby>, Iyyov
32
+ class BundledIyyovDaemon < Component
33
+
34
+ protected
35
+
36
+ # The daemon process name. (Default: SourceTree#remote_dir)
37
+ attr_writer :name
38
+
39
+ def name
40
+ @name || remote_dir
41
+ end
42
+
43
+ # An optional secondary instance name, useful if running more than
44
+ # one of 'name' on a host. (Default: nil)
45
+ attr_accessor :instance
46
+
47
+ # An optional state key to check, indicating changes requiring
48
+ # a daemon restart (Default: nil; Example: :source_tree)
49
+ attr_accessor :change_key
50
+
51
+ public
52
+
53
+ def initialize( opts = {} )
54
+ @name = nil
55
+ @instance = nil
56
+ @change_key = nil
57
+
58
+ super
59
+ end
60
+
61
+ def install
62
+ standard_install
63
+ end
64
+
65
+ protected
66
+
67
+ def standard_install
68
+ conf_changes = rput_service_config
69
+
70
+ # The job_source may contain more than just this daemon
71
+ # (i.e. additional tasks, etc.) Even if this is the
72
+ # default/daemon.rb.erb, it might have just been changed to
73
+ # that. So go ahead an rput in any case.
74
+ job_changes = rput( job_source,
75
+ "#{iyyov_run_dir}/jobs.d/#{name_instance}.rb",
76
+ user: run_user )
77
+ job_changes += iyyov_install_jobs
78
+
79
+ src_changes = ( change_key && state[ change_key ] ) || []
80
+
81
+ if ( ( src_changes + conf_changes ).length > 0 ||
82
+ state[ :hashdot_updated ] ||
83
+ state[ :imaging ] )
84
+ rudo( "kill $(< #{daemon_service_dir}/#{name}.pid ) || true" )
85
+ end
86
+
87
+ conf_changes + job_changes
88
+ end
89
+
90
+ def rput_service_config
91
+ rput( config_source, "#{daemon_service_dir}/config.rb", user: run_user )
92
+ end
93
+
94
+ def daemon_service_dir
95
+ service_dir( name, instance )
96
+ end
97
+
98
+ def exe_path
99
+ File.join( daemon_service_dir, 'init', name )
100
+ end
101
+
102
+ def name_instance
103
+ [ name, instance ].compact.join( '-' )
104
+ end
105
+
106
+ def job_source
107
+ sjob = "var/iyyov/jobs.d/#{name_instance}.rb"
108
+ unless find_source( sjob )
109
+ sjob = "var/iyyov/jobs.d/#{name}.rb"
110
+ unless find_source( sjob )
111
+ sjob = "var/iyyov/default/bundled_daemon.rb.erb"
112
+ end
113
+ end
114
+ sjob
115
+ end
116
+
117
+ def config_source
118
+ sconf = "var/#{name_instance}/config.rb"
119
+ unless find_source( sconf )
120
+ sconf = "var/#{name}/config.rb"
121
+ unless find_source( sconf )
122
+ sconf = 'var/iyyov/default/config.rb'
123
+ end
124
+ end
125
+ sconf
126
+ end
127
+
128
+ end
129
+
130
+ end
@@ -0,0 +1,47 @@
1
+ #--
2
+ # Copyright (c) 2011-2014 David Kellum
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
5
+ # may not use this file except in compliance with the License. You may
6
+ # obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
+ # implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+ #++
16
+
17
+ require 'syncwrap/component'
18
+
19
+ module SyncWrap
20
+
21
+ # Provision for the bundler rubygem and its (j)bundle command
22
+ #
23
+ # Host component dependencies: <ruby>
24
+ #
25
+ class BundlerGem < Component
26
+
27
+ # Bundler version to install (Default: 1.6.5)
28
+ attr_accessor :bundler_version
29
+
30
+ def initialize( opts = {} )
31
+ @bundler_version = '1.6.5'
32
+ super
33
+ end
34
+
35
+ def bundle_command
36
+ ( ruby_command == 'jruby' ) ? 'jbundle' : 'bundle'
37
+ end
38
+
39
+ def install
40
+ opts = { version: bundler_version }
41
+ opts[ :format_executable ] = true unless bundle_command == 'bundle'
42
+ gem_install( 'bundler', opts )
43
+ end
44
+
45
+ end
46
+
47
+ end
@@ -0,0 +1,28 @@
1
+ #--
2
+ # Copyright (c) 2011-2014 David Kellum
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
5
+ # may not use this file except in compliance with the License. You may
6
+ # obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
+ # implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+ #++
16
+
17
+ require 'syncwrap/components/rhel'
18
+
19
+ module SyncWrap
20
+
21
+ # Customizations for \CentOS and derivatives.
22
+ class CentOS < RHEL
23
+
24
+ alias :centos_version :rhel_version
25
+ alias :centos_version= :rhel_version=
26
+ end
27
+
28
+ end
@@ -17,6 +17,7 @@
17
17
  require 'syncwrap/component'
18
18
  require 'syncwrap/components/rhel'
19
19
  require 'syncwrap/ruby_support'
20
+ require 'syncwrap/version_support'
20
21
 
21
22
  module SyncWrap
22
23
 
@@ -40,6 +41,7 @@ module SyncWrap
40
41
  # development however. Again you are currently on your own (beyond
41
42
  # RubySupport) if you wish to go this route.
42
43
  class CRubyVM < Component
44
+ include VersionSupport
43
45
  include RubySupport
44
46
 
45
47
  # The ruby version to install, as it appears in source packages
@@ -71,11 +73,6 @@ module SyncWrap
71
73
  "#{local_root}/bin/ruby"
72
74
  end
73
75
 
74
- # Return ruby_version as an array of Integer values
75
- def ruby_version_a
76
- ruby_version.split( /[.\-p]+/ ).map( &:to_i )
77
- end
78
-
79
76
  # If the current ruby_command is not at the desired ruby_version,
80
77
  # download source, configure, make and install.
81
78
  def install_ruby
@@ -111,7 +108,7 @@ module SyncWrap
111
108
  end
112
109
 
113
110
  def version_pattern
114
- if ( ruby_version_a <=> [2,1] ) > 0
111
+ if version_gte?( ruby_version, [2,1] )
115
112
  # Starting with 2.1.x, the p# (patch number) is no longer used
116
113
  # for download, won't be in ruby_version, and shouldn't be
117
114
  # used for version comparison.