magentify 0.0.2 → 0.0.3
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/bin/magentify +1 -1
- data/features/deploy.feature +6 -1
- data/features/magentify.feature +2 -2
- data/features/step_definitions/deploy_steps.rb +28 -4
- data/features/step_definitions/magentify_steps.rb +9 -6
- data/features/step_definitions/setup_steps.rb +1 -1
- data/features/templates/deploy-fail.erb +18 -0
- data/features/templates/deploy.erb +3 -0
- data/lib/mage.rb +13 -5
- data/lib/magentify/version.rb +1 -1
- data/lib/nonrails.rb +4 -18
- data/magentify.gemspec +1 -0
- metadata +7 -4
data/bin/magentify
CHANGED
@@ -21,7 +21,7 @@ OptionParser.new do |opts|
|
|
21
21
|
end
|
22
22
|
|
23
23
|
if ARGV.empty?
|
24
|
-
abort "Please specify the directory to
|
24
|
+
abort "Please specify the directory to magentify, e.g. `#{File.basename($0)} .'"
|
25
25
|
elsif !File.exists?(ARGV.first)
|
26
26
|
abort "`#{ARGV.first}' does not exist."
|
27
27
|
elsif !File.directory?(ARGV.first)
|
data/features/deploy.feature
CHANGED
@@ -6,4 +6,9 @@ Feature: Deployment
|
|
6
6
|
Scenario: User runs $ cap deploy
|
7
7
|
Given an app
|
8
8
|
When I execute deploy
|
9
|
-
Then the
|
9
|
+
Then the local.xml file should be written to shared
|
10
|
+
|
11
|
+
Scenario: User runs $ cap deploy with missing config
|
12
|
+
Given an app
|
13
|
+
When I have deploy.rb with missing config
|
14
|
+
Then [error] should be returned
|
data/features/magentify.feature
CHANGED
@@ -6,9 +6,9 @@ Feature: Magentify
|
|
6
6
|
Scenario: User runs $ magentify .
|
7
7
|
Given an app
|
8
8
|
When I execute magentify .
|
9
|
-
Then
|
9
|
+
Then Capfile should load mage.rb
|
10
10
|
|
11
11
|
Scenario: User runs $ cap -T
|
12
12
|
Given an app
|
13
13
|
When I execute cap -T
|
14
|
-
Then
|
14
|
+
Then mage tasks should be listed
|
@@ -1,10 +1,34 @@
|
|
1
1
|
When /^I execute deploy$/ do
|
2
2
|
Dir.chdir(@app_dir) do
|
3
|
-
system "cap deploy:setup > /dev/null"
|
4
|
-
system "cap deploy > /dev/null"
|
3
|
+
system "cap deploy:setup > /dev/null 2>&1"
|
4
|
+
system "cap deploy > /dev/null 2>&1"
|
5
5
|
end
|
6
6
|
end
|
7
7
|
|
8
|
-
Then /^the
|
9
|
-
File.exists?(File.join(@test_files_dir, "deployed", "shared", "
|
8
|
+
Then /^the local\.xml file should be written to shared$/ do
|
9
|
+
File.exists?(File.join(@test_files_dir, "deployed", "shared", "app", "etc", "local.xml")).should be_true
|
10
|
+
end
|
11
|
+
|
12
|
+
When /^I have deploy\.rb with missing config$/ do
|
13
|
+
# Write a custom deploy file to the app, using an ERB template
|
14
|
+
deploy_variables = {
|
15
|
+
:deploy_to => File.join(@test_files_dir, "deployed"),
|
16
|
+
:repository => @repo_dir,
|
17
|
+
:git_executable => `which git`.strip,
|
18
|
+
:logged_in_user => Etc.getlogin
|
19
|
+
}
|
20
|
+
|
21
|
+
template_path = File.expand_path(File.join(__FILE__, "..", "..", "templates", "deploy-fail.erb"))
|
22
|
+
compiled_template = ERB.new(File.read(template_path)).result(binding)
|
23
|
+
|
24
|
+
File.open(File.join(@app_dir, "config", "deploy.rb"), 'w') {|f|
|
25
|
+
f.write compiled_template
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
Then /^\[error\] should be returned$/ do
|
30
|
+
Dir.chdir(@app_dir) do
|
31
|
+
result = %x[cap -T]
|
32
|
+
result.match('error').should be_true
|
33
|
+
end
|
10
34
|
end
|
@@ -1,19 +1,22 @@
|
|
1
1
|
When /^I execute magentify \.$/ do
|
2
2
|
Dir.chdir(@app_dir) do
|
3
|
-
system "magentify . > /dev/null"
|
3
|
+
system "magentify . > /dev/null 2>&1"
|
4
4
|
end
|
5
5
|
end
|
6
6
|
|
7
|
-
Then /^
|
8
|
-
|
7
|
+
Then /^Capfile should load mage\.rb$/ do
|
8
|
+
File.open(File.join(@app_dir, "Capfile"), 'rb').read().match('mage\.rb').should be_true
|
9
9
|
end
|
10
10
|
|
11
11
|
When /^I execute cap \-T$/ do
|
12
12
|
Dir.chdir(@app_dir) do
|
13
|
-
system "cap -T > /dev/null"
|
13
|
+
system "cap -T > /dev/null 2>&1"
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
Then /^
|
18
|
-
|
17
|
+
Then /^mage tasks should be listed$/ do
|
18
|
+
Dir.chdir(@app_dir) do
|
19
|
+
result = %x[cap -T]
|
20
|
+
result.match('Clear the Magento Cache').should be_true
|
21
|
+
end
|
19
22
|
end
|
@@ -0,0 +1,18 @@
|
|
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
|
+
# Turn of use of sudo as your local machine does not need it.
|
18
|
+
set :use_sudo, false
|
@@ -14,6 +14,9 @@ role :db, "localhost", :primary => true # This is where Rails migr
|
|
14
14
|
|
15
15
|
set :keep_releases, 3
|
16
16
|
|
17
|
+
# Turn of use of sudo as your local machine does not need it.
|
18
|
+
set :use_sudo, false
|
19
|
+
|
17
20
|
set :app_symlinks, ["/media", "/var", "/sitemaps", "/staging"]
|
18
21
|
set :app_shared_dirs, ["/app/etc", "/sitemaps", "/media", "/var", "/staging"]
|
19
22
|
set :app_shared_files, ["/app/etc/local.xml"]
|
data/lib/mage.rb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
load Gem.find_files('nonrails.rb').last.to_s
|
2
|
-
|
3
|
-
|
4
|
-
set
|
2
|
+
|
3
|
+
# =========================================================================
|
4
|
+
# These variables MUST be set in the client capfiles. If they are not set,
|
5
|
+
# the deploy will fail with an error.
|
6
|
+
# =========================================================================
|
7
|
+
|
8
|
+
_cset(:app_symlinks) {
|
9
|
+
abort "[error] Please specify an array of symlinks to shared resources, set :app_symlinks, ['/media', .. '/staging']"
|
10
|
+
}
|
11
|
+
_cset(:app_shared_dirs) { abort "[error] Please specify, set :app_shared_dirs" }
|
12
|
+
_cset(:app_shared_files) { abort "[error] Please specify, set :app_shared_files" }
|
5
13
|
|
6
14
|
namespace :mage do
|
7
15
|
desc <<-DESC
|
@@ -18,10 +26,10 @@ namespace :mage do
|
|
18
26
|
DESC
|
19
27
|
task :setup, :roles => :web, :except => { :no_release => true } do
|
20
28
|
if app_shared_dirs
|
21
|
-
app_shared_dirs.each { |link| run "#{try_sudo} mkdir -p #{shared_path}#{link} && chmod
|
29
|
+
app_shared_dirs.each { |link| run "#{try_sudo} mkdir -p #{shared_path}#{link} && chmod g+w #{shared_path}#{link}"}
|
22
30
|
end
|
23
31
|
if app_shared_files
|
24
|
-
app_shared_files.each { |link| run "#{try_sudo} touch #{shared_path}#{link} && chmod
|
32
|
+
app_shared_files.each { |link| run "#{try_sudo} touch #{shared_path}#{link} && chmod g+w #{shared_path}#{link}" }
|
25
33
|
end
|
26
34
|
end
|
27
35
|
|
data/lib/magentify/version.rb
CHANGED
data/lib/nonrails.rb
CHANGED
@@ -22,21 +22,21 @@ namespace :deploy do
|
|
22
22
|
This method should be overridden to meet the requirements of your allocation.
|
23
23
|
DESC
|
24
24
|
task :finalize_update, :except => { :no_release => true } do
|
25
|
-
#
|
25
|
+
# do nothing for non rails apps
|
26
26
|
end
|
27
27
|
|
28
28
|
desc <<-DESC
|
29
29
|
[Overload] Default actions cancelled
|
30
30
|
DESC
|
31
31
|
task :restart, :roles => :app, :except => { :no_release => true } do
|
32
|
-
#
|
32
|
+
# do nothing for non rails apps
|
33
33
|
end
|
34
34
|
|
35
35
|
desc <<-DESC
|
36
36
|
[Overload] Default actions cancelled.
|
37
37
|
DESC
|
38
38
|
task :migrate, :roles => :db, :only => { :primary => true } do
|
39
|
-
#
|
39
|
+
# do nothing for non rails apps
|
40
40
|
end
|
41
41
|
|
42
42
|
desc <<-DESC
|
@@ -44,7 +44,7 @@ namespace :deploy do
|
|
44
44
|
DESC
|
45
45
|
task :migrations do
|
46
46
|
set :migrate_target, :latest
|
47
|
-
#
|
47
|
+
# // do nothing for non rails apps
|
48
48
|
end
|
49
49
|
|
50
50
|
desc <<-DESC
|
@@ -54,20 +54,6 @@ namespace :deploy do
|
|
54
54
|
update
|
55
55
|
end
|
56
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
57
|
namespace :web do
|
72
58
|
desc <<-DESC
|
73
59
|
Present a maintenance page to visitors. Disables your application's web \
|
data/magentify.gemspec
CHANGED
@@ -7,6 +7,7 @@ Gem::Specification.new do |gem|
|
|
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
9
|
gem.homepage = "https://github.com/alistairstead/Magentify"
|
10
|
+
gem.license = 'MIT'
|
10
11
|
|
11
12
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
13
|
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.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ 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: &70214939636340 !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: *70214939636340
|
25
25
|
description: An extension to Capistrano to deploy Magento. Adding the specific requirements
|
26
26
|
and additional tasks.
|
27
27
|
email:
|
@@ -45,6 +45,7 @@ files:
|
|
45
45
|
- features/step_definitions/magentify_steps.rb
|
46
46
|
- features/step_definitions/setup_steps.rb
|
47
47
|
- features/support/env.rb
|
48
|
+
- features/templates/deploy-fail.erb
|
48
49
|
- features/templates/deploy.erb
|
49
50
|
- lib/mage.rb
|
50
51
|
- lib/magentify.rb
|
@@ -52,7 +53,8 @@ files:
|
|
52
53
|
- lib/nonrails.rb
|
53
54
|
- magentify.gemspec
|
54
55
|
homepage: https://github.com/alistairstead/Magentify
|
55
|
-
licenses:
|
56
|
+
licenses:
|
57
|
+
- MIT
|
56
58
|
post_install_message:
|
57
59
|
rdoc_options: []
|
58
60
|
require_paths:
|
@@ -84,4 +86,5 @@ test_files:
|
|
84
86
|
- features/step_definitions/magentify_steps.rb
|
85
87
|
- features/step_definitions/setup_steps.rb
|
86
88
|
- features/support/env.rb
|
89
|
+
- features/templates/deploy-fail.erb
|
87
90
|
- features/templates/deploy.erb
|