dkdeploy-core 8.0.2 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +9 -0
  3. data/.travis.yml +13 -0
  4. data/CHANGELOG.md +38 -0
  5. data/CONTRIBUTORS.md +2 -0
  6. data/LICENSE +1 -1
  7. data/README.md +8 -5
  8. data/Vagrantfile +3 -10
  9. data/assets/dkdeploy-logo.png +0 -0
  10. data/config/vm/cookbooks/dkdeploy-core/recipes/default.rb +13 -1
  11. data/config/vm/cookbooks/dkdeploy-core/templates/my_extra_settings.erb +6 -0
  12. data/dkdeploy-core.gemspec +11 -12
  13. data/features/assets.feature +24 -26
  14. data/features/db.feature +4 -0
  15. data/features/mysql.feature +27 -0
  16. data/features/support/env.rb +1 -1
  17. data/lib/capistrano/dkdeploy/core.rb +11 -22
  18. data/lib/dkdeploy/constants.rb +5 -73
  19. data/lib/dkdeploy/core/version.rb +2 -2
  20. data/lib/dkdeploy/dsl.rb +1 -1
  21. data/lib/dkdeploy/helpers/assets.rb +0 -1
  22. data/lib/dkdeploy/helpers/db.rb +1 -1
  23. data/lib/dkdeploy/helpers/mysql.rb +17 -0
  24. data/lib/dkdeploy/i18n.rb +6 -0
  25. data/lib/dkdeploy/interaction_handler/mysql.rb +38 -0
  26. data/lib/dkdeploy/interaction_handler/password.rb +3 -2
  27. data/lib/dkdeploy/scm/copy.rake +76 -0
  28. data/lib/dkdeploy/scm/copy.rb +85 -0
  29. data/lib/dkdeploy/tasks/apache.rake +0 -1
  30. data/lib/dkdeploy/tasks/assets.rake +0 -1
  31. data/lib/dkdeploy/tasks/bower.rake +0 -1
  32. data/lib/dkdeploy/tasks/db.rake +20 -28
  33. data/lib/dkdeploy/tasks/deploy.rake +1 -11
  34. data/lib/dkdeploy/tasks/enhanced_symlinks.rake +3 -3
  35. data/lib/dkdeploy/tasks/file_access.rake +8 -9
  36. data/lib/dkdeploy/tasks/maintenance.rake +0 -1
  37. data/lib/dkdeploy/tasks/mysql.rake +50 -0
  38. data/lib/dkdeploy/tasks/project_version.rake +0 -1
  39. data/lib/dkdeploy/tasks/utils.rake +6 -2
  40. data/spec/fixtures/application/Gemfile +1 -1
  41. data/spec/fixtures/application/config/deploy/dev.rb +6 -3
  42. data/spec/fixtures/application/config/deploy.rb +42 -5
  43. data/spec/fixtures/application/config/preseed/default_content.sql.gz +0 -0
  44. data/spec/fixtures/application/config/preseed/download.tar.gz +0 -0
  45. data/spec/fixtures/capistrano/configuration/add_output_after_create_symlink.rb +1 -2
  46. data/spec/fixtures/capistrano/configuration/custom_compass_sources.rb +2 -2
  47. metadata +41 -55
  48. data/lib/dkdeploy/copy.rb +0 -121
  49. data/lib/dkdeploy/tasks/copy.rake +0 -26
  50. data/spec/fixtures/application/config/preseed/fileadmin.tar.gz +0 -0
  51. data/spec/fixtures/application/config/preseed/uploads.tar.gz +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: b5846f07138e4d272475da910cff374e8fe2fe7278b9ea2683279ec8e09eab60
4
- data.tar.gz: d6f68807f4bd1242fcda8ba7cd28338bc5bd245d6c107674828708c05e79cca4
2
+ SHA1:
3
+ metadata.gz: 0fa351619fa4722337d6fed4eaed15806f9ee10d
4
+ data.tar.gz: 49176a8bb577edf5251c4f5cc77bac4e7c11172d
5
5
  SHA512:
