syncwrap 1.5.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +7 -0
  2. data/History.rdoc +19 -0
  3. data/Manifest.txt +82 -34
  4. data/README.rdoc +96 -48
  5. data/Rakefile +0 -65
  6. data/bin/syncwrap +27 -0
  7. data/examples/LAYOUT.rdoc +70 -0
  8. data/examples/Rakefile +16 -0
  9. data/examples/ec2.rb +44 -0
  10. data/examples/hello.rb +14 -0
  11. data/examples/hello_binding.rb +27 -0
  12. data/examples/jruby.rb +11 -0
  13. data/examples/private/aws.json +4 -0
  14. data/examples/rput.rb +24 -0
  15. data/examples/sync/home/bob/.ssh/authorized_keys +1 -0
  16. data/examples/sync/tmp/sample.erb +3 -0
  17. data/lib/syncwrap/amazon_ec2.rb +236 -0
  18. data/lib/syncwrap/amazon_ws.rb +308 -0
  19. data/lib/syncwrap/base.rb +4 -2
  20. data/lib/syncwrap/cli.rb +328 -0
  21. data/lib/syncwrap/component.rb +443 -0
  22. data/lib/syncwrap/components/commercial_jdk.rb +76 -0
  23. data/lib/syncwrap/components/cruby_vm.rb +144 -0
  24. data/lib/syncwrap/components/etc_hosts.rb +44 -0
  25. data/lib/syncwrap/{geminabox.rb → components/geminabox.rb} +12 -17
  26. data/lib/syncwrap/components/hashdot.rb +97 -0
  27. data/lib/syncwrap/components/iyyov.rb +144 -0
  28. data/lib/syncwrap/components/iyyov_daemon.rb +125 -0
  29. data/lib/syncwrap/components/jruby_vm.rb +122 -0
  30. data/lib/syncwrap/components/mdraid.rb +204 -0
  31. data/lib/syncwrap/components/network.rb +99 -0
  32. data/lib/syncwrap/components/open_jdk.rb +70 -0
  33. data/lib/syncwrap/components/postgresql.rb +159 -0
  34. data/lib/syncwrap/components/qpid.rb +303 -0
  35. data/lib/syncwrap/components/rhel.rb +71 -0
  36. data/lib/syncwrap/components/run_user.rb +99 -0
  37. data/lib/syncwrap/components/ubuntu.rb +85 -0
  38. data/lib/syncwrap/components/users.rb +200 -0
  39. data/lib/syncwrap/context.rb +260 -0
  40. data/lib/syncwrap/distro.rb +53 -60
  41. data/lib/syncwrap/formatter.rb +149 -0
  42. data/lib/syncwrap/host.rb +134 -0
  43. data/lib/syncwrap/main.rb +62 -0
  44. data/lib/syncwrap/path_util.rb +55 -0
  45. data/lib/syncwrap/rsync.rb +227 -0
  46. data/lib/syncwrap/ruby_support.rb +110 -0
  47. data/lib/syncwrap/shell.rb +207 -0
  48. data/lib/syncwrap.rb +367 -1
  49. data/{etc → sync/etc}/gemrc +1 -3
  50. data/sync/etc/hosts.erb +8 -0
  51. data/{etc/init.d/iyyov → sync/etc/init.d/iyyov.erb} +35 -7
  52. data/sync/etc/sysconfig/pgsql/postgresql.erb +2 -0
  53. data/sync/src/hashdot/Makefile.erb +98 -0
  54. data/sync/src/hashdot/profiles/default.hdp.erb +25 -0
  55. data/sync/src/hashdot/profiles/jruby-common.hdp +28 -0
  56. data/sync/src/hashdot/profiles/jruby-shortlived.hdp +9 -0
  57. data/sync/src/hashdot/profiles/jruby.hdp.erb +13 -0
  58. data/sync/src/hashdot/profiles/shortlived.hdp +6 -0
  59. data/sync/var/iyyov/default/config.rb +1 -0
  60. data/sync/var/iyyov/default/daemon.rb.erb +15 -0
  61. data/sync/var/iyyov/jobs.rb.erb +4 -0
  62. data/test/muddled_sync.rb +13 -0
  63. data/test/setup.rb +39 -0
  64. data/test/sync/d1/bar +1 -0
  65. data/test/sync/d1/foo.erb +1 -0
  66. data/test/sync/d3/d2/bar +1 -0
  67. data/test/sync/d3/d2/foo.erb +1 -0
  68. data/test/test_components.rb +108 -0
  69. data/test/test_context.rb +107 -0
  70. data/test/test_context_rput.rb +289 -0
  71. data/test/test_rsync.rb +138 -0
  72. data/test/test_shell.rb +233 -0
  73. data/test/test_space.rb +218 -0
  74. data/test/test_space_main.rb +40 -0
  75. data/test/zfile +1 -0
  76. metadata +204 -71
  77. data/etc/sysconfig/pgsql/postgresql +0 -2
  78. data/lib/syncwrap/aws.rb +0 -448
  79. data/lib/syncwrap/common.rb +0 -161
  80. data/lib/syncwrap/ec2.rb +0 -59
  81. data/lib/syncwrap/hashdot.rb +0 -70
  82. data/lib/syncwrap/iyyov.rb +0 -139
  83. data/lib/syncwrap/java.rb +0 -61
  84. data/lib/syncwrap/jruby.rb +0 -118
  85. data/lib/syncwrap/postgresql.rb +0 -135
  86. data/lib/syncwrap/qpid.rb +0 -251
  87. data/lib/syncwrap/remote_task.rb +0 -199
  88. data/lib/syncwrap/rhel.rb +0 -67
  89. data/lib/syncwrap/ubuntu.rb +0 -78
  90. data/lib/syncwrap/user_run.rb +0 -102
  91. data/test/test_syncwrap.rb +0 -202
  92. data/var/iyyov/jobs.rb +0 -11
  93. /data/{etc → sync/etc}/corosync/corosync.conf +0 -0
  94. /data/{etc → sync/etc}/corosync/uidgid.d/qpid +0 -0
  95. /data/{etc → sync/etc}/init.d/qpidd +0 -0
  96. /data/{etc → sync/etc}/sysctl.d/61-postgresql-shm.conf +0 -0
  97. /data/{usr/local → sync/jruby}/bin/jgem +0 -0
  98. /data/{postgresql → sync/postgresql}/rhel/pg_hba.conf +0 -0
  99. /data/{postgresql → sync/postgresql}/rhel/pg_ident.conf +0 -0
  100. /data/{postgresql → sync/postgresql}/rhel/postgresql.conf +0 -0
  101. /data/{postgresql → sync/postgresql}/ubuntu/environment +0 -0
  102. /data/{postgresql → sync/postgresql}/ubuntu/pg_ctl.conf +0 -0
  103. /data/{postgresql → sync/postgresql}/ubuntu/pg_hba.conf +0 -0
  104. /data/{postgresql → sync/postgresql}/ubuntu/pg_ident.conf +0 -0
  105. /data/{postgresql → sync/postgresql}/ubuntu/postgresql.conf +0 -0
  106. /data/{postgresql → sync/postgresql}/ubuntu/start.conf +0 -0
  107. /data/{usr → sync/usr}/local/etc/qpidd.conf +0 -0
@@ -1,202 +0,0 @@
1
- #!/usr/bin/env jruby
2
- #.hashdot.profile += jruby-shortlived
3
-
4
- #--
5
- # Copyright (c) 2011-2013 David Kellum
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License"); you
8
- # may not use this file except in compliance with the License. You
9
- # may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
16
- # implied. See the License for the specific language governing
17
- # permissions and limitations under the License.
18
- #++
19
-
20
- require 'rubygems'
21
- require 'bundler/setup'
22
-
23
- require 'minitest/unit'
24
- require 'minitest/autorun'
25
-
26
- require 'syncwrap/java'
27
- require 'syncwrap/hashdot'
28
- require 'syncwrap/jruby'
29
- require 'syncwrap/iyyov'
30
- require 'syncwrap/geminabox'
31
- require 'syncwrap/aws'
32
- require 'syncwrap/ec2'
33
- require 'syncwrap/ubuntu'
34
- require 'syncwrap/rhel'
35
- require 'syncwrap/postgresql'
36
- require 'syncwrap/remote_task'
37
-
38
- class TestSyncWrap < MiniTest::Unit::TestCase
39
-
40
- class EveryWrapper
41
- include SyncWrap::Java
42
- include SyncWrap::Hashdot
43
- include SyncWrap::JRuby
44
- include SyncWrap::Iyyov
45
- include SyncWrap::Geminabox
46
- include SyncWrap::Ubuntu
47
- include SyncWrap::EC2
48
- include SyncWrap::AWS
49
- include SyncWrap::PostgreSQL
50
- end
51
-
52
- def test_init
53
- w = EveryWrapper.new
54
- assert_equal( '/usr/local', w.common_prefix,
55
- 'Common#initialize should run for defaults' )
56
- assert_equal( 'runr', w.user_run,
57
- 'UserRun#initialize should run for defaults' )
58
- assert_equal( '1.1.4', w.iyyov_version,
59
- 'Iyyov#initialize should run for defaults' )
60
- end
61
-
62
- def test_no_remoting_module
63
- w = EveryWrapper.new
64
- assert_raises( RuntimeError, <<-MSG ) { w.run( 'ls' ) }
65
- Should raise when no remoting module is included.
66
- MSG
67
- end
68
-
69
- class CommonWrapper
70
- include SyncWrap::Common
71
-
72
- attr_reader :last_args
73
-
74
- def rsync( *args )
75
- @last_args = args
76
- end
77
-
78
- def target_host
79
- 'testhost'
80
- end
81
-
82
- end
83
-
84
- def test_rput
85
- w = CommonWrapper.new
86
-
87
- w.rput( 'other/lang.sh', '/etc/' )
88
-
89
- assert_equal( [ 'other/lang.sh',
90
- 'testhost:/etc/' ],
91
- w.last_args )
92
-
93
- w.rput( 'etc/profile.d/lang.sh' )
94
-
95
- assert_equal( [ 'etc/profile.d/lang.sh',
96
- 'testhost:/etc/profile.d/' ],
97
- w.last_args )
98
-
99
- w.rput( 'etc/profile.d/' )
100
-
101
- assert_equal( [ 'etc/profile.d/',
102
- 'testhost:/etc/profile.d/' ],
103
- w.last_args )
104
-
105
- w.rput( 'etc/profile.d' )
106
-
107
- assert_equal( [ 'etc/profile.d',
108
- 'testhost:/etc/' ],
109
- w.last_args )
110
-
111
- w.rput( 'etc/profile.d/lang.sh', :user => 'root' )
112
-
113
- assert_equal( [ '--rsync-path=sudo rsync',
114
- 'etc/profile.d/lang.sh',
115
- 'testhost:/etc/profile.d/'],
116
- w.last_args )
117
-
118
- w.rput( 'etc/profile.d/lang.sh', :user => 'runr' )
119
-
120
- assert_equal( [ '--rsync-path=sudo -u runr rsync',
121
- 'etc/profile.d/lang.sh',
122
- 'testhost:/etc/profile.d/'],
123
- w.last_args )
124
-
125
- w.rput( 'etc/profile.d/lang.sh', :excludes => :dev )
126
-
127
- assert_equal( [ '--cvs-exclude',
128
- 'etc/profile.d/lang.sh',
129
- 'testhost:/etc/profile.d/' ],
130
- w.last_args )
131
- end
132
-
133
- class RemoteTaskWrapper
134
- include SyncWrap::RemoteTask
135
- end
136
-
137
- class TestTask
138
- attr_accessor :last_args
139
-
140
- def with
141
- Thread.current[ :task ] = self
142
- yield self
143
- ensure
144
- Thread.current[ :task ] = nil
145
- end
146
-
147
- def run( *args )
148
- @last_args = args
149
- end
150
-
151
- alias sudo run
152
- end
153
-
154
- def test_remote_not_in_task
155
- w = RemoteTaskWrapper.new
156
- assert_raises( RuntimeError ) { w.run( 'foo' ) }
157
- end
158
-
159
- def test_run
160
- w = RemoteTaskWrapper.new
161
- TestTask.new.with do |t|
162
- w.run( 'foo' )
163
- assert_equal( [ 'foo' ], t.last_args )
164
-
165
- w.run( 'foo', 'bar', :opt => :bar )
166
- assert_equal( [ 'foo', 'bar' ], t.last_args )
167
-
168
- w.run <<-SH
169
- mkdir -p foo
170
- touch foo/goo
171
- SH
172
- assert_equal( [ [ 'set -e',
173
- 'mkdir -p foo',
174
- 'touch foo/goo' ].join( $/ ) ],
175
- t.last_args )
176
- end
177
- end
178
-
179
- def test_sudo
180
- w = RemoteTaskWrapper.new
181
- TestTask.new.with do |t|
182
- w.sudo( 'foo' )
183
- assert_equal( [ 'sh -c "foo"' ], t.last_args.flatten.compact )
184
-
185
- w.sudo( 'foo', :shell => false )
186
- assert_equal( [ 'foo' ], t.last_args.flatten.compact )
187
-
188
- w.sudo( 'foo', 'bar', :user => 'postgres' )
189
- assert_equal( [ '-u', 'postgres', 'sh -c "foo bar"' ],
190
- t.last_args.flatten.compact )
191
-
192
- w.sudo <<-SH
193
- mkdir -p foo
194
- touch foo/goo
195
- SH
196
-
197
- assert_equal( [ "sh -c \"set -e\nmkdir -p foo\ntouch foo/goo\"" ],
198
- t.last_args.flatten.compact )
199
- end
200
- end
201
-
202
- end
data/var/iyyov/jobs.rb DELETED
@@ -1,11 +0,0 @@
1
- Iyyov.context do |c|
2
-
3
- c.base_dir = '/var/local/runr'
4
-
5
- c.define_daemon do |d|
6
- d.name = "boxed-geminabox"
7
- d.version = "~> 1.0.0"
8
- d.log_rotate
9
- end
10
-
11
- end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes