capistrano-typo3-cms-base 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 58719010c7f2a57209a81cf70b0362fd23f9c77c
4
+ data.tar.gz: 61a1f1a488dd6c4af9e554fe10e1b907b9b36d1a
5
+ SHA512:
6
+ metadata.gz: b46f94d1d8c66ff96789599980546da2eb7da3cf2ab46b675cb40f1cf7af7ef715a005b0babd1b8820c980e0112fae9e35afcd5ccdfa9485746369d06661dce3
7
+ data.tar.gz: a620589365c5c0e1307948510b59ca22b10ecbe84d2fe0ce29d7f5474c19a6ee31f574ea8b2bf1c813f5de87da3212827d5c7b0c770247e31215dfe9b63ca5d4
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-typo3-cms-base.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Jose Antonio Guerra
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # Capistrano::Typo3::Cms::Base
2
+
3
+ Deploy TYPO3 CMS projects with Capistrano 3
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'capistrano-typo3-cms-base'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install capistrano-typo3-cms-base
20
+
21
+ ## Usage
22
+
23
+ Require the module in your `Capfile`:
24
+
25
+ ```ruby
26
+ require 'capistrano/typo3/cms/base'
27
+
28
+ # Uncomment the following line if you have installed EXT:typo3-console and EXT:coreapi into TYPO3
29
+ # and you want to activate automatic cache clearing and DB schema update on deploy.
30
+ #require 'capistrano/typo3/cms/base/deploy'
31
+ ```
32
+
33
+
34
+ ### Configuration
35
+
36
+ The gem makes the following configuration variables available (shown with defaults)
37
+
38
+ ```ruby
39
+ set :typo3_cms_environment, "Production"
40
+ set :typo3_cms_basedir, false
41
+ set :typo3_cms_roles, :all
42
+ set :typo3_cms_configuration_file, -> { Capistrano::Typo3::Cms::Base.basedir_prepend('typo3conf/AdditionalConfiguration.php') }
43
+ set :typo3_cms_linked_files, []
44
+ set :typo3_cms_linked_dirs, %w{fileadmin uploads typo3conf/l10n}
45
+ set :typo3_cms_symlink_core, false
46
+ ```
47
+
48
+ ## Contributing
49
+
50
+ 1. Fork it ( https://github.com/jaguerra/capistrano-typo3-cms-base/fork )
51
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
52
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
53
+ 4. Push to the branch (`git push origin my-new-feature`)
54
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capistrano/typo3/cms/base/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "capistrano-typo3-cms-base"
8
+ spec.version = Capistrano::Typo3::Cms::Base::VERSION
9
+ spec.authors = ["Jose Antonio Guerra"]
10
+ spec.email = ["balderiano@gmail.com"]
11
+ spec.summary = %q{Deploy TYPO3 CMS projects with Capistrano 3}
12
+ spec.description = %q{Lean approach for deploying TYPO3 projects}
13
+ spec.homepage = "https://github.com/jaguerra/capistrano-typo3-cms-base"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_runtime_dependency "capistrano", "~> 3.2"
24
+ end
@@ -0,0 +1,40 @@
1
+ require "capistrano/typo3/cms/base/version"
2
+ require "capistrano/typo3/cms/base/typo3console"
3
+ #require "capistrano/typo3/cms/base/deploy"
4
+ require "capistrano/typo3/cms/base/install_tool"
5
+ require "capistrano/typo3/cms/base/configuration"
6
+ require "capistrano/typo3/cms/base/typo3core"
7
+ require "securerandom"
8
+ require "digest"
9
+
10
+ namespace :load do
11
+ task :defaults do
12
+ load 'capistrano/typo3/cms/base/defaults.rb'
13
+ end
14
+ end
15
+
16
+ module Capistrano
17
+ module Typo3
18
+ module Cms
19
+ module Base
20
+
21
+ def self.basedir_prepend(path)
22
+ if fetch(:typo3_cms_basedir) then
23
+ File.join( fetch(:typo3_cms_basedir), path)
24
+ else
25
+ path
26
+ end
27
+ end
28
+
29
+ def self.basedir_append(path)
30
+ if fetch(:typo3_cms_basedir) then
31
+ File.join( path, fetch(:typo3_cms_basedir))
32
+ else
33
+ path
34
+ end
35
+ end
36
+
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1 @@
1
+ load File.expand_path("../tasks/configuration.rake", __FILE__)
@@ -0,0 +1,19 @@
1
+ set :typo3_cms_environment, fetch(:typo3_cms_environment, "Production")
2
+ set :typo3_cms_basedir, fetch(:typo3_cms_basedir, false)
3
+ set :typo3_cms_roles, fetch(:typo3_cms_roles, :all)
4
+ set :typo3_cms_configuration_file, -> { Capistrano::Typo3::Cms::Base.basedir_prepend('typo3conf/AdditionalConfiguration.php') }
5
+ set :typo3_cms_linked_files, []
6
+ set :typo3_cms_linked_dirs, %w{fileadmin uploads typo3conf/l10n}
7
+ set :typo3_cms_symlink_core, fetch(:typo3_cms_symlink_core, false)
8
+
9
+ set :linked_files, -> { fetch(:typo3_cms_linked_files, []).push(fetch(:typo3_cms_configuration_file)) }
10
+
11
+ set :linked_dirs, -> {
12
+ linked_dirs = []
13
+ fetch(:typo3_cms_linked_dirs).each do |dir|
14
+ linked_dirs.push( Capistrano::Typo3::Cms::Base.basedir_prepend dir )
15
+ end
16
+ linked_dirs
17
+ }
18
+
19
+ set :composer_working_dir, -> { Capistrano::Typo3::Cms::Base.basedir_append fetch(:release_path) }
@@ -0,0 +1 @@
1
+ load File.expand_path("../tasks/deploy.rake", __FILE__)
@@ -0,0 +1 @@
1
+ load File.expand_path("../tasks/install_tool.rake", __FILE__)
@@ -0,0 +1,32 @@
1
+ namespace :typo3cms do
2
+ desc "Generate a basic configuration file"
3
+ task :generate_config do
4
+ set :typo3_cms_database_name, ask('Enter the database name:', '')
5
+ set :typo3_cms_database_username, ask('Enter the database username:', '')
6
+ set :typo3_cms_database_password, ask('Enter the database password:', '', echo: false)
7
+ set :typo3_cms_database_host, ask('Enter the database host:', 'localhost')
8
+ set :typo3_cms_database_port, ask('Enter the database port:', '3306')
9
+
10
+ set :typo3_cms_install_password, ask('Enter the install tool password:', '', echo: false)
11
+
12
+ template = <<-EOF
13
+ <?php
14
+ $GLOBALS['TYPO3_CONF_VARS']['DB']['database'] = '<%= fetch(:typo3_cms_database_name) %>';
15
+ $GLOBALS['TYPO3_CONF_VARS']['DB']['username'] = '<%= fetch(:typo3_cms_database_username) %>';
16
+ $GLOBALS['TYPO3_CONF_VARS']['DB']['password'] = '<%= fetch(:typo3_cms_database_password) %>';
17
+ $GLOBALS['TYPO3_CONF_VARS']['DB']['host'] = '<%= fetch(:typo3_cms_database_host) %>';
18
+ $GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword'] = '<%= Digest::MD5.hexdigest(fetch(:typo3_cms_install_password)) %>';
19
+ $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = '<%= SecureRandom.hex 48 %>';
20
+ <%= fetch(:typo3_cms_configuration_additional, '') %>
21
+ ?>
22
+ EOF
23
+
24
+ config = ERB.new(template)
25
+ io = StringIO.new(config.result(binding))
26
+
27
+ on release_roles(fetch(:typo3_cms_roles)) do
28
+ invoke "deploy:check:make_linked_dirs"
29
+ upload! io, File.join(shared_path, fetch(:typo3_cms_configuration_file))
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,13 @@
1
+ namespace :deploy do
2
+
3
+ desc 'Clear caches'
4
+ after :published, :clear_cache do
5
+ invoke "typo3cms:typo3console:clear_cache"
6
+ end
7
+
8
+ desc 'Compare and update DB schema'
9
+ after :symlink_typo3core, :update_db_schema do
10
+ invoke "typo3cms:typo3console:update_db_schema"
11
+ end
12
+
13
+ end
@@ -0,0 +1,17 @@
1
+ namespace :typo3cms do
2
+
3
+ desc 'Enable install tool'
4
+ task :enable_install_tool do
5
+ on roles(:app) do
6
+ execute :touch, release_path.join(Capistrano::Typo3::Cms::Base.basedir_prepend 'typo3conf/ENABLE_INSTALL_TOOL')
7
+ end
8
+ end
9
+
10
+ desc 'Disable install tool'
11
+ task :disable_install_tool do
12
+ on roles(:app) do
13
+ execute :rm, release_path.join(Capistrano::Typo3::Cms::Base.basedir_prepend 'typo3conf/ENABLE_INSTALL_TOOL')
14
+ end
15
+ end
16
+
17
+ end
@@ -0,0 +1,47 @@
1
+ SSHKit.config.command_map.prefix[:typo3cms].unshift('php')
2
+
3
+ namespace :typo3cms do
4
+
5
+ namespace :typo3console do
6
+
7
+ desc "Execute a provided typo3console command"
8
+ task :execute, :command_name do |t, args|
9
+ # ask only runs if argument is not provided
10
+ ask(:cmd, "help")
11
+ command = args[:command_name] || fetch(:cmd)
12
+
13
+ on release_roles(fetch(:typo3_cms_roles)), in: :sequence do
14
+ within Capistrano::Typo3::Cms::Base.basedir_append(release_path) do
15
+ with typo3_context: fetch(:typo3_cms_environment) do
16
+ execute :typo3cms, command, *args.extras
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ desc 'Clear caches'
23
+ task :clear_cache do
24
+ on release_roles(fetch(:typo3_cms_roles)), in: :sequence do
25
+ within Capistrano::Typo3::Cms::Base.basedir_append(release_path) do
26
+ with typo3_context: fetch(:typo3_cms_environment) do
27
+ execute :typo3cms, 'cache:flush'
28
+ execute :typo3cms, 'cache:warmup'
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ desc 'Compare and update DB schema'
35
+ task :update_db_schema do
36
+ on release_roles(fetch(:typo3_cms_roles)), in: :sequence do
37
+ within Capistrano::Typo3::Cms::Base.basedir_append(release_path) do
38
+ with typo3_context: fetch(:typo3_cms_environment) do
39
+ execute :typo3cms, 'databaseapi:databasecompare', '2,3,4'
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ end
46
+
47
+ end
@@ -0,0 +1,26 @@
1
+ namespace :typo3cms do
2
+
3
+ task :symlink_core do
4
+ if fetch(:typo3_cms_symlink_core, false)
5
+ on release_roles :all do
6
+ unless test("[ -e #{fetch(:typo3_cms_symlink_core)} ]")
7
+ error ":typo3cms_symlink_core does not exist or it is not readable on host #{host}. Aborting..."
8
+ exit 1
9
+ end
10
+ within Capistrano::Typo3::Cms::Base.basedir_append(release_path) do
11
+ execute :rm, '-Rf', 'typo3_src'
12
+ execute :ln, '-s', fetch(:typo3_cms_symlink_core), 'typo3_src'
13
+ end
14
+ end
15
+ end
16
+ end
17
+
18
+ end
19
+
20
+ namespace :deploy do
21
+
22
+ after :updated, :symlink_typo3core do
23
+ invoke "typo3cms:symlink_core"
24
+ end
25
+
26
+ end
@@ -0,0 +1 @@
1
+ load File.expand_path("../tasks/typo3console.rake", __FILE__)
@@ -0,0 +1 @@
1
+ load File.expand_path("../tasks/typo3core.rake", __FILE__)
@@ -0,0 +1,9 @@
1
+ module Capistrano
2
+ module Typo3
3
+ module Cms
4
+ module Base
5
+ VERSION = "0.0.1"
6
+ end
7
+ end
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-typo3-cms-base
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jose Antonio Guerra
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: capistrano
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '3.2'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '3.2'
55
+ description: Lean approach for deploying TYPO3 projects
56
+ email:
57
+ - balderiano@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - capistrano-typo3-cms-base.gemspec
68
+ - lib/capistrano/typo3/cms/base.rb
69
+ - lib/capistrano/typo3/cms/base/configuration.rb
70
+ - lib/capistrano/typo3/cms/base/defaults.rb
71
+ - lib/capistrano/typo3/cms/base/deploy.rb
72
+ - lib/capistrano/typo3/cms/base/install_tool.rb
73
+ - lib/capistrano/typo3/cms/base/tasks/configuration.rake
74
+ - lib/capistrano/typo3/cms/base/tasks/deploy.rake
75
+ - lib/capistrano/typo3/cms/base/tasks/install_tool.rake
76
+ - lib/capistrano/typo3/cms/base/tasks/typo3console.rake
77
+ - lib/capistrano/typo3/cms/base/tasks/typo3core.rake
78
+ - lib/capistrano/typo3/cms/base/typo3console.rb
79
+ - lib/capistrano/typo3/cms/base/typo3core.rb
80
+ - lib/capistrano/typo3/cms/base/version.rb
81
+ homepage: https://github.com/jaguerra/capistrano-typo3-cms-base
82
+ licenses:
83
+ - MIT
84
+ metadata: {}
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 2.0.14
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: Deploy TYPO3 CMS projects with Capistrano 3
105
+ test_files: []