magentify 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/features/deploy.feature +9 -0
- data/features/magentify.feature +14 -0
- data/features/setup.feature +9 -0
- data/features/step_definitions/common_steps.rb +38 -0
- data/features/step_definitions/deploy_steps.rb +10 -0
- data/features/step_definitions/magentify_steps.rb +19 -0
- data/features/step_definitions/setup_steps.rb +9 -0
- data/features/support/env.rb +12 -0
- data/features/templates/deploy.erb +19 -0
- data/lib/mage.rb +1 -0
- data/lib/magentify/version.rb +1 -1
- data/lib/nonrails.rb +124 -0
- data/magentify.gemspec +1 -1
- metadata +25 -6
data/.gitignore
CHANGED
@@ -0,0 +1,9 @@
|
|
1
|
+
Feature: Deployment
|
2
|
+
In order to deploy Magento
|
3
|
+
As a developer
|
4
|
+
I want my release to be uploaded and symlinks to shared resources created
|
5
|
+
|
6
|
+
Scenario: User runs $ cap deploy
|
7
|
+
Given an app
|
8
|
+
When I execute deploy
|
9
|
+
Then the PEOPLE_LIKE_YOU file should be written to shared
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Feature: Magentify
|
2
|
+
In order to deploy Magento with Capistrano
|
3
|
+
As a developer
|
4
|
+
I want my project to be configured to use Magento specific deploy tasks
|
5
|
+
|
6
|
+
Scenario: User runs $ magentify .
|
7
|
+
Given an app
|
8
|
+
When I execute magentify .
|
9
|
+
Then deploy.rb should load mage.rb
|
10
|
+
|
11
|
+
Scenario: User runs $ cap -T
|
12
|
+
Given an app
|
13
|
+
When I execute cap -T
|
14
|
+
Then cap -T should list mage
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Feature: Setup
|
2
|
+
In order to deploy Magento
|
3
|
+
As a developer
|
4
|
+
I want the correct folder structure created on the remote server
|
5
|
+
|
6
|
+
Scenario: User runs $ cap deploy:setup
|
7
|
+
Given an app
|
8
|
+
When I execute deploy:setup
|
9
|
+
Then the shared folder structure should be created
|
@@ -0,0 +1,38 @@
|
|
1
|
+
Given /^an app$/ do
|
2
|
+
# Create the git repo
|
3
|
+
FileUtils.mkdir_p @repo_dir
|
4
|
+
Dir.chdir(@repo_dir) do
|
5
|
+
system "git --bare init > /dev/null 2>&1"
|
6
|
+
end
|
7
|
+
|
8
|
+
# Create and capify the dummy app, and push it to the local repo
|
9
|
+
FileUtils.mkdir_p @app_dir
|
10
|
+
Dir.chdir(@app_dir) do
|
11
|
+
[
|
12
|
+
%Q{git init > /dev/null 2>&1} ,
|
13
|
+
%Q{mkdir config > /dev/null 2>&1},
|
14
|
+
%Q{magentify . > /dev/null 2>&1},
|
15
|
+
%Q{git add . > /dev/null 2>&1},
|
16
|
+
%Q{git commit -m "first commit" > /dev/null 2>&1},
|
17
|
+
%Q{git remote add origin file://#{@repo_dir} > /dev/null 2>&1},
|
18
|
+
%Q{git push origin master > /dev/null 2>&1}
|
19
|
+
].each do |command|
|
20
|
+
system command
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Write a custom deploy file to the app, using an ERB template
|
25
|
+
deploy_variables = {
|
26
|
+
:deploy_to => File.join(@test_files_dir, "deployed"),
|
27
|
+
:repository => @repo_dir,
|
28
|
+
:git_executable => `which git`.strip,
|
29
|
+
:logged_in_user => Etc.getlogin
|
30
|
+
}
|
31
|
+
|
32
|
+
template_path = File.expand_path(File.join(__FILE__, "..", "..", "templates", "deploy.erb"))
|
33
|
+
compiled_template = ERB.new(File.read(template_path)).result(binding)
|
34
|
+
|
35
|
+
File.open(File.join(@app_dir, "config", "deploy.rb"), 'w') {|f|
|
36
|
+
f.write compiled_template
|
37
|
+
}
|
38
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
When /^I execute deploy$/ do
|
2
|
+
Dir.chdir(@app_dir) do
|
3
|
+
system "cap deploy:setup > /dev/null"
|
4
|
+
system "cap deploy > /dev/null"
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
Then /^the PEOPLE_LIKE_YOU file should be written to shared$/ do
|
9
|
+
File.exists?(File.join(@test_files_dir, "deployed", "shared", "PEOPLE_LIKE_YOU")).should be_true
|
10
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
When /^I execute magentify \.$/ do
|
2
|
+
Dir.chdir(@app_dir) do
|
3
|
+
system "magentify . > /dev/null"
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
Then /^deploy\.rb should load mage\.rb$/ do
|
8
|
+
pending # express the regexp above with the code you wish you had
|
9
|
+
end
|
10
|
+
|
11
|
+
When /^I execute cap \-T$/ do
|
12
|
+
Dir.chdir(@app_dir) do
|
13
|
+
system "cap -T > /dev/null"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
Then /^cap \-T should list mage$/ do
|
18
|
+
pending # express the regexp above with the code you wish you had
|
19
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# require 'spec'
|
2
|
+
require 'erb'
|
3
|
+
require 'etc'
|
4
|
+
|
5
|
+
Before do
|
6
|
+
@test_files_dir = File.join(Dir.pwd, "_files")
|
7
|
+
@app_dir = File.join(@test_files_dir, "app")
|
8
|
+
@repo_dir = File.join(@test_files_dir, "repo")
|
9
|
+
|
10
|
+
FileUtils.rm_r(@test_files_dir) if File.exists?(@test_files_dir)
|
11
|
+
FileUtils.mkdir_p(@test_files_dir)
|
12
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
set :application, "magento"
|
2
|
+
set :domain, "#{application}.com"
|
3
|
+
set :deploy_to, "<%= deploy_variables[:deploy_to] %>"
|
4
|
+
|
5
|
+
set :user, "<%= deploy_variables[:logged_in_user] %>"
|
6
|
+
set :repository, "file://<%= deploy_variables[:repository] %>"
|
7
|
+
set :scm, :git
|
8
|
+
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `perforce`, `subversion` or `none`
|
9
|
+
set :scm_command, "<%= deploy_variables[:git_executable] %>"
|
10
|
+
|
11
|
+
role :web, "localhost" # Your HTTP server, Apache/etc
|
12
|
+
role :app, "localhost" # This may be the same as your `Web` server
|
13
|
+
role :db, "localhost", :primary => true # This is where Rails migrations will run
|
14
|
+
|
15
|
+
set :keep_releases, 3
|
16
|
+
|
17
|
+
set :app_symlinks, ["/media", "/var", "/sitemaps", "/staging"]
|
18
|
+
set :app_shared_dirs, ["/app/etc", "/sitemaps", "/media", "/var", "/staging"]
|
19
|
+
set :app_shared_files, ["/app/etc/local.xml"]
|
data/lib/mage.rb
CHANGED
data/lib/magentify/version.rb
CHANGED
data/lib/nonrails.rb
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
# =========================================================================
|
2
|
+
# These are the tasks that are available to help with deploying web apps,
|
3
|
+
# and specifically, NON Rails applications. You can have cap give you a summary
|
4
|
+
# of them with `cap -T'.
|
5
|
+
# =========================================================================
|
6
|
+
|
7
|
+
namespace :deploy do
|
8
|
+
desc <<-DESC
|
9
|
+
[Overload] Deploys your project. This calls `update'. Note that \
|
10
|
+
this will generally only work for applications that have already been deployed \
|
11
|
+
once. For a "cold" deploy, you'll want to take a look at the `deploy:cold' \
|
12
|
+
task, which handles the cold start specifically.
|
13
|
+
DESC
|
14
|
+
task :default do
|
15
|
+
update
|
16
|
+
end
|
17
|
+
|
18
|
+
desc <<-DESC
|
19
|
+
[Overload] Touches up the released code. This is called by update_code \
|
20
|
+
after the basic deploy finishes.
|
21
|
+
|
22
|
+
This method should be overridden to meet the requirements of your allocation.
|
23
|
+
DESC
|
24
|
+
task :finalize_update, :except => { :no_release => true } do
|
25
|
+
#
|
26
|
+
end
|
27
|
+
|
28
|
+
desc <<-DESC
|
29
|
+
[Overload] Default actions cancelled
|
30
|
+
DESC
|
31
|
+
task :restart, :roles => :app, :except => { :no_release => true } do
|
32
|
+
#
|
33
|
+
end
|
34
|
+
|
35
|
+
desc <<-DESC
|
36
|
+
[Overload] Default actions cancelled.
|
37
|
+
DESC
|
38
|
+
task :migrate, :roles => :db, :only => { :primary => true } do
|
39
|
+
#
|
40
|
+
end
|
41
|
+
|
42
|
+
desc <<-DESC
|
43
|
+
[Overload] Default actions cancelled.
|
44
|
+
DESC
|
45
|
+
task :migrations do
|
46
|
+
set :migrate_target, :latest
|
47
|
+
#
|
48
|
+
end
|
49
|
+
|
50
|
+
desc <<-DESC
|
51
|
+
[Overload] Default actions only calls 'update'.
|
52
|
+
DESC
|
53
|
+
task :cold do
|
54
|
+
update
|
55
|
+
end
|
56
|
+
|
57
|
+
desc <<-DESC
|
58
|
+
[Overload] Default actions cancelled.
|
59
|
+
DESC
|
60
|
+
task :start, :roles => :app do
|
61
|
+
#
|
62
|
+
end
|
63
|
+
|
64
|
+
desc <<-DESC
|
65
|
+
[Overload] Default actions cancelled.
|
66
|
+
DESC
|
67
|
+
task :stop, :roles => :app do
|
68
|
+
#
|
69
|
+
end
|
70
|
+
|
71
|
+
namespace :web do
|
72
|
+
desc <<-DESC
|
73
|
+
Present a maintenance page to visitors. Disables your application's web \
|
74
|
+
interface by writing a "maintenance.html" file to each web server. The \
|
75
|
+
servers must be configured to detect the presence of this file, and if \
|
76
|
+
it is present, always display it instead of performing the request.
|
77
|
+
|
78
|
+
By default, the maintenance page will just say the site is down for \
|
79
|
+
"maintenance", and will be back "shortly", but you can customize the \
|
80
|
+
page by specifying the REASON and UNTIL environment variables:
|
81
|
+
|
82
|
+
$ cap deploy:web:disable \\
|
83
|
+
REASON="hardware upgrade" \\
|
84
|
+
UNTIL="12pm Central Time"
|
85
|
+
|
86
|
+
Further customization will require that you write your own task.
|
87
|
+
DESC
|
88
|
+
task :disable, :roles => :web, :except => { :no_release => true } do
|
89
|
+
require 'erb'
|
90
|
+
on_rollback { run "rm #{shared_path}/system/maintenance.html" }
|
91
|
+
|
92
|
+
warn <<-EOHTACCESS
|
93
|
+
|
94
|
+
# Please add something like this to your site's htaccess to redirect users to the maintenance page.
|
95
|
+
# More Info: http://www.shiftcommathree.com/articles/make-your-rails-maintenance-page-respond-with-a-503
|
96
|
+
|
97
|
+
ErrorDocument 503 /system/maintenance.html
|
98
|
+
RewriteEngine On
|
99
|
+
RewriteCond %{REQUEST_URI} !\.(css|gif|jpg|png)$
|
100
|
+
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
|
101
|
+
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
|
102
|
+
RewriteRule ^.*$ - [redirect=503,last]
|
103
|
+
EOHTACCESS
|
104
|
+
|
105
|
+
reason = ENV['REASON']
|
106
|
+
deadline = ENV['UNTIL']
|
107
|
+
|
108
|
+
template = File.read(File.join(File.dirname(__FILE__), "templates", "maintenance.rhtml"))
|
109
|
+
result = ERB.new(template).result(binding)
|
110
|
+
|
111
|
+
put result, "#{shared_path}/system/maintenance.html", :mode => 0644
|
112
|
+
end
|
113
|
+
|
114
|
+
desc <<-DESC
|
115
|
+
Makes the application web-accessible again. Removes the \
|
116
|
+
"maintenance.html" page generated by deploy:web:disable, which (if your \
|
117
|
+
web servers are configured correctly) will make your application \
|
118
|
+
web-accessible again.
|
119
|
+
DESC
|
120
|
+
task :enable, :roles => :web, :except => { :no_release => true } do
|
121
|
+
run "rm #{shared_path}/system/maintenance.html"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
data/magentify.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ["alistair.stead@designdisclosure.com"]
|
7
7
|
gem.description = %q{An extension to Capistrano to deploy Magento. Adding the specific requirements and additional tasks.}
|
8
8
|
gem.summary = %q{Deploying Magento PHP applications with Capistrano.}
|
9
|
-
gem.homepage = ""
|
9
|
+
gem.homepage = "https://github.com/alistairstead/Magentify"
|
10
10
|
|
11
11
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
12
|
gem.files = `git ls-files`.split("\n")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magentify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
16
|
-
requirement: &
|
16
|
+
requirement: &70095624644500 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 2.5.10
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70095624644500
|
25
25
|
description: An extension to Capistrano to deploy Magento. Adding the specific requirements
|
26
26
|
and additional tasks.
|
27
27
|
email:
|
@@ -37,11 +37,21 @@ files:
|
|
37
37
|
- README.md
|
38
38
|
- Rakefile
|
39
39
|
- bin/magentify
|
40
|
+
- features/deploy.feature
|
41
|
+
- features/magentify.feature
|
42
|
+
- features/setup.feature
|
43
|
+
- features/step_definitions/common_steps.rb
|
44
|
+
- features/step_definitions/deploy_steps.rb
|
45
|
+
- features/step_definitions/magentify_steps.rb
|
46
|
+
- features/step_definitions/setup_steps.rb
|
47
|
+
- features/support/env.rb
|
48
|
+
- features/templates/deploy.erb
|
40
49
|
- lib/mage.rb
|
41
50
|
- lib/magentify.rb
|
42
51
|
- lib/magentify/version.rb
|
52
|
+
- lib/nonrails.rb
|
43
53
|
- magentify.gemspec
|
44
|
-
homepage:
|
54
|
+
homepage: https://github.com/alistairstead/Magentify
|
45
55
|
licenses: []
|
46
56
|
post_install_message:
|
47
57
|
rdoc_options: []
|
@@ -65,4 +75,13 @@ rubygems_version: 1.8.15
|
|
65
75
|
signing_key:
|
66
76
|
specification_version: 3
|
67
77
|
summary: Deploying Magento PHP applications with Capistrano.
|
68
|
-
test_files:
|
78
|
+
test_files:
|
79
|
+
- features/deploy.feature
|
80
|
+
- features/magentify.feature
|
81
|
+
- features/setup.feature
|
82
|
+
- features/step_definitions/common_steps.rb
|
83
|
+
- features/step_definitions/deploy_steps.rb
|
84
|
+
- features/step_definitions/magentify_steps.rb
|
85
|
+
- features/step_definitions/setup_steps.rb
|
86
|
+
- features/support/env.rb
|
87
|
+
- features/templates/deploy.erb
|