promotion 1.0.9 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/bin/devolve +3 -8
- data/bin/evolve +4 -8
- data/bin/promote +6 -16
- data/lib/promotion/application.rb +1 -0
- data/lib/promotion/config.rb +0 -7
- data/lib/promotion/generator.rb +3 -1
- data/lib/promotion.rb +2 -0
- metadata +21 -6
data/CHANGELOG
CHANGED
data/bin/devolve
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
#!/usr/local/bin/ruby -I/usr/local/
|
2
2
|
# This script devolves the database
|
3
|
-
|
3
|
+
require 'rubygems'
|
4
|
+
require 'promotion'
|
4
5
|
require 'getoptlong'
|
5
6
|
#______________________
|
6
7
|
# Set usage
|
7
8
|
#
|
8
9
|
usage=<<-EOT
|
9
10
|
devolve - devolve the database schema using migration scripts
|
10
|
-
usage: sudo /usr/local/bin/devolve
|
11
|
+
usage: sudo /usr/local/bin/devolve appname target
|
11
12
|
where appname is the name of a folder in /var/staging containing a file deploy.xml
|
12
13
|
target integer version to devolve to
|
13
14
|
EOT
|
@@ -15,15 +16,12 @@ EOT
|
|
15
16
|
# parse options
|
16
17
|
#
|
17
18
|
opts = GetoptLong.new(
|
18
|
-
[ "--config", "-c", GetoptLong::REQUIRED_ARGUMENT ],
|
19
19
|
[ "--help", "-h", GetoptLong::NO_ARGUMENT ]
|
20
20
|
)
|
21
21
|
config = nil
|
22
22
|
configFilename = nil
|
23
23
|
opts.each do |opt, arg|
|
24
24
|
case opt
|
25
|
-
when "--config"
|
26
|
-
configFilename = arg
|
27
25
|
when "--help"
|
28
26
|
puts usage
|
29
27
|
exit 1
|
@@ -43,8 +41,6 @@ unless targetVersion >= 1000
|
|
43
41
|
puts(usage)
|
44
42
|
exit 1
|
45
43
|
end
|
46
|
-
configFilename ||= "promotion/config.rb"
|
47
|
-
require(configFilename)
|
48
44
|
unless File.directory?(File.expand_path(appname, Folders::Staging))
|
49
45
|
puts("The application #{appname} was not found in the staging area #{Folders::Staging}")
|
50
46
|
puts("Aborting")
|
@@ -54,6 +50,5 @@ end
|
|
54
50
|
# start application
|
55
51
|
#
|
56
52
|
$stdout.flush()
|
57
|
-
require 'promotion/application'
|
58
53
|
app = Promotion::Application.new(appname)
|
59
54
|
app.devolve(targetVersion)
|
data/bin/evolve
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
#!/usr/local/bin/ruby -I/usr/local/
|
2
2
|
# This script evolves the database
|
3
|
-
|
3
|
+
require 'rubygems'
|
4
|
+
require 'promotion'
|
4
5
|
require 'getoptlong'
|
5
6
|
#______________________
|
6
7
|
# Set usage
|
7
8
|
#
|
8
9
|
usage=<<-EOT
|
9
10
|
evolve - evolve the database schema using migration scripts
|
10
|
-
usage: sudo /usr/local/bin/evolve
|
11
|
+
usage: sudo /usr/local/bin/evolve appname [target]
|
11
12
|
where appname is the name of a folder in /var/staging containing a file deploy.xml
|
12
13
|
target is an integer version to evolve to (default is to evolve as far as possible)
|
13
14
|
EOT
|
@@ -15,15 +16,12 @@ EOT
|
|
15
16
|
# parse options
|
16
17
|
#
|
17
18
|
opts = GetoptLong.new(
|
18
|
-
[ "--config", "-c", GetoptLong::REQUIRED_ARGUMENT ],
|
19
19
|
[ "--help", "-h", GetoptLong::NO_ARGUMENT ]
|
20
20
|
)
|
21
21
|
config = nil
|
22
22
|
configFilename = nil
|
23
23
|
opts.each do |opt, arg|
|
24
24
|
case opt
|
25
|
-
when "--config"
|
26
|
-
configFilename = arg
|
27
25
|
when "--help"
|
28
26
|
puts usage
|
29
27
|
exit 1
|
@@ -44,8 +42,7 @@ if ARGV.length > 1
|
|
44
42
|
exit 1
|
45
43
|
end
|
46
44
|
end
|
47
|
-
|
48
|
-
require(configFilename)
|
45
|
+
|
49
46
|
unless File.directory?(File.expand_path(appname, Folders::Staging))
|
50
47
|
puts("The application #{appname} was not found in the staging area #{Folders::Staging}")
|
51
48
|
puts("Aborting")
|
@@ -55,6 +52,5 @@ end
|
|
55
52
|
# start application
|
56
53
|
#
|
57
54
|
$stdout.flush()
|
58
|
-
require 'promotion/application'
|
59
55
|
app = Promotion::Application.new(appname)
|
60
56
|
app.evolve(targetVersion)
|
data/bin/promote
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/local/bin/ruby
|
2
|
-
# This script
|
2
|
+
# This script deploys the given application
|
3
3
|
|
4
4
|
#______________________
|
5
5
|
if Process.euid != 0
|
@@ -13,23 +13,19 @@ require 'getoptlong'
|
|
13
13
|
#
|
14
14
|
usage=<<-EOT
|
15
15
|
promotion - installer and configuration manager
|
16
|
-
usage: sudo /usr/local/
|
16
|
+
usage: sudo /usr/local/sbin/promotion appname
|
17
17
|
where appname is the name of a folder under /var/staging
|
18
18
|
EOT
|
19
19
|
#______________________
|
20
20
|
# parse options
|
21
21
|
#
|
22
22
|
opts = GetoptLong.new(
|
23
|
-
[ "--config", "-c", GetoptLong::REQUIRED_ARGUMENT ],
|
24
|
-
[ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
|
25
23
|
[ "--help", "-h", GetoptLong::NO_ARGUMENT ]
|
26
24
|
)
|
27
25
|
config = nil
|
28
26
|
configFilename = nil
|
29
27
|
opts.each do |opt, arg|
|
30
28
|
case opt
|
31
|
-
when "--config"
|
32
|
-
configFilename = arg
|
33
29
|
when "--help"
|
34
30
|
puts usage
|
35
31
|
exit 1
|
@@ -38,10 +34,8 @@ end
|
|
38
34
|
#______________________
|
39
35
|
# check arguments
|
40
36
|
#
|
41
|
-
if ARGV.length() == 0
|
42
|
-
puts("
|
43
|
-
elsif ARGV.length() > 1
|
44
|
-
puts("Please specify just one application at a time.")
|
37
|
+
if ARGV.length() == 0 or ARGV.length() > 1
|
38
|
+
puts("Please specify a single application to deploy.")
|
45
39
|
puts(usage)
|
46
40
|
exit 1
|
47
41
|
end
|
@@ -52,16 +46,12 @@ unless File.directory?(File.expand_path(appname, "/var/staging"))
|
|
52
46
|
exit 1
|
53
47
|
end
|
54
48
|
#______________________
|
55
|
-
# Configure
|
56
|
-
#
|
57
|
-
configFilename ||= "promotion/config.rb"
|
58
|
-
require(configFilename)
|
59
|
-
#______________________
|
60
49
|
# start application
|
61
50
|
#
|
51
|
+
require 'rubygems'
|
52
|
+
require 'promotion'
|
62
53
|
print("Promoting #{appname}...")
|
63
54
|
$stdout.flush()
|
64
|
-
require 'promotion/application'
|
65
55
|
app = Promotion::Application.new(appname)
|
66
56
|
app.promote()
|
67
57
|
puts("OK.")
|
data/lib/promotion/config.rb
CHANGED
@@ -6,8 +6,6 @@ module Folders
|
|
6
6
|
# The folder where applications are staged (eg. from Subversion)
|
7
7
|
# ready for deployment
|
8
8
|
Staging = "/var/staging"
|
9
|
-
# The folder containing the ERB templates
|
10
|
-
Templates = "/usr/local/promotion/erb"
|
11
9
|
# The system crontab folder
|
12
10
|
Crontabs = "/var/cron/tabs"
|
13
11
|
end
|
@@ -48,8 +46,3 @@ module Templates
|
|
48
46
|
Crontab = "crontab.erb"
|
49
47
|
end
|
50
48
|
|
51
|
-
raise "staging area not found" unless File.directory?(Folders::Staging)
|
52
|
-
raise "template folder not found" unless File.directory?(Folders::Templates)
|
53
|
-
Templates.constants { |template|
|
54
|
-
raise "template #{template} not found" unless File.exist?(File.expand_path(Templates.const_get(template), Folders::Templates))
|
55
|
-
}
|
data/lib/promotion/generator.rb
CHANGED
@@ -12,6 +12,8 @@ module Promotion # :nodoc:
|
|
12
12
|
# like JAVA_HOME and MYAPP_BASE.
|
13
13
|
class Generator
|
14
14
|
|
15
|
+
TEMPLATES = File.expand_path("erb", File.dirname(__FILE__))
|
16
|
+
|
15
17
|
# Returns the XML specification for the selected application
|
16
18
|
attr_accessor :specs
|
17
19
|
|
@@ -65,7 +67,7 @@ class Generator
|
|
65
67
|
# Returns the ERB generator
|
66
68
|
def generator_for(sym)
|
67
69
|
begin
|
68
|
-
templateFilename = File.expand_path(Templates.const_get(sym),
|
70
|
+
templateFilename = File.expand_path(Templates.const_get(sym), TEMPLATES)
|
69
71
|
raise "Missing template for #{sym}" unless File.exists?(templateFilename)
|
70
72
|
$log.debug("Generating with template #{templateFilename}")
|
71
73
|
templateFile = File.new(templateFilename, File::RDONLY)
|
data/lib/promotion.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: promotion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.9
|
10
|
+
version: 1.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Richard Kernahan
|
@@ -15,9 +15,24 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-09-
|
19
|
-
dependencies:
|
20
|
-
|
18
|
+
date: 2012-09-20 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: log4r
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 7
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 1
|
32
|
+
- 10
|
33
|
+
version: 1.1.10
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
21
36
|
description: "\t\tThe Promotion tool is designed to make it easy and quick to deploy an application\n\
|
22
37
|
\t\tinto production. Originally built for use with OpenBSD, it can be used on an *nix\n\
|
23
38
|
\t\tsystem by adjusting a few paths (in config.rb).\n\n\
|