mina-cakephp 1.0.0
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.
- data/.gitignore +50 -0
- data/Gemfile +3 -0
- data/LICENSE +20 -0
- data/README.md +83 -0
- data/VERSION +1 -0
- data/lib/mina-cakephp.rb +1 -0
- data/lib/mina-cakephp/cakephp.rb +72 -0
- data/lib/mina-cakephp/cakephp/asset_compress.rb +38 -0
- data/lib/mina-cakephp/cakephp/git.rb +17 -0
- data/lib/mina-cakephp/cakephp/migrations.rb +12 -0
- data/lib/mina-cakephp/cakephp/tmp.rb +33 -0
- data/lib/mina-cakephp/helpers.rb +16 -0
- data/mina-cakephp.gemspec +18 -0
- metadata +70 -0
data/.gitignore
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# rcov generated
|
2
|
+
coverage
|
3
|
+
coverage.data
|
4
|
+
|
5
|
+
# rdoc generated
|
6
|
+
rdoc
|
7
|
+
|
8
|
+
# yard generated
|
9
|
+
doc
|
10
|
+
.yardoc
|
11
|
+
|
12
|
+
# bundler
|
13
|
+
.bundle
|
14
|
+
|
15
|
+
# jeweler generated
|
16
|
+
pkg
|
17
|
+
|
18
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
19
|
+
#
|
20
|
+
# * Create a file at ~/.gitignore
|
21
|
+
# * Include files you want ignored
|
22
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
23
|
+
#
|
24
|
+
# After doing this, these files will be ignored in all your git projects,
|
25
|
+
# saving you from having to 'pollute' every project you touch with them
|
26
|
+
#
|
27
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
28
|
+
#
|
29
|
+
# For MacOS:
|
30
|
+
#
|
31
|
+
.DS_Store
|
32
|
+
.AppleDouble
|
33
|
+
|
34
|
+
# For TextMate
|
35
|
+
#*.tmproj
|
36
|
+
#tmtags
|
37
|
+
|
38
|
+
# For emacs:
|
39
|
+
#*~
|
40
|
+
#\#*
|
41
|
+
#.\#*
|
42
|
+
|
43
|
+
# For vim:
|
44
|
+
#*.swp
|
45
|
+
|
46
|
+
# For redcar:
|
47
|
+
#.redcar
|
48
|
+
|
49
|
+
# For rubinius:
|
50
|
+
#*.rbc
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 MobVox Soluções Digitais http://www.mobvox.com.br
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
# mina-cakephp
|
2
|
+
|
3
|
+
mina-cakephp add supports to deploy CakePHP Applications using [Mina](http://nadarei.co/mina).
|
4
|
+
|
5
|
+
## How to use
|
6
|
+
|
7
|
+
Create one file at root directory of app named Minafile. Sample:
|
8
|
+
|
9
|
+
require 'mina/git'
|
10
|
+
require 'mina-cakephp'
|
11
|
+
|
12
|
+
set :domain, 'server.to.deploy.com'
|
13
|
+
set :deploy_to, '/var/www/my-app'
|
14
|
+
set :repository, 'git@mysever:my-app.git'
|
15
|
+
set :user, 'root'
|
16
|
+
|
17
|
+
set :shared_paths, ['Config/database.php', 'tmp'] #CakePHP shared paths used at apps.
|
18
|
+
|
19
|
+
#CakePHP Config
|
20
|
+
set :cake_path, '/var/www/libs/cakephp' #CakePHP core path
|
21
|
+
set :cake_database, { #Connection configuration
|
22
|
+
'datasource' => 'Database/Mysql',
|
23
|
+
'persistent' => false,
|
24
|
+
'host' => 'localhost',
|
25
|
+
'login' => 'user',
|
26
|
+
'password' => 'my-password',
|
27
|
+
'database' => 'my-db',
|
28
|
+
'prefix' => ''
|
29
|
+
}
|
30
|
+
|
31
|
+
#Steps to deploy app
|
32
|
+
|
33
|
+
task :deploy do
|
34
|
+
deploy do
|
35
|
+
invoke :'git:clone' #Clone project from :respository
|
36
|
+
invoke :'deploy:link_shared_paths' #Create symlinks of :shared_paths
|
37
|
+
|
38
|
+
invoke :'cakephp:cake_core_path' #Set CakePHP Core path at webroot/index.php
|
39
|
+
invoke :'cakephp:debug_zero' #Set debug 0 at Config/core.php
|
40
|
+
invoke :'cakephp:tmp:clean_cache' #Clear tmp files
|
41
|
+
|
42
|
+
invoke :'cakephp:asset_compress:setup' #Create folder to receive assets
|
43
|
+
invoke :'cakephp:asset_compress:build' #Run Schema build command line
|
44
|
+
|
45
|
+
to :launch do
|
46
|
+
invoke :'cakephp:migrations:run_all' #Run migrations before launch app
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "Custom setup commands"
|
52
|
+
task :setup do
|
53
|
+
#Clone CakePHP Core into cake_path, you can omit this if you dont need to clone cakephp when
|
54
|
+
#run mina setup
|
55
|
+
#invoke :'cakephp:git:clone'
|
56
|
+
end
|
57
|
+
|
58
|
+
Then run:
|
59
|
+
|
60
|
+
mina setup
|
61
|
+
|
62
|
+
It will prepare server to receive first deploy.
|
63
|
+
|
64
|
+
To deploy your app just run:
|
65
|
+
|
66
|
+
mina deploy
|
67
|
+
|
68
|
+
Done.
|
69
|
+
|
70
|
+
## Contributing to mina-cakephp
|
71
|
+
|
72
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
73
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
74
|
+
* Fork the project.
|
75
|
+
* Start a feature/bugfix branch.
|
76
|
+
* Commit and push until you are happy with your contribution.
|
77
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
78
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
79
|
+
|
80
|
+
## Copyright
|
81
|
+
|
82
|
+
Copyright (c) 2012 MobVox Soluções Digitais http://www.mobvox.com.br
|
83
|
+
See LICENSE for further details.
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
data/lib/mina-cakephp.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "mina-cakephp/cakephp"
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'mina-cakephp/cakephp/tmp'
|
2
|
+
require 'mina-cakephp/cakephp/git'
|
3
|
+
require 'mina-cakephp/cakephp/migrations'
|
4
|
+
require 'mina-cakephp/cakephp/asset_compress'
|
5
|
+
|
6
|
+
namespace :cakephp do
|
7
|
+
desc "Configure CakePHP Core include_path in webroot/index.php file."
|
8
|
+
task :cake_core_path do
|
9
|
+
regex = "((\\/\\/)?\\s*define\\('CAKE_CORE_INCLUDE_PATH',(.*)\\);)"
|
10
|
+
|
11
|
+
queue %{
|
12
|
+
echo "-----> Setting up CakePHP path." && (
|
13
|
+
#{echo_cmd %{sed -ri "/#{regex}/ c define('CAKE_CORE_INCLUDE_PATH', '#{cake_path}/lib');" webroot/index.php }} &&
|
14
|
+
echo "------> Done."
|
15
|
+
) || (
|
16
|
+
echo "! ERROR: Setup CakePHP path failed."
|
17
|
+
echo "! Ensure that the path '#{deploy_to}' is accessible to the SSH user."
|
18
|
+
)
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Configure CakePHP debug to 0."
|
23
|
+
task :debug_zero do
|
24
|
+
regex = "((\\/\\/)?\\s*Configure::write\\('debug',(.*)\\);)"
|
25
|
+
queue %{
|
26
|
+
echo "-----> Setting up CakePHP debug to 0" && (
|
27
|
+
#{echo_cmd %{sed -ri "/#{regex}/ c Configure::write('debug', 0);" Config/core.php }} &&
|
28
|
+
echo "------> Done."
|
29
|
+
) || (
|
30
|
+
echo "! ERROR: Setup CakePHP debug."
|
31
|
+
echo "! Ensure that the path '#{deploy_to}' is accessible to the SSH user."
|
32
|
+
)
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "Configure CakePHP database connection"
|
37
|
+
task :config_database do
|
38
|
+
typesWithQuotes = [TrueClass, FalseClass, Numeric]
|
39
|
+
|
40
|
+
config = cake_database.map{|i,v|
|
41
|
+
if typesWithQuotes.find{ |d| v.is_a? d}
|
42
|
+
"\t\t'#{i}' => #{v}"
|
43
|
+
else
|
44
|
+
"\t\t'#{i}' => '#{v}'"
|
45
|
+
end
|
46
|
+
}.join(", \n")
|
47
|
+
|
48
|
+
content = <<-CONTENT.gsub(/^ {6}/, '')
|
49
|
+
<?php
|
50
|
+
class DATABASE_CONFIG{
|
51
|
+
public \\$default = array(
|
52
|
+
#{config}
|
53
|
+
);
|
54
|
+
}
|
55
|
+
CONTENT
|
56
|
+
|
57
|
+
queue %{
|
58
|
+
echo "-----> Creating CakePHP database config file." && (
|
59
|
+
#{echo_cmd %{mkdir -p #{shared_path}/Config}} &&
|
60
|
+
#{echo_cmd %{echo "#{content}" > #{shared_path}/Config/database.php}} &&
|
61
|
+
echo "-----> Done."
|
62
|
+
) || (
|
63
|
+
echo "ERROR: Problem to create database config file."
|
64
|
+
)
|
65
|
+
}
|
66
|
+
end
|
67
|
+
end
|
68
|
+
# Adaptive tasks to setup CakePHP Application.
|
69
|
+
task :setup do
|
70
|
+
invoke :'cakephp:tmp:create'
|
71
|
+
invoke :'cakephp:config_database'
|
72
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'mina-cakephp/helpers'
|
2
|
+
namespace :cakephp do
|
3
|
+
namespace :asset_compress do
|
4
|
+
extend MinaCakePHP
|
5
|
+
|
6
|
+
set :asset_path, 'assets'
|
7
|
+
|
8
|
+
desc "Create asset directory based on asset_path config."
|
9
|
+
task :setup do
|
10
|
+
queue %{
|
11
|
+
echo "-----> Setup assets directory."
|
12
|
+
#{echo_cmd %{mkdir -p webroot/#{asset_path}}} &&
|
13
|
+
#{echo_cmd %{chmod -R 755 webroot/#{asset_path}}} &&
|
14
|
+
echo "-----> Done."
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "Clears all builds defined in the ini file."
|
19
|
+
task :clear do
|
20
|
+
cake_cmd "AssetCompress.AssetCompress clear"
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Generate all builds defined in the ini and view files."
|
24
|
+
task :build do
|
25
|
+
cake_cmd "AssetCompress.AssetCompress build"
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "Generate only build files defined in the ini file."
|
29
|
+
task :build_ini do
|
30
|
+
cake_cmd "AssetCompress.AssetCompress build_ini"
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "Build build files defined in view files."
|
34
|
+
task :build_dynamic do
|
35
|
+
cake_cmd "AssetCompress.AssetCompress build_dynamic"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
namespace :cakephp do
|
2
|
+
namespace :git do
|
3
|
+
|
4
|
+
set :cake_revision, 'master'
|
5
|
+
set :cake_repository, 'git://github.com/cakephp/cakephp.git'
|
6
|
+
|
7
|
+
desc "Clone CakePHP Core into cake_path."
|
8
|
+
task :clone do
|
9
|
+
queue %{
|
10
|
+
echo "-----> Cloning CakePHP Core."
|
11
|
+
#{echo_cmd %{git clone #{cake_repository} #{cake_path} -b #{cake_revision} --depth 1}} &&
|
12
|
+
#{echo_cmd %{rm -Rf #{cake_path}/.git}} &&
|
13
|
+
echo "-----> Done."
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
namespace :cakephp do
|
2
|
+
namespace :tmp do
|
3
|
+
|
4
|
+
set :cake_tmp_dirs, ['cache','cache/models','cache/persistent','cache/views','sessions','logs','tests']
|
5
|
+
|
6
|
+
desc "Setup CakePHP tmp directories."
|
7
|
+
task :create do
|
8
|
+
cmds = cake_tmp_dirs.map do |d|
|
9
|
+
echo_cmd %{mkdir -p #{shared_path}/tmp/#{d}}
|
10
|
+
end
|
11
|
+
|
12
|
+
queue %{
|
13
|
+
echo "-----> Setting up CakePHP tmp directories"
|
14
|
+
#{cmds.flatten.join("\n")}
|
15
|
+
#{echo_cmd %{chmod -R 777 #{shared_path}/tmp}}
|
16
|
+
echo "-----> Done CakePHP"
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "Clean caches files"
|
21
|
+
task :clean_cache do
|
22
|
+
cmds = cake_tmp_dirs.map do |d|
|
23
|
+
echo_cmd %{rm -f #{shared_path}/tmp/#{d}/*} if d =~ /cache/
|
24
|
+
end
|
25
|
+
|
26
|
+
queue %{
|
27
|
+
echo "-----> Cleaning CakePHP cache directories"
|
28
|
+
#{cmds.flatten.join("\n")}
|
29
|
+
echo "-----> Done."
|
30
|
+
}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module MinaCakePHP
|
2
|
+
|
3
|
+
def cake_cmd (cmd)
|
4
|
+
real_cmd = "yes | " + cake_console_path + " #{cmd}"
|
5
|
+
|
6
|
+
queue %{
|
7
|
+
echo "-----> Running CakePHP script 'cake #{cmd}'"
|
8
|
+
#{echo_cmd real_cmd} &&
|
9
|
+
echo "-----> Done."
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
def cake_console_path
|
14
|
+
cake_path + "/lib/Cake/Console/cake"
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "mina-cakephp"
|
5
|
+
s.version = File.read('VERSION')
|
6
|
+
s.authors = ["Daniel Pakuschewski"]
|
7
|
+
s.email = ["contato@danielpk.com.br"]
|
8
|
+
s.homepage = "http://github.com/mobvox/mina-cakephp"
|
9
|
+
s.summary = "Tools to deploy CakePHP apps with mina."
|
10
|
+
s.description = "Tools to deploy CakePHP apps with mina."
|
11
|
+
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
15
|
+
s.require_paths = ["lib"]
|
16
|
+
|
17
|
+
s.add_runtime_dependency "mina"
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mina-cakephp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Daniel Pakuschewski
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-09-21 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: mina
|
16
|
+
requirement: &22831000 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *22831000
|
25
|
+
description: Tools to deploy CakePHP apps with mina.
|
26
|
+
email:
|
27
|
+
- contato@danielpk.com.br
|
28
|
+
executables: []
|
29
|
+
extensions: []
|
30
|
+
extra_rdoc_files: []
|
31
|
+
files:
|
32
|
+
- .gitignore
|
33
|
+
- Gemfile
|
34
|
+
- LICENSE
|
35
|
+
- README.md
|
36
|
+
- VERSION
|
37
|
+
- lib/mina-cakephp.rb
|
38
|
+
- lib/mina-cakephp/cakephp.rb
|
39
|
+
- lib/mina-cakephp/cakephp/asset_compress.rb
|
40
|
+
- lib/mina-cakephp/cakephp/git.rb
|
41
|
+
- lib/mina-cakephp/cakephp/migrations.rb
|
42
|
+
- lib/mina-cakephp/cakephp/tmp.rb
|
43
|
+
- lib/mina-cakephp/helpers.rb
|
44
|
+
- mina-cakephp.gemspec
|
45
|
+
homepage: http://github.com/mobvox/mina-cakephp
|
46
|
+
licenses: []
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
requirements: []
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 1.8.10
|
66
|
+
signing_key:
|
67
|
+
specification_version: 3
|
68
|
+
summary: Tools to deploy CakePHP apps with mina.
|
69
|
+
test_files: []
|
70
|
+
has_rdoc:
|