avodeploy 0.4.2 → 0.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9eb2622171b0f1c3e6a7aa3fd51eefc83d78081f
4
- data.tar.gz: 55218f0f1f3280d66e6f948d9b63b85e2a094512
3
+ metadata.gz: c5a1b04cd17393f6c97bf4de8b47b6d9c1f6917c
4
+ data.tar.gz: 8b63dc83eab4cea72b00b4a874d6e809ff79066b
5
5
  SHA512:
6
- metadata.gz: 1b5eda736217651f0407572840b49ffac53efb969681dfca8b56e52035f1b07e30b459f72af25325bc7949dd039231cd0feaf16fdb598844c4e42cdbc6cea747
7
- data.tar.gz: 82394f84a81e5798e76d799d739e8d494b17b85eb7e34c8278e1aa395a55d22e91f9b5ec8cae3f34f0329b5bcdcc8173785a2c75810032fb54f08f74948ccc41
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.4.2.
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.
@@ -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 = "avodeploy"
7
+ spec.name = 'avodeploy'
8
8
  spec.version = AvoDeploy::VERSION
9
- spec.authors = ["David Prandzioch"]
10
- spec.email = ["dprandzioch@me.com"]
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 = "http://dprandzioch.github.io/avocado/"
14
- spec.license = "GPLv2"
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 = ["avo"]
17
+ spec.executables = ['avo']
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
19
+ spec.require_paths = ['lib']
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.7"
22
- spec.add_development_dependency "rake", "~> 10.0"
21
+ spec.required_ruby_version = '>= 2.0.0'
23
22
 
24
- spec.add_dependency "terminal-table", "~> 1.4.5"
25
- spec.add_dependency "net-ssh", "~> 2.9.1"
26
- spec.add_dependency "net-scp", "~> 1.2.1"
27
- spec.add_dependency "thor", "~> 0.19.1"
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
- package_name "Avocado"
29
-
30
- class_option :verbose, :type => :boolean, :aliases => :v
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
- long_desc <<-LONGDESC
37
- `avo start` will execute a chain of tasks specified in either the deployment strategy
38
- or the deployment manifest (Avofile). Instead of invoking the chain with its name
39
- just use the actual task you want to execute and Avocado will take care of executing the
40
- right task chain for your needs.
41
- LONGDESC
42
- def start(stage, task)
43
- instance = AvoDeploy::Bootstrap.run(stage, options[:verbose], options[:debug])
44
-
45
- if options[:nodeps]
46
- instance.task_manager.invoke_task_oneshot(task)
47
- else
48
- instance.task_manager.invoke_task_chain_containing(task)
49
- end
50
- end
51
-
52
- desc 'task [NAME] [--stage="[STAGE]"]', "Show more information about a specific task"
53
- method_options :name => :string
54
- option :stage, :type => :string, :aliases => :s
55
- def task(name)
56
- if options[:stage].nil? == false
57
- stage = options[:stage]
58
- else
59
- stage = :default
60
- end
61
-
62
- instance = AvoDeploy::Bootstrap.run(stage, options[:verbose], options[:debug])
63
- task = instance.task_manager.task_by_name(name)
64
-
65
- puts Terminal::Table.new :title => 'Task overview', :rows => [
66
- ['Name', task.name],
67
- ['Description', task.desc],
68
- ['Scope', task.scope],
69
- ['Visibility', task.visibility],
70
- ]
71
- end
72
-
73
- desc "chains [STAGE]", "List all chains for the current stage"
74
- method_options :stage => :string
75
- def chains(stage)
76
- instance = AvoDeploy::Bootstrap.run(stage, options[:verbose], options[:debug])
77
-
78
- instance.task_manager.chains.each do |chain|
79
- rows = []
80
-
81
- chain.each_pair do |key, task|
82
- if task.visibility = :public
83
- rows << [
84
- task.name,
85
- task.scope,
86
- task.desc
87
- ]
88
- end
89
- end
90
-
91
- puts Terminal::Table.new :title => "Chain overview",
92
- :headings => ['Title', 'Scope', 'Description'],
93
- :rows => rows
94
- end
95
- end
96
-
97
- desc "stages", "List all stages"
98
- def stages
99
- instance = AvoDeploy::Bootstrap.run(:default, options[:verbose], options[:debug])
100
-
101
- puts Terminal::Table.new :title => "Stages list",
102
- :headings => ['Title', 'Description'],
103
- :rows => instance.config.stages
104
- end
105
-
106
- desc "install [--stages=staging,qa,production]", "Creates a Avofile in your project directory"
107
- option :stages, :type => :string
108
- def install
109
- if File.exist?(Dir.pwd.concat('/Avofile'))
110
- puts 'The Avofile does already exist. No need to create a new one.'
111
- Kernel.exit(true)
112
- end
113
-
114
- stages = [ 'staging', 'production' ]
115
-
116
- if options[:stages].nil? == false
117
- stages = options[:stages].split(',')
118
- end
119
-
120
- data = {
121
- :stages => stages,
122
- }
123
-
124
- require 'erb'
125
- renderer = ERB.new(File.new(File.dirname(THIS_FILE) + '/../lib/avodeploy/skel/manifest_template.rb.erb').read)
126
- output = renderer.result(binding)
127
-
128
- File.write(Dir.pwd.concat('/Avofile'), output)
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
 
@@ -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'
@@ -17,77 +17,69 @@
17
17
  =end
18
18
 
19
19
  module AvoDeploy
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
- # load user config initially to determine strategy
49
- begin
50
- load File.join(Dir.pwd, 'Avofile')
51
- rescue RuntimeError => e
52
- # `find_chain_index_containing': could not find a chain containing task create_deployment_tarball (RuntimeError)
53
- # error not neccessary because dependencies are not loaded
54
- end
55
-
56
- if debug
57
- instance.log.level = Logger::DEBUG
58
- elsif verbose
59
- instance.log.level = Logger::INFO
60
- else
61
- instance.log.level = instance.config.get(:log_level)
62
- end
63
-
64
- instance.log.debug "Loading deployment strategy #{instance.config.get(:strategy).to_s}..."
65
-
66
- # load strategy
67
- # @todo check
68
- require "avodeploy/strategy/base.rb"
69
- require "avodeploy/strategy/#{instance.config.get(:strategy).to_s}.rb"
70
-
71
- instance.log.debug "Loading user configuration..."
72
-
73
- # override again by user config to allow manipulation of tasks
74
- load File.join(Dir.pwd, 'Avofile')
75
-
76
- # requested stage was not found
77
- if instance.config.loaded_stage.nil?
78
- raise ArgumentError, 'The requested stage does not exist.'
79
- end
80
- rescue Exception => e
81
- if debug
82
- raise e
83
- else
84
- AvoDeploy::Deployment.instance.log.error e.message.red
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