6
- metadata.gz: b73c7736d0b6b723e1d0df36595d731e69df61e04af625cf1a88397f8199776ffc8da8f596cdb45f4b27796a0396de1f19b196fbe1f204e7417fce9c7fc274a3
7
- data.tar.gz: 0fb4360ca87226cd11f4f26b720ce8802a5cbbeacc89f0be496b2dabe9351c93ac51b04d2d827fa9db30d514770744ad6b3767ca4c9b9e608d1ee3186a1c1385
6
+ metadata.gz: 32be81315488b81b06275168d880499745d74d88d5567e43c4a6dd21ce6e2a53c89fd4ef190e9a9739f454096b949fd38b9969b5b12c66a86a3dfbb2e40a85f0
7
+ data.tar.gz: 20786fdcf4fdeaa824a2c3fa18ab91a78030b5ba1c038676e0747010b736076f9f80c6e5dd8175aae4d49cc40892a20a06f3ad35895839cad03df31de295323c
data/.rubocop.yml CHANGED
@@ -4,6 +4,11 @@ AllCops:
4
4
  - 'spec/fixtures/application/htdocs/stylesheets/**/config.rb'
5
5
  - 'config/**/*'
6
6
  - 'Vagrantfile'
7
+ - 'vendor/**/*'
8
+ TargetRubyVersion: 2.2
9
+ ExtraDetails: true
10
+ DisplayStyleGuide: true
11
+ DisplayCopNames: true
7
12
  GlobalVars:
8
13
  AllowedVariables: []
9
14
  MethodLength:
@@ -16,3 +21,7 @@ BracesAroundHashParameters:
16
21
  Enabled: false
17
22
  CyclomaticComplexity:
18
23
  Max: 10
24
+ Metrics/BlockLength:
25
+ Enabled: false
26
+ Style/FormatStringToken:
27
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ sudo: false
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.2
6
+ - 2.3
7
+ - 2.4
8
+
9
+ before_install:
10
+ - gem install bundler --no-document
11
+
12
+ script:
13
+ - bundle exec rubocop
data/CHANGELOG.md ADDED
@@ -0,0 +1,38 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+ This project adheres to [Semantic Versioning](http://semver.org/).
4
+
5
+ ## [9.0.0]
6
+ ### Summary
7
+
8
+ - tasks around MySQL slow log
9
+ - add `utils:create_local_temp_directory` task
10
+ - support for dkdeploy-test_environment v2.0.0
11
+ - Vagrant 2.0.x support
12
+ - rubocop upgrade to 0.50
13
+ - update capistrano to v3.9.0
14
+ - remove jenkins release suffix
15
+ - configuration option `additional_ignore_tables` changes from `string` to `array`
16
+ - set group permissions for `/var/www` in Chef cookbook (Vagrant)
17
+ - set proper gem homepage
18
+ - add travis support
19
+ - improved code syntax according to RuboCop
20
+ - install `mysql` instead of `mysql-connector-c`
21
+ - remove sshkit dsl includes
22
+ - remove TYPO3 specific configuration
23
+ - change some SCM roles from app to all
24
+
25
+ ## [8.0.1] - 2017-05-15
26
+ ### Summary
27
+
28
+ - hotfix for GH25: erroneous Capistrano scope
29
+
30
+ ## [8.0.0] - 2016-06-20
31
+ ### Summary
32
+
33
+ - first public release
34
+
35
+ [Unreleased]: https://github.com/dkdeploy/dkdeploy-core/compare/master...develop
36
+ [9.0.0]: https://github.com/dkdeploy/dkdeploy-core/releases/tag/v9.0.0
37
+ [8.0.1]: https://github.com/dkdeploy/dkdeploy-core/releases/tag/v8.0.1
38
+ [8.0.0]: https://github.com/dkdeploy/dkdeploy-core/releases/tag/v8.0.0
data/CONTRIBUTORS.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  The dkdeploy core maintainers would like to recognize following contributors (in alphabetic order):
4
4
 
5
+ - Jan Bergmann
6
+ - Dimitri Ebert
5
7
  - Sascha Egerer
6
8
  - Christoph Gerold
7
9
  - Johannes Goslar
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2016 dkd Internet Service GmbH, Frankfurt am Main (Germany), https://dkd.de/
1
+ Copyright (c) 2014-2017 dkd Internet Service GmbH, Frankfurt am Main (Germany), https://dkd.de/
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
- # Dkdeploy::Core
1
+ ![dkdeploy](assets/dkdeploy-logo.png)
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/dkdeploy-core.svg)](https://badge.fury.io/rb/dkdeploy-core)
3
+ # dkdeploy::core
4
+
5
+ [![Build Status](https://travis-ci.org/dkdeploy/dkdeploy-core.svg?branch=develop)](https://travis-ci.org/dkdeploy/dkdeploy-core)
6
+ [![Gem Version](https://badge.fury.io/rb/dkdeploy-core.svg)](https://badge.fury.io/rb/dkdeploy-core) [![Inline docs](http://inch-ci.org/github/dkdeploy/dkdeploy-core.svg?branch=develop)](http://inch-ci.org/github/dkdeploy/dkdeploy-core)
4
7
 
5
8
  ## Description
6
9
 
@@ -10,7 +13,7 @@ This Rubygem `dkdeploy-core` represents the extension of [Capistrano](http://cap
10
13
 
11
14
  Add this line to your application's `Gemfile`
12
15
 
13
- gem 'dkdeploy-core', '~> 8.0'
16
+ gem 'dkdeploy-core', '~> 9.0'
14
17
 
15
18
  and then execute
16
19
 
@@ -61,7 +64,7 @@ The complete list of the dkdeploy constants you find in `/lib/capistrano/dkdeplo
61
64
 
62
65
  ### Prerequisite
63
66
 
64
- rvm (v1.25.x) with installed Ruby 2.1.
67
+ rvm (v1.29.x) with installed Ruby 2.2.
65
68
 
66
69
  Add the virtual box alias to your `hosts` file
67
70
 
@@ -76,7 +79,7 @@ Add the virtual box alias to your `hosts` file
76
79
  ## Contributing
77
80
 
78
81
  1. Install [git flow](https://github.com/nvie/gitflow)
79
- 2. Install [Homebrew](http://brew.sh/) and run `brew install mysql-connector-c`
82
+ 2. Install [Homebrew](http://brew.sh/) and run `brew install mysql`
80
83
  3. Install [NodeJS](https://nodejs.org) (supported: v0.12.7) via `brew install nodejs`
81
84
  4. Install [Bower](http://bower.io) (supported: v1.7.9) via `npm install -g bower@1.7.9`
82
85
  5. If project is not checked out already do git clone `git@github.com:dkdeploy/dkdeploy-core.git`
data/Vagrantfile CHANGED
@@ -5,14 +5,7 @@ unless Vagrant.has_plugin?('vagrant-berkshelf')
5
5
  abort
6
6
  end
7
7
 
8
- unless Vagrant.has_plugin?('vagrant-omnibus')
9
- puts "Please install vagrant plugin vagrant-omnibus first\n"
10
- puts " vagrant plugin install vagrant-omnibus\n\n"
11
- puts "Exit vagrant\n\n"
12
- abort
13
- end
14
-
15
- Vagrant.require_version '~> 1.8.1'
8
+ Vagrant.require_version '~> 2.0.0'
16
9
  chef_version = '12.9.41'
17
10
 
18
11
  Vagrant.configure(2) do |config|
@@ -23,15 +16,15 @@ Vagrant.configure(2) do |config|
23
16
  config.vm.box = 'ubuntu/trusty64'
24
17
  config.vm.box_check_update = false
25
18
  config.berkshelf.enabled = true
26
- config.omnibus.chef_version = chef_version
27
19
 
28
20
  config.vm.define('dkdeploy-core', primary: true) do |master_config|
29
21
  master_config.vm.network 'private_network', ip: ip_address
30
22
 
31
23
  # Chef settings
32
24
  master_config.vm.provision :chef_solo do |chef|
25
+ chef.install = true
26
+ chef.channel = 'stable'
33
27
  chef.version = chef_version
34
- chef.install = false # omnibus does it already
35
28
  chef.log_level = :info
36
29
  chef.add_recipe 'dkdeploy-core'
37
30
  end
Binary file
@@ -22,6 +22,18 @@ mysql_service 'default' do
22
22
  # Need for remote connection
23
23
  bind_address '0.0.0.0'
24
24
  action [:create, :start]
25
+ run_group 'vagrant'
26
+ run_user 'vagrant'
27
+ end
28
+
29
+ mysql_config 'default' do
30
+ instance 'default' # necessary in some cases, causes hanging on provisioning https://github.com/chef-cookbooks/mysql/issues/387
31
+ # use different user to allow capistrano access to log file
32
+ owner 'vagrant'
33
+ group 'vagrant'
34
+ source 'my_extra_settings.erb'
35
+ notifies :restart, 'mysql_service[default]'
36
+ action :create
25
37
  end
26
38
 
27
39
  mysql2_chef_gem 'default' do
@@ -50,7 +62,7 @@ end
50
62
 
51
63
  directory '/var/www' do
52
64
  owner 'vagrant'
53
- owner 'vagrant'
65
+ group 'vagrant'
54
66
  mode '0770'
55
67
  action :create
56
68
  end
@@ -0,0 +1,6 @@
1
+ [mysqld]
2
+ # configure mysql to produce log with slow queries
3
+ # log-output = /var/log/mysql-default/
4
+ slow_query_log = 1
5
+ # log file - needs to match :mysql_slow_log in deploy.rb of fixture
6
+ slow_query_log_file = /var/log/mysql-default/slow-queries.log
@@ -1,4 +1,3 @@
1
- # coding: utf-8
2
1
  lib = File.expand_path('../lib', __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'dkdeploy/core/version'
@@ -7,28 +6,28 @@ Gem::Specification.new do |spec|
7
6
  spec.name = 'dkdeploy-core'
8
7
  spec.version = Dkdeploy::Core::Version
9
8
  spec.license = 'MIT'
10
- spec.authors = ['Lars Tode', 'Timo Webler', 'Kieran Hayes', 'Nicolai Reuschling', 'Johannes Goslar', 'Luka Lüdicke']
11
- spec.email = %w(lars.tode@dkd.de timo.webler@dkd.de kieran.hayes@dkd.de nicolai.reuschling@dkd.de johannes.goslar@dkd.de luka.luedicke@dkd.de)
9
+ spec.authors = ['Timo Webler', 'Nicolai Reuschling']
10
+ spec.email = %w[timo.webler@dkd.de nicolai.reuschling@dkd.de]
12
11
  spec.description = 'dkd basic deployment tasks and strategies'
13
12
  spec.summary = 'dkd basic deployment tasks and strategies'
14
- spec.homepage = 'https://redmine.dkd.de/projects/dkdeploy/wiki'
13
+ spec.homepage = 'https://github.com/dkdeploy/dkdeploy-core'
14
+ spec.required_ruby_version = '~> 2.2'
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
17
17
  spec.executables = spec.files.grep(%r{^bin\/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)\/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_development_dependency 'bundler', '~> 1.12.5'
22
- spec.add_development_dependency 'rake', '~> 11.2'
23
- spec.add_development_dependency 'rspec', '~> 3.4'
21
+ spec.add_development_dependency 'bundler'
22
+ spec.add_development_dependency 'rake'
23
+ spec.add_development_dependency 'rspec', '~> 3.5'
24
24
  spec.add_development_dependency 'cucumber', '~> 2.4'
25
- spec.add_development_dependency 'rubocop', '~> 0.40'
25
+ spec.add_development_dependency 'rubocop', '~> 0.50.0'
26
26
  spec.add_development_dependency 'aruba', '~> 0.14.1'
27
27
  spec.add_development_dependency 'mysql2', '~> 0.3'
28
- spec.add_development_dependency 'pry', '~> 0.10.3'
29
- spec.add_development_dependency 'dkdeploy-test_environment', '~> 1.0'
28
+ spec.add_development_dependency 'pry', '~> 0.10'
29
+ spec.add_development_dependency 'dkdeploy-test_environment', '~> 2.0'
30
30
 
31
- spec.add_dependency 'capistrano', '~> 3.5.0'
32
- spec.add_dependency 'sshkit', '= 1.10.0'
31
+ spec.add_dependency 'capistrano', '~> 3.9.0'
33
32
  spec.add_dependency 'highline', '~> 1.7.1'
34
33
  end
@@ -41,60 +41,58 @@ Feature: Test tasks for namespace 'assets'
41
41
  Then the exit status should be 0
42
42
  And a remote file named "shared_path/.htpasswd" should exist
43
43
 
44
- Scenario: Check if cleanup is really cleaning fileadmin and uploads
44
+ Scenario: Check if cleanup is really cleaning downloads
45
45
  Given the remote server is cleared
46
46
  And the project is deployed
47
47
  When I successfully run `cap dev assets:cleanup`
48
- Given a remote empty file named "assets_path/fileadmin/example.png"
49
- Then a remote file named "assets_path/fileadmin/example.png" should exist
48
+ Given a remote empty file named "assets_path/download/example.png"
49
+ Then a remote file named "assets_path/download/example.png" should exist
50
50
  When I successfully run `cap dev assets:cleanup`
51
- Then a remote file named "assets_path/fileadmin/example.png" should not exist
51
+ Then a remote file named "assets_path/download/example.png" should not exist
52
52
 
53
53
  Scenario: Check if download is getting archives from the remote server
54
54
  Given the remote server is cleared
55
55
  And the project is deployed
56
56
  When I successfully run `cap dev assets:cleanup`
57
- Given a remote empty file named "assets_path/fileadmin/example.png"
58
- And a remote empty file named "assets_path/fileadmin/folder/example3.png"
59
- And a remote empty file named "assets_path/uploads/example3.png"
60
- When I run `cap dev assets:download`
61
- Then a file named "temp/assets/uploads.tar.gz" should exist
62
- And a file named "temp/assets/fileadmin.tar.gz" should exist
57
+ And a remote empty file named "assets_path/download/example.png"
58
+ And a remote empty file named "assets_path/download/folder/example3.png"
59
+ And I run `cap dev assets:download`
60
+ Then a file named "temp/assets/download.tar.gz" should exist
63
61
 
64
62
  Scenario: Check if update is filling the remote server from the local archives
65
63
  Given the remote server is cleared
66
64
  And the project is deployed
67
65
  When I successfully run `cap dev assets:cleanup`
68
- Given a remote empty file named "assets_path/fileadmin/file.html"
69
- And a remote empty file named "assets_path/uploads/subdirectory/file2.html"
70
- And a remote empty file named "assets_path/uploads/file3.html"
66
+ Then a remote empty file named "assets_path/download/file.html"
67
+ And a remote empty file named "assets_path/download/subdirectory/file2.html"
68
+ And a remote empty file named "assets_path/download/file3.html"
71
69
  When I successfully run `cap dev assets:download`
72
70
  And I successfully run `cap dev assets:cleanup`
73
- Then a remote file named "assets_path/fileadmin/file.html" should not exist
74
- And a remote file named "assets_path/uploads/subdirectory/file2.html" should not exist
75
- And a remote file named "assets_path/uploads/file3.html" should not exist
71
+ Then a remote file named "assets_path/download/file.html" should not exist
72
+ And a remote file named "assets_path/download/subdirectory/file2.html" should not exist
73
+ And a remote file named "assets_path/download/file3.html" should not exist
76
74
  When I successfully run `cap dev assets:update`
77
- And a remote file named "assets_path/fileadmin/file.html" should exist
78
- And a remote file named "assets_path/uploads/subdirectory/file2.html" should exist
79
- And a remote file named "assets_path/uploads/file3.html" should exist
75
+ And a remote file named "assets_path/download/file.html" should exist
76
+ And a remote file named "assets_path/download/subdirectory/file2.html" should exist
77
+ And a remote file named "assets_path/download/file3.html" should exist
80
78
 
81
79
  Scenario: Check if add_default_content is filling the remote server from the local preseeds
82
80
  Given the remote server is cleared
83
81
  And the project is deployed
84
82
  When I successfully run `cap dev assets:cleanup`
85
83
  And I successfully run `cap dev assets:add_default_content`
86
- Then a remote file named "assets_path/fileadmin/file1.html" should exist
87
- And a remote file named "assets_path/fileadmin/subdirectory/file2.html" should exist
88
- And a remote file named "assets_path/uploads/test.png" should exist
84
+ Then a remote file named "assets_path/download/file1.html" should exist
85
+ And a remote file named "assets_path/download/subdirectory/file2.html" should exist
86
+ And a remote file named "assets_path/download/test.png" should exist
89
87
 
90
88
  Scenario: Check if the exclude file is functioning
91
89
  Given the remote server is cleared
92
90
  And the project is deployed
93
91
  When I successfully run `cap dev assets:cleanup`
94
- Given a remote empty file named "assets_path/fileadmin/should_be_excluded.txt"
95
- Then a remote file named "assets_path/fileadmin/should_be_excluded.txt" should exist
92
+ Given a remote empty file named "assets_path/download/should_be_excluded.txt"
93
+ Then a remote file named "assets_path/download/should_be_excluded.txt" should exist
96
94
  When I successfully run `cap dev assets:download`
97
95
  And I successfully run `cap dev assets:cleanup`
98
- Then a remote file named "assets_path/fileadmin/should_be_excluded.txt" should not exist
96
+ Then a remote file named "assets_path/download/should_be_excluded.txt" should not exist
99
97
  When I successfully run `cap dev assets:update`
100
- Then a remote file named "assets_path/fileadmin/should_be_excluded.txt" should not exist
98
+ Then a remote file named "assets_path/download/should_be_excluded.txt" should not exist
data/features/db.feature CHANGED
@@ -91,3 +91,7 @@ Feature: Test tasks for namespace 'db'
91
91
  And I successfully run `cap dev db:add_default_content`
92
92
  And I wait 5 second to let the database commit the transaction
93
93
  Then the database should have a value `first preseed value` in table `preseed_table` for column `value`
94
+
95
+ Scenario: Check error answer of a broken SQL syntax
96
+ When I run `cap dev "db:sql_error"`
97
+ Then the output should match /ERROR 1064/
@@ -0,0 +1,27 @@
1
+ Feature: Test tasks for namespace 'mysql'
2
+
3
+ Background:
4
+ Given a test app with the default configuration
5
+ And the remote server is cleared
6
+ And I want to use the database `dkdeploy_core`
7
+
8
+ Scenario: Downloading the MYSQL slow log
9
+ When I successfully run `cap dev "db:upload_settings[127.0.0.1,3306,dkdeploy_core,root,ilikerandompasswords,utf8]"`
10
+ And I successfully run `cap dev "db:update[temp,dkdeploy_core.sql.gz]"`
11
+ And I successfully run `cap dev db:download_content`
12
+ And I successfully run `cap dev mysql:download_slow_log`
13
+ Then a file named "temp/slow-queries.dev.dkdeploy-core.dev.log" should exist
14
+
15
+ Scenario: Downloading the MYSQL slow log analyze file
16
+ When I successfully run `cap dev "db:upload_settings[127.0.0.1,3306,dkdeploy_core,root,ilikerandompasswords,utf8]"`
17
+ And I successfully run `cap dev "db:update[temp,dkdeploy_core.sql.gz]"`
18
+ And I successfully run `cap dev db:download_content`
19
+ And I successfully run `cap dev mysql:analyze_download_slow_log`
20
+ Then a file named "temp/mysql_slow_log_analyze.dev.dkdeploy-core.dev.log" should exist
21
+
22
+ Scenario: Clearing the MySQL slow log file
23
+ When I successfully run `cap dev "db:upload_settings[127.0.0.1,3306,dkdeploy_core,root,ilikerandompasswords,utf8]"`
24
+ And I successfully run `cap dev "db:update[temp,dkdeploy_core.sql.gz]"`
25
+ And I successfully run `cap dev db:download_content`
26
+ And I successfully run `cap dev mysql:clear_slow_log`
27
+ Then the output should match /has been cleared/
@@ -18,5 +18,5 @@ TEST_APPLICATION.mysql_connection_settings = { host: 'dkdeploy-core.dev', userna
18
18
  # The official way via Bundler.with_clean_env did not work properly here
19
19
  Aruba.configure do |config|
20
20
  config.command_runtime_environment = { 'BUNDLE_GEMFILE' => File.join(TEST_APPLICATION.test_app_path, 'Gemfile') }
21
- config.exit_timeout = 10
21
+ config.exit_timeout = 30
22
22
  end
@@ -2,6 +2,10 @@ include Capistrano::DSL
2
2
 
3
3
  require 'dkdeploy/rollback_manager'
4
4
 
5
+ # Install copy plugin
6
+ require 'dkdeploy/scm/copy'
7
+ install_plugin Dkdeploy::SCM::Copy
8
+
5
9
  # Load dkdeploy tasks
6
10
  load File.expand_path('../../../dkdeploy/tasks/deploy.rake', __FILE__)
7
11
  load File.expand_path('../../../dkdeploy/tasks/fail.rake', __FILE__)
@@ -15,6 +19,7 @@ load File.expand_path('../../../dkdeploy/tasks/db.rake', __FILE__)
15
19
  load File.expand_path('../../../dkdeploy/tasks/enhanced_symlinks.rake', __FILE__)
16
20
  load File.expand_path('../../../dkdeploy/tasks/current_folder.rake', __FILE__)
17
21
  load File.expand_path('../../../dkdeploy/tasks/bower.rake', __FILE__)
22
+ load File.expand_path('../../../dkdeploy/tasks/mysql.rake', __FILE__)
18
23
 
19
24
  # Hook into symlink related tasks
20
25
  after 'deploy:check:linked_dirs', 'deploy:enhanced_symlinks:check:linked_dirs'
@@ -25,27 +30,8 @@ after 'deploy:symlink:linked_files', 'deploy:enhanced_symlinks:symlink:linked_fi
25
30
 
26
31
  namespace :load do
27
32
  task :defaults do
28
- # Set scm to new scm "copy"
29
- set :scm, :copy
30
-
31
- # Set default values for copy scm
32
- set :copy_source, 'htdocs'
33
- set :copy_exclude, Array[
34
- 'vendor/bundle/**',
35
- 'Gemfile*',
36
- '**/.git',
37
- '**/.svn',
38
- '**/.DS_Store',
39
- '.settings',
40
- '.project',
41
- '.buildpath',
42
- 'Capfile',
43
- 'Thumbs.db',
44
- 'composer.lock'
45
- ]
46
-
47
33
  # Set default web root paths
48
- set :local_web_root_path, -> { fetch(:copy_source) }
34
+ set(:local_web_root_path, -> { fetch(:copy_source) })
49
35
  set :remote_web_root_path, '.'
50
36
 
51
37
  # Set default version file path
@@ -71,8 +57,8 @@ namespace :load do
71
57
  set :keep_rollback_archives, 5
72
58
 
73
59
  # List of bower.json files
74
- set :bower_path, -> { fetch(:copy_source) }
75
- set :bower_paths, -> { Array(fetch(:copy_source)) }
60
+ set(:bower_path, -> { fetch(:copy_source) })
61
+ set(:bower_paths, -> { Array(fetch(:copy_source)) })
76
62
 
77
63
  # List of filters for file_access:set_selected_custom_access
78
64
  set :selected_custom_file_access, []
@@ -84,5 +70,8 @@ namespace :load do
84
70
 
85
71
  # Airbrush configuration
86
72
  set :format_options, command_output: true, log_file: nil, truncate: false
73
+
74
+ # MySQL slow_log
75
+ set :mysql_slow_log, ''
87
76
  end
88
77
  end
@@ -66,32 +66,16 @@ module Dkdeploy
66
66
  #
67
67
  # @return [String]
68
68
  def default_ignore_tables
69
- %w(
70
- cache_extensions cache_hash cache_imagesizes cache_md5params
71
- cache_pages cache_pagesection cache_sys_dmail_stat cache_treelist cache_typo3temp_log
72
- cachingframework_cache_hash cachingframework_cache_hash_tags cachingframework_cache_pages
73
- cachingframework_cache_pages_tags cachingframework_cache_pagesection
74
- cachingframework_cache_pagesection_tags sys_workspace_cache sys_workspace_cache_tags
75
- tt_news_cache tt_news_cache_tags tx_extbase_cache_object tx_extbase_cache_object_tags
76
- tx_extbase_cache_reflection tx_extbase_cache_reflection_tags tx_realurl_chashcache
77
- tx_realurl_pathcache tx_realurl_urldecodecache tx_realurl_urlencodecache be_users be_sessions
78
- sys_domain fe_users fe_sessions fe_session_data
79
- cf_cache_hash cf_cache_hash_tags cf_cache_pages cf_cache_pages_tags cf_cache_pagesection
80
- cf_cache_pagesection_tags cf_cache_rootline cf_cache_rootline_tags cf_extbase_datamapfactory_datamap
81
- cf_extbase_datamapfactory_datamap_tags cf_extbase_object cf_extbase_object_tags
82
- cf_extbase_reflection cf_extbase_reflection_tags cf_extbase_typo3dbbackend_queries
83
- cf_extbase_typo3dbbackend_queries_tags cf_extbase_typo3dbbackend_tablecolumns
84
- cf_extbase_typo3dbbackend_tablecolumns_tags
85
- )
69
+ %w[]
86
70
  end
87
71
 
88
72
  # List of table names to be ignored when dumping from database defined via Capistrano variable or environment variable
89
73
  #
90
- # @return [String]
74
+ # @return [Array]
91
75
  def additional_ignore_tables
92
- env_string_list = ENV.fetch('ADDITIONAL_IGNORE_TABLES', '').split ' '
93
- cap_string_list = fetch(:additional_ignore_tables, '').split ' '
94
- env_string_list | cap_string_list
76
+ env_array_list = ENV.fetch('ADDITIONAL_IGNORE_TABLES', '').split ' '
77
+ cap_array_list = fetch(:additional_ignore_tables, [])
78
+ env_array_list | cap_array_list
95
79
  end
96
80
 
97
81
  # List of table names to be ignored when dumping from database
@@ -100,57 +84,5 @@ module Dkdeploy
100
84
  def ignore_tables
101
85
  default_ignore_tables | additional_ignore_tables
102
86
  end
103
-
104
- #####################################################
105
- # Local temporary directory constants
106
- #####################################################
107
-
108
- # Archive filename as singleton
109
- # Note: if the archive filename doesn't already exist it will be generated
110
- #
111
- # @return [String]
112
- def archive_filename
113
- @archive_filename ||= Dir::Tmpname.make_tmpname [application + '_', '.tar.gz'], nil
114
- end
115
-
116
- # Local temporary directory path as singleton
117
- # Note: if the directory doesn't already exist it will be created
118
- #
119
- # @return [String]
120
- def local_tmp_dir
121
- @local_tmp_dir ||= Dir.mktmpdir
122
- end
123
-
124
- # Archive path in a local temporary directory
125
- #
126
- # @return [String]
127
- def local_exclude_path
128
- File.join local_tmp_dir, 'exclude.txt'
129
- end
130
-
131
- # Archive path in a local temporary directory
132
- #
133
- # @return [String]
134
- def local_archive_path
135
- File.join local_tmp_dir, archive_filename
136
- end
137
-
138
- #####################################################
139
- # remote paths constants
140
- #####################################################
141
-
142
- # Remote temporary directory path
143
- #
144
- # @return [String]
145
- def remote_tmp_dir
146
- File.join fetch(:tmp_dir), application
147
- end
148
-
149
- # Archive path in a remote temporary directory
150
- #
151
- # @return [String]
152
- def remote_archive_path
153
- File.join remote_tmp_dir, archive_filename
154
- end
155
87
  end
156
88
  end
@@ -3,9 +3,9 @@ module Dkdeploy
3
3
  # Class for version number
4
4
  #
5
5
  class Version
6
- MAJOR = 8
6
+ MAJOR = 9
7
7
  MINOR = 0
8
- PATCH = 2
8
+ PATCH = 0
9
9
 
10
10
  def self.to_s
11
11
  [MAJOR, MINOR, PATCH].join('.')
data/lib/dkdeploy/dsl.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Dkdeploy
2
- # TYPO3 dsl api
2
+ # dsl api
3
3
  module DSL
4
4
  # Execute a rake/capistrano task only for given server
5
5
  #
@@ -1,5 +1,4 @@
1
1
  include Capistrano::DSL
2
- include SSHKit::DSL
3
2
 
4
3
  module Dkdeploy
5
4
  module Helpers
@@ -42,7 +42,7 @@ module Dkdeploy
42
42
  return
43
43
  end
44
44
  json_string = context.download! remote_database_config_path
45
- YAML.load(json_string).fetch('database')
45
+ YAML.safe_load(json_string).fetch('database')
46
46
  end
47
47
  end
48
48
  end
@@ -0,0 +1,17 @@
1
+ include Capistrano::DSL
2
+
3
+ module Dkdeploy
4
+ module Helpers
5
+ # Helpers for MySQL slow_log tasks
6
+ module MySQL
7
+ # checks for existence of mysql_sloq_log on server and prints error message if not present
8
+ # @param file_path [String]
9
+ # @return [Boolean]
10
+ def slow_log_exists?(file_path)
11
+ return true if !file_path.empty? && test("[ -f #{file_path} ]")
12
+ error I18n.t('file.not_exists_or_not_accessible_on_host', file: file_path, host: server, scope: :dkdeploy)
13
+ false
14
+ end
15
+ end
16
+ end
17
+ end
data/lib/dkdeploy/i18n.rb CHANGED
@@ -3,9 +3,11 @@ require 'i18n'
3
3
  en = {
4
4
  file: {
5
5
  not_exists: 'File %{file} does not exist.',
6
+ not_exists_or_not_accessible_on_host: 'File %{file} does not exist on host %{host} or is not accessible.',
6
7
  not_exists_on_host: 'File %{file} does not exit on host %{host}.',
7
8
  upload: 'Uploading %{file} to %{target}.',
8
9
  download: 'Downloading %{file} to %{target}.',
10
+ download_from_host: 'Downloading %{file} to %{target} from %{host}.',
9
11
  copy: 'Copying %{file} to %{target}.',
10
12
  remove: 'Removing %{path}.'
11
13
  },
@@ -107,6 +109,10 @@ en = {
107
109
  disabled: 'The %{mode} maintenance mode has successfully been disabled.',
108
110
  can_not_disable_by_reason_of_permanent: "Maintenance permanent mode has been enabled. Please call the task 'maintenance:disable_permanent'."
109
111
  },
112
+ mysql: {
113
+ clear_slow_log: 'MySQL slow log file %{file} on host %{host} has been cleared',
114
+ analyze_slow_log: 'Generating slow log analyze file for host %{host)'
115
+ },
110
116
  project_version: {
111
117
  update: {
112
118
  update: 'Updating the Version file.'