avodeploy 0.4.2 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +20 -0
- data/README.md +1 -1
- data/avodeploy.gemspec +16 -14
- data/bin/avo +101 -104
- data/lib/avodeploy.rb +1 -0
- data/lib/avodeploy/bootstrap.rb +65 -73
- data/lib/avodeploy/command_execution_result.rb +6 -6
- data/lib/avodeploy/config.rb +120 -99
- data/lib/avodeploy/core_ext/string_colors.rb +9 -9
- data/lib/avodeploy/deployment.rb +43 -46
- data/lib/avodeploy/multi_io.rb +11 -11
- data/lib/avodeploy/scm_provider/bzr_scm_provider.rb +111 -0
- data/lib/avodeploy/scm_provider/git_scm_provider.rb +66 -45
- data/lib/avodeploy/scm_provider/scm_provider.rb +57 -43
- data/lib/avodeploy/skel/manifest_template.rb.erb +127 -116
- data/lib/avodeploy/strategy/base.rb +7 -7
- data/lib/avodeploy/strategy/local_copy.rb +99 -79
- data/lib/avodeploy/strategy/local_copy_partial.rb +86 -0
- data/lib/avodeploy/target.rb +32 -31
- data/lib/avodeploy/task/local_task_execution_environment.rb +112 -107
- data/lib/avodeploy/task/remote_task_execution_environment.rb +90 -94
- data/lib/avodeploy/task/task.rb +53 -42
- data/lib/avodeploy/task/task_dependency.rb +5 -5
- data/lib/avodeploy/task/task_execution_environment.rb +70 -59
- data/lib/avodeploy/task/task_manager.rb +187 -165
- data/lib/avodeploy/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5a1b04cd17393f6c97bf4de8b47b6d9c1f6917c
|
4
|
+
data.tar.gz: 8b63dc83eab4cea72b00b4a874d6e809ff79066b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac202f5b23a6709f2e3957947307a15757d784d2a7a8e4778c6dbfc02741a353c9165197076026085359f0003414c0e451dab699c6b2a419513a1a964a504003
|
7
|
+
data.tar.gz: 27e865de96259b7b52900effd25b5b3a40e7a65a3bca10a41a96b3a45b4fdaab312905aaa185b87824581ab52cc4f440333516aa64cac298d6906d64a2f077fb
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
0.5
|
2
|
+
|
3
|
+
* avo cli command is now verbose by default
|
4
|
+
* Optimized various log levels
|
5
|
+
* SSH connections time out after 30 seconds
|
6
|
+
* Bugfix: tar exclude now uses regular expressions, matching only strict definitions
|
7
|
+
* Configuration option `force_tag` allows to enforce tag deployments (#20)
|
8
|
+
* The `-t` / `--tag` parameter allows deployment of tags (#17)
|
9
|
+
* Configuration option `setup_stage` now uses symbols for names by default (#15)
|
10
|
+
* `avo -v` does not longer show debug output (#16)
|
11
|
+
* Target configuration option `port` allows usage of non-standard ssh ports (#19)
|
12
|
+
* Ignored files are not longer deleted, but excluded while creating the deployment archive
|
13
|
+
* Bzr SCM-Provider implemented
|
14
|
+
* Tasks can now call other tasks using `run` or `run_nodeps`
|
15
|
+
* Implemented `only` and `except` condition for remote hosts
|
16
|
+
* Code reformatted, Tabs to spaces
|
17
|
+
* Added requirement for Ruby >= 2.0 in the gemspec file
|
18
|
+
* `local_copy_partial` strategy implemented. Just uploads files, that have changes since the last deployment + untracked files
|
19
|
+
* `inherit_strategy` implemented, allows to extend existing strategies
|
20
|
+
|
1
21
|
0.4.2
|
2
22
|
* Bugfix: Avocado cannot resolve defined stages
|
3
23
|
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@ develop: ![](https://travis-ci.org/dprandzioch/avocado.svg?branch=develop) | mas
|
|
3
3
|
### Avocado
|
4
4
|
Avocado is a deployment framework for web applications written in Ruby.
|
5
5
|
|
6
|
-
The current release is 0.
|
6
|
+
The current release is 0.5.
|
7
7
|
|
8
8
|
### Licensing
|
9
9
|
Avocado is licensed under the GPLv2. For more Information have a look into the LICENSE file.
|
data/avodeploy.gemspec
CHANGED
@@ -4,25 +4,27 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'avodeploy/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'avodeploy'
|
8
8
|
spec.version = AvoDeploy::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['David Prandzioch']
|
10
|
+
spec.email = ['kontakt@davidprandzioch.de']
|
11
11
|
spec.summary = %q{Avocado is a flexible deployment framework for web applications.}
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
12
|
+
spec.description = ''
|
13
|
+
spec.homepage = 'http://dprandzioch.github.io/avocado/'
|
14
|
+
spec.license = 'GPLv2'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = [
|
17
|
+
spec.executables = ['avo']
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.
|
22
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
21
|
+
spec.required_ruby_version = '>= 2.0.0'
|
23
22
|
|
24
|
-
spec.
|
25
|
-
spec.
|
26
|
-
|
27
|
-
spec.add_dependency
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
24
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
+
|
26
|
+
spec.add_dependency 'terminal-table', '~> 1.4.5'
|
27
|
+
spec.add_dependency 'net-ssh', '~> 2.9.1'
|
28
|
+
spec.add_dependency 'net-scp', '~> 1.2.1'
|
29
|
+
spec.add_dependency 'thor', '~> 0.19.1'
|
28
30
|
end
|
data/bin/avo
CHANGED
@@ -25,110 +25,107 @@ require File.join(File.dirname(THIS_FILE), '../lib/avodeploy.rb')
|
|
25
25
|
|
26
26
|
class AvocadoCli < Thor
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
puts 'The deployment manifest file called `Avofile` has been created in the current directory.'
|
131
|
-
end
|
28
|
+
package_name 'Avocado'
|
29
|
+
|
30
|
+
class_option :verbose, :type => :boolean, :aliases => :v, :default => true
|
31
|
+
class_option :debug, :type => :boolean, :aliases => :d
|
32
|
+
|
33
|
+
desc 'start [STAGE] [TASK]', 'Start a task in the specified stage'
|
34
|
+
method_options :stage => :string, :task => :string
|
35
|
+
option :nodeps, :type => :boolean, :aliases => :n
|
36
|
+
option :tag, :type => :string, :aliases => :t
|
37
|
+
long_desc <<-LONGDESC
|
38
|
+
`avo start` will execute a chain of tasks specified in either the deployment strategy
|
39
|
+
or the deployment manifest (Avofile). Instead of invoking the chain with its name
|
40
|
+
just use the actual task you want to execute and Avocado will take care of executing the
|
41
|
+
right task chain for your needs.
|
42
|
+
LONGDESC
|
43
|
+
def start(stage, task)
|
44
|
+
instance = AvoDeploy::Bootstrap.run(stage, options[:verbose], options[:debug])
|
45
|
+
|
46
|
+
if options[:nodeps]
|
47
|
+
instance.task_manager.invoke_task_oneshot(task, options)
|
48
|
+
else
|
49
|
+
instance.task_manager.invoke_task_chain_containing(task, options)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
desc 'task [NAME] [--stage="[STAGE]"]', 'Show more information about a specific task'
|
54
|
+
method_options :name => :string
|
55
|
+
option :stage, :type => :string, :aliases => :s
|
56
|
+
def task(name)
|
57
|
+
if options[:stage].nil? == false
|
58
|
+
stage = options[:stage]
|
59
|
+
else
|
60
|
+
stage = :default
|
61
|
+
end
|
62
|
+
|
63
|
+
instance = AvoDeploy::Bootstrap.run(stage, options[:verbose], options[:debug])
|
64
|
+
task = instance.task_manager.task_by_name(name)
|
65
|
+
|
66
|
+
puts Terminal::Table.new :title => 'Task overview', :rows => [
|
67
|
+
['Name', task.name],
|
68
|
+
['Description', task.desc],
|
69
|
+
['Scope', task.scope],
|
70
|
+
['Visibility', task.visibility],
|
71
|
+
]
|
72
|
+
end
|
73
|
+
|
74
|
+
desc 'chains [STAGE]', 'List all chains for the current stage'
|
75
|
+
method_options :stage => :string
|
76
|
+
def chains(stage)
|
77
|
+
instance = AvoDeploy::Bootstrap.run(stage, options[:verbose], options[:debug])
|
78
|
+
|
79
|
+
instance.task_manager.chains.each do |chain|
|
80
|
+
rows = []
|
81
|
+
|
82
|
+
chain.each_pair do |key, task|
|
83
|
+
if task.visibility = :public
|
84
|
+
rows << [
|
85
|
+
task.name,
|
86
|
+
task.scope,
|
87
|
+
task.desc
|
88
|
+
]
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
puts Terminal::Table.new :title => 'Chain overview',
|
93
|
+
:headings => ['Title', 'Scope', 'Description'],
|
94
|
+
:rows => rows
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
desc 'stages', 'List all configured stages'
|
99
|
+
def stages
|
100
|
+
instance = AvoDeploy::Bootstrap.run(:default, options[:verbose], options[:debug])
|
101
|
+
|
102
|
+
puts Terminal::Table.new :title => "Stages list",
|
103
|
+
:headings => ['Title', 'Description'],
|
104
|
+
:rows => instance.config.stages
|
105
|
+
end
|
106
|
+
|
107
|
+
desc 'install [--stages=staging,qa,production]', 'Creates a Avofile in your project directory'
|
108
|
+
option :stages, :type => :string
|
109
|
+
def install
|
110
|
+
if File.exist?(Dir.pwd.concat('/Avofile'))
|
111
|
+
puts 'The Avofile does already exist. No need to create a new one.'
|
112
|
+
Kernel.exit(true)
|
113
|
+
end
|
114
|
+
|
115
|
+
stages = %w(staging production)
|
116
|
+
|
117
|
+
if options[:stages].nil? == false
|
118
|
+
stages = options[:stages].split(',')
|
119
|
+
end
|
120
|
+
|
121
|
+
require 'erb'
|
122
|
+
renderer = ERB.new(File.new(File.dirname(THIS_FILE) + '/../lib/avodeploy/skel/manifest_template.rb.erb').read)
|
123
|
+
output = renderer.result(binding)
|
124
|
+
|
125
|
+
File.write(Dir.pwd.concat('/Avofile'), output)
|
126
|
+
|
127
|
+
puts 'The deployment manifest file called `Avofile` has been created in the current directory.'
|
128
|
+
end
|
132
129
|
|
133
130
|
end
|
134
131
|
|
data/lib/avodeploy.rb
CHANGED
@@ -15,6 +15,7 @@ require 'avodeploy/task/remote_task_execution_environment.rb'
|
|
15
15
|
|
16
16
|
require 'avodeploy/scm_provider/scm_provider.rb'
|
17
17
|
require 'avodeploy/scm_provider/git_scm_provider.rb'
|
18
|
+
require 'avodeploy/scm_provider/bzr_scm_provider.rb'
|
18
19
|
|
19
20
|
require 'avodeploy/multi_io.rb'
|
20
21
|
require 'avodeploy/command_execution_result.rb'
|
data/lib/avodeploy/bootstrap.rb
CHANGED
@@ -17,77 +17,69 @@
|
|
17
17
|
=end
|
18
18
|
|
19
19
|
module AvoDeploy
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
end
|
86
|
-
|
87
|
-
Kernel.exit(true)
|
88
|
-
end
|
89
|
-
|
90
|
-
AvoDeploy::Deployment.instance
|
91
|
-
end
|
92
|
-
end
|
20
|
+
class Bootstrap
|
21
|
+
# Runs the avocado bootstrap
|
22
|
+
#
|
23
|
+
# @param stage [Symbol] the stage to bootstrap
|
24
|
+
# @param verbose [Boolean] run in verbose mode
|
25
|
+
# @param debug [Boolean] run in boolean mode
|
26
|
+
def self.run(stage = :default, verbose = false, debug = false)
|
27
|
+
if stage.is_a?(String)
|
28
|
+
stage = stage.to_sym
|
29
|
+
end
|
30
|
+
|
31
|
+
begin
|
32
|
+
# defaults
|
33
|
+
AvoDeploy::Deployment.configure do
|
34
|
+
set :stage, stage
|
35
|
+
|
36
|
+
setup_stage :default do
|
37
|
+
# a default stage is needed for some use cases,
|
38
|
+
# especially if you don't know which stages were defined by the user
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
if File.exist?(Dir.pwd.concat('/Avofile')) == false
|
43
|
+
raise RuntimeError, 'Could not find Avofile. Run `avo install` first.'
|
44
|
+
end
|
45
|
+
|
46
|
+
instance = AvoDeploy::Deployment.instance
|
47
|
+
|
48
|
+
if debug
|
49
|
+
instance.log.level = Logger::DEBUG
|
50
|
+
elsif verbose
|
51
|
+
instance.log.level = Logger::INFO
|
52
|
+
else
|
53
|
+
instance.log.level = instance.config.get(:log_level)
|
54
|
+
end
|
55
|
+
|
56
|
+
# load user config initially to determine strategy
|
57
|
+
begin
|
58
|
+
load File.join(Dir.pwd, 'Avofile')
|
59
|
+
rescue RuntimeError => e
|
60
|
+
# `find_chain_index_containing': could not find a chain containing task create_deployment_tarball (RuntimeError)
|
61
|
+
# error not neccessary because dependencies are not loaded
|
62
|
+
end
|
63
|
+
|
64
|
+
instance.log.debug 'Loading user configuration...'
|
65
|
+
# override again by user config to allow manipulation of tasks
|
66
|
+
load File.join(Dir.pwd, 'Avofile')
|
67
|
+
|
68
|
+
# requested stage was not found
|
69
|
+
if instance.config.loaded_stage.nil?
|
70
|
+
raise ArgumentError, 'The requested stage does not exist.'
|
71
|
+
end
|
72
|
+
rescue Exception => e
|
73
|
+
#if debug
|
74
|
+
raise e
|
75
|
+
#else
|
76
|
+
# AvoDeploy::Deployment.instance.log.error e.message.red
|
77
|
+
#end
|
78
|
+
|
79
|
+
Kernel.exit(true)
|
80
|
+
end
|
81
|
+
|
82
|
+
AvoDeploy::Deployment.instance
|
83
|
+
end
|
84
|
+
end
|
93
85
|
end
|