rubble 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/LICENSE.txt +674 -0
- data/README.md +29 -0
- data/bin/rubble +5 -0
- data/demo/applique/qed_test.rb +82 -0
- data/demo/applique/rubble_test.rb +33 -0
- data/demo/environment.md +32 -0
- data/demo/file_set.md +65 -0
- data/demo/logging.md +11 -0
- data/demo/server.md +53 -0
- data/demo/snapshot.md +32 -0
- data/demo/tool.md +36 -0
- data/lib/rubble.rb +15 -0
- data/lib/rubble/application.rb +82 -0
- data/lib/rubble/command/activate.rb +13 -0
- data/lib/rubble/command/base.rb +57 -0
- data/lib/rubble/command/upload.rb +28 -0
- data/lib/rubble/context.rb +33 -0
- data/lib/rubble/dsl.rb +31 -0
- data/lib/rubble/environment.rb +38 -0
- data/lib/rubble/executor/base.rb +134 -0
- data/lib/rubble/executor/local.rb +113 -0
- data/lib/rubble/executor/remote.rb +81 -0
- data/lib/rubble/file_set.rb +41 -0
- data/lib/rubble/logging.rb +23 -0
- data/lib/rubble/plan/base.rb +21 -0
- data/lib/rubble/plan/deploy.rb +11 -0
- data/lib/rubble/resource/base.rb +43 -0
- data/lib/rubble/resource/database.rb +8 -0
- data/lib/rubble/resource/fileset.rb +93 -0
- data/lib/rubble/resource/webapp.rb +22 -0
- data/lib/rubble/scope.rb +44 -0
- data/lib/rubble/server.rb +61 -0
- data/lib/rubble/snapshot.rb +21 -0
- data/lib/rubble/target/base.rb +24 -0
- data/lib/rubble/target/directory.rb +11 -0
- data/lib/rubble/target/mysql.rb +8 -0
- data/lib/rubble/target/tomcat.rb +20 -0
- data/lib/rubble/tool.rb +138 -0
- data/lib/rubble/version.rb +3 -0
- metadata +244 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module Rubble
|
4
|
+
class Snapshot
|
5
|
+
attr_reader :version
|
6
|
+
attr_reader :filesets
|
7
|
+
|
8
|
+
def initialize(version, *filesets)
|
9
|
+
@version = version.dup.freeze
|
10
|
+
@filesets = filesets.flatten.dup.freeze
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_s
|
14
|
+
to_yaml
|
15
|
+
end
|
16
|
+
|
17
|
+
def empty?
|
18
|
+
@filesets.find{|f| not f.empty?} == nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'digest'
|
2
|
+
require 'rubble/dsl'
|
3
|
+
|
4
|
+
module Rubble
|
5
|
+
module Target
|
6
|
+
class Base
|
7
|
+
attr_reader :name
|
8
|
+
dsl_accessor :service
|
9
|
+
|
10
|
+
def initialize(name)
|
11
|
+
@name = name
|
12
|
+
@service = "#{self.class.name.downcase.split(/::/).last}#{suffix}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def type
|
16
|
+
self.class.name.downcase.to_sym
|
17
|
+
end
|
18
|
+
|
19
|
+
def suffix
|
20
|
+
(name == :default) ? '' : "-#{name}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rubble/target/base'
|
2
|
+
|
3
|
+
module Rubble
|
4
|
+
module Target
|
5
|
+
class Tomcat < Base
|
6
|
+
dsl_accessor :base_dir
|
7
|
+
dsl_accessor :webapps_dir
|
8
|
+
|
9
|
+
def initialize(name)
|
10
|
+
super(name)
|
11
|
+
@base_dir = "/var/lib/tomcat7#{suffix}"
|
12
|
+
@webapps_dir = "webapps"
|
13
|
+
end
|
14
|
+
|
15
|
+
def webapps_dir
|
16
|
+
File.expand_path(@base_dir, @webapps_dir)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/rubble/tool.rb
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
require 'rubble/file_set'
|
2
|
+
require 'rubble/environment'
|
3
|
+
require 'rubble/server'
|
4
|
+
require 'rubble/context'
|
5
|
+
require 'rubble/target/base'
|
6
|
+
require 'rubble/resource/base'
|
7
|
+
require 'rubble/plan/base'
|
8
|
+
require 'docile'
|
9
|
+
|
10
|
+
module Rubble
|
11
|
+
class Tool
|
12
|
+
attr_accessor :resources
|
13
|
+
attr_accessor :servers
|
14
|
+
attr_accessor :environments
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
@log = Logging.logger[self]
|
18
|
+
@resources = {}
|
19
|
+
@servers = {}
|
20
|
+
@environments = {}
|
21
|
+
end
|
22
|
+
|
23
|
+
def execute(environment_names)
|
24
|
+
context = Context.new(self)
|
25
|
+
begin
|
26
|
+
environment_names.each do |environment_name|
|
27
|
+
environment = @environments[environment_name]
|
28
|
+
|
29
|
+
if environment.nil? then
|
30
|
+
raise ArgumentError, "Undefined environment '#{environment_name}'."
|
31
|
+
end
|
32
|
+
|
33
|
+
environment.execute(context) do |plan|
|
34
|
+
yield(plan, context)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
ensure
|
38
|
+
context.close
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def environment(name, &block)
|
43
|
+
environment = @environments.fetch(name) do |k|
|
44
|
+
@environments[name] = Environment.new(self, name)
|
45
|
+
end
|
46
|
+
if not block.nil? then
|
47
|
+
Docile.dsl_eval(environment, &block)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def server(name, &block)
|
52
|
+
server = @servers.fetch(name) do |k|
|
53
|
+
@servers[name] = Server.new(self, name)
|
54
|
+
end
|
55
|
+
if not block.nil? then
|
56
|
+
Docile.dsl_eval(server, &block)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def is_target?(symbol)
|
61
|
+
name = symbol.to_s
|
62
|
+
name =~ /^[a-z_]+$/i and Target.const_defined?(name.capitalize)
|
63
|
+
end
|
64
|
+
|
65
|
+
def is_resource?(symbol)
|
66
|
+
name = symbol.to_s
|
67
|
+
name =~ /^[a-z_]+$/i and Resource.const_defined?(name.capitalize)
|
68
|
+
end
|
69
|
+
|
70
|
+
def is_plan?(symbol)
|
71
|
+
name = symbol.to_s
|
72
|
+
name =~ /^[a-z_]+$/i and Plan.const_defined?(name.capitalize)
|
73
|
+
end
|
74
|
+
|
75
|
+
def create_resource(type, name, *params, &block)
|
76
|
+
Resource.const_get(type.to_s.capitalize).new(name, *params)
|
77
|
+
end
|
78
|
+
|
79
|
+
def create_target(type, name, *params, &block)
|
80
|
+
Target.const_get(type.to_s.capitalize).new(name, *params)
|
81
|
+
end
|
82
|
+
|
83
|
+
def create_plan(type, env, server, *params, &block)
|
84
|
+
Plan.const_get(type.to_s.capitalize).new(env, server, *params)
|
85
|
+
end
|
86
|
+
|
87
|
+
def provide_server(name)
|
88
|
+
@servers.fetch(name) do |k|
|
89
|
+
@servers[name] = block_given? ? yield : Server.new(self, name)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def provide_resource(type, name)
|
94
|
+
group = @resources.fetch(type) do |k|
|
95
|
+
@resources[k] = {}
|
96
|
+
end
|
97
|
+
group.fetch(name) do |k|
|
98
|
+
group[name] = block_given? ? yield : create_resource(type, name)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def configure_resource(type, name, *params, &block)
|
103
|
+
resource = provide_resource(type, name) do
|
104
|
+
create_resource(type, name, params)
|
105
|
+
end
|
106
|
+
if not block.nil? then
|
107
|
+
Docile.dsl_eval(resource, &block)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def read_config(file_name)
|
112
|
+
if File.exists?(file_name) then
|
113
|
+
@log.info("Reading configuration from '#{file_name}'.")
|
114
|
+
configure(File.read(file_name), file_name)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def configure(config, file_name = nil)
|
119
|
+
self.instance_eval(config, file_name)
|
120
|
+
end
|
121
|
+
|
122
|
+
def method_missing(symbol, *arguments, &block)
|
123
|
+
if is_resource?(symbol) then
|
124
|
+
configure_resource(symbol, arguments[0], *arguments[1..-1], &block)
|
125
|
+
else
|
126
|
+
super
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def respond_to?(symbol, include_private = false)
|
131
|
+
if is_target?(symbol) then
|
132
|
+
true
|
133
|
+
else
|
134
|
+
super
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
metadata
ADDED
@@ -0,0 +1,244 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubble
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jochen Seeber
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: commander
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: docile
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rye
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.9'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.9'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: base32
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.3'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: logging
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.8'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.8'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bundler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.7'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.7'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '10.3'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '10.3'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: qed
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.9'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ~>
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.9'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: ae
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ~>
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.8'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ~>
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '1.8'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: yard
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ~>
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.8'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ~>
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.8'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: coveralls
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ~>
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0.7'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ~>
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0.7'
|
167
|
+
description: This tool allows you to easily deploy applications to servers. Though
|
168
|
+
currently only Java WARs and Tomcat servers are supported ;-)
|
169
|
+
email:
|
170
|
+
- jochen@seeber.me
|
171
|
+
executables:
|
172
|
+
- rubble
|
173
|
+
extensions: []
|
174
|
+
extra_rdoc_files: []
|
175
|
+
files:
|
176
|
+
- LICENSE.txt
|
177
|
+
- README.md
|
178
|
+
- bin/rubble
|
179
|
+
- demo/applique/qed_test.rb
|
180
|
+
- demo/applique/rubble_test.rb
|
181
|
+
- demo/environment.md
|
182
|
+
- demo/file_set.md
|
183
|
+
- demo/logging.md
|
184
|
+
- demo/server.md
|
185
|
+
- demo/snapshot.md
|
186
|
+
- demo/tool.md
|
187
|
+
- lib/rubble.rb
|
188
|
+
- lib/rubble/application.rb
|
189
|
+
- lib/rubble/command/activate.rb
|
190
|
+
- lib/rubble/command/base.rb
|
191
|
+
- lib/rubble/command/upload.rb
|
192
|
+
- lib/rubble/context.rb
|
193
|
+
- lib/rubble/dsl.rb
|
194
|
+
- lib/rubble/environment.rb
|
195
|
+
- lib/rubble/executor/base.rb
|
196
|
+
- lib/rubble/executor/local.rb
|
197
|
+
- lib/rubble/executor/remote.rb
|
198
|
+
- lib/rubble/file_set.rb
|
199
|
+
- lib/rubble/logging.rb
|
200
|
+
- lib/rubble/plan/base.rb
|
201
|
+
- lib/rubble/plan/deploy.rb
|
202
|
+
- lib/rubble/resource/base.rb
|
203
|
+
- lib/rubble/resource/database.rb
|
204
|
+
- lib/rubble/resource/fileset.rb
|
205
|
+
- lib/rubble/resource/webapp.rb
|
206
|
+
- lib/rubble/scope.rb
|
207
|
+
- lib/rubble/server.rb
|
208
|
+
- lib/rubble/snapshot.rb
|
209
|
+
- lib/rubble/target/base.rb
|
210
|
+
- lib/rubble/target/directory.rb
|
211
|
+
- lib/rubble/target/mysql.rb
|
212
|
+
- lib/rubble/target/tomcat.rb
|
213
|
+
- lib/rubble/tool.rb
|
214
|
+
- lib/rubble/version.rb
|
215
|
+
homepage: https://github.com/jochenseeber/rubble
|
216
|
+
licenses:
|
217
|
+
- AGPL-3.0
|
218
|
+
metadata:
|
219
|
+
issue_tracker: https://github.com/jochenseeber/rubble/issues
|
220
|
+
source_code: https://github.com/jochenseeber/rubble
|
221
|
+
documentation: http://rubydoc.info/gems/rubble/frames
|
222
|
+
wiki: https://github.com/jochenseeber/rubble/wiki
|
223
|
+
post_install_message:
|
224
|
+
rdoc_options: []
|
225
|
+
require_paths:
|
226
|
+
- lib
|
227
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
228
|
+
requirements:
|
229
|
+
- - ! '>='
|
230
|
+
- !ruby/object:Gem::Version
|
231
|
+
version: '1.9'
|
232
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - ! '>='
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '0'
|
237
|
+
requirements: []
|
238
|
+
rubyforge_project:
|
239
|
+
rubygems_version: 2.2.2
|
240
|
+
signing_key:
|
241
|
+
specification_version: 4
|
242
|
+
summary: Lightweight convention over configuration deploy tool
|
243
|
+
test_files: []
|
244
|
+
has_rdoc:
|