hem-tasks-magento1 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/hem/tasks/magento1/cache.rb +9 -0
- data/lib/hem/tasks/magento1/config.rb +46 -0
- data/lib/hem/tasks/magento1/patches.rb +197 -0
- data/lib/hem/tasks/magento1/setup-scripts.rb +10 -0
- data/lib/hem/tasks/magento1/tools.rb +8 -0
- data/lib/hem/tasks/magento1/version.rb +1 -1
- data/lib/hem/tasks/magento1.rb +6 -268
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 983a35e22a9786b5df843d355803ab0a3a94b34e
|
4
|
+
data.tar.gz: 6761b4921a38d1ababb99c947d6cfd1f9ed45adc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ea3bc12b35882a36f6b68320ec0801a8e581a7a029edd0db025f48298964e08f3937b66342814a1bd09d7fc710fbb7780047135dc183673985bbf5d1a9d3285
|
7
|
+
data.tar.gz: a4df1670b5b24a3b3dc75d25714cbdd6f26a8360f62efd1e40f65f41967ce3a5dea67148b98e0d84c8d187ee9d2675ee179966afee55762f0d54ef53a3c6e73b
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Hem::Tasks::Magento1
|
2
2
|
|
3
|
-
Contains tasks for [Hem](https://github.com/inviqa
|
3
|
+
Contains tasks for [Hem](https://github.com/inviqa/hem) to provide functionality
|
4
4
|
for Magento 1.* projects
|
5
5
|
|
6
6
|
## Installation
|
@@ -8,7 +8,7 @@ for Magento 1.* projects
|
|
8
8
|
Add this line to your application's Hemfile:
|
9
9
|
|
10
10
|
```ruby
|
11
|
-
plugins
|
11
|
+
plugins do
|
12
12
|
gem 'hem-tasks-magento1'
|
13
13
|
end
|
14
14
|
```
|
@@ -0,0 +1,46 @@
|
|
1
|
+
desc "Configuration related tasks"
|
2
|
+
namespace :config do
|
3
|
+
desc "Configure magento base URLs"
|
4
|
+
task :'configure-urls' => ['magento:tools:n98magerun'] do
|
5
|
+
Hem.ui.success "Configuring magento base urls"
|
6
|
+
domain = Hem.project_config.hostname
|
7
|
+
run "bin/n98-magerun.phar config:set web/unsecure/base_url 'http://#{domain}/'",
|
8
|
+
realtime: true,
|
9
|
+
indent: 2
|
10
|
+
run "bin/n98-magerun.phar config:set web/secure/base_url 'https://#{domain}/'",
|
11
|
+
realtime: true,
|
12
|
+
indent: 2
|
13
|
+
Hem.ui.separator
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Enable magento errors"
|
17
|
+
task :'enable-errors' do
|
18
|
+
error_config = File.join(Hem.project_path, 'public/errors/local.xml')
|
19
|
+
|
20
|
+
FileUtils.cp(
|
21
|
+
error_config + ".sample",
|
22
|
+
error_config
|
23
|
+
) unless File.exists? error_config
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "Create admin user"
|
27
|
+
task :'create-admin-user' => ['magento:tools:n98magerun'] do
|
28
|
+
initialized = run("bin/n98-magerun.phar admin:user:list | grep admin", exit_status: true) == 0
|
29
|
+
unless initialized
|
30
|
+
Hem.ui.success "Creating admin user"
|
31
|
+
run "bin/n98-magerun.phar admin:user:create admin '' admin admin admin",
|
32
|
+
realtime: true,
|
33
|
+
indent: 2
|
34
|
+
Hem.ui.separator
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "Enable rewrites"
|
39
|
+
task :'enable-rewrites' => ['magento:tools:n98magerun'] do
|
40
|
+
Hem.ui.success "Enabling rewrites"
|
41
|
+
run "bin/n98-magerun.phar config:set web/seo/use_rewrites 1",
|
42
|
+
realtime: true,
|
43
|
+
indent: 2
|
44
|
+
Hem.ui.separator
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,197 @@
|
|
1
|
+
desc "Patch tasks"
|
2
|
+
namespace :patches do
|
3
|
+
def magento_path
|
4
|
+
unless @magento_path
|
5
|
+
files = locate('app/Mage.php')
|
6
|
+
unless files.length > 0
|
7
|
+
raise Hem::UserError.new "Could not find app/Mage.php in the git repository, this command should only be run for Magento projects"
|
8
|
+
end
|
9
|
+
|
10
|
+
/(?:(.*)\/)app\/Mage\.php/.match(files[0])
|
11
|
+
@magento_path = $1
|
12
|
+
end
|
13
|
+
@magento_path
|
14
|
+
end
|
15
|
+
|
16
|
+
def detect_clean
|
17
|
+
status = shell('git status -z', :capture => true, :strip => false)
|
18
|
+
status.split("\u0000").each do |line|
|
19
|
+
match = line.match(/^([\s\S]{2})\s+(.*)$/)
|
20
|
+
next if match.nil?
|
21
|
+
|
22
|
+
if ![' ', '?'].include?($1[0]) || $2.start_with?(magento_path)
|
23
|
+
raise Hem::UserError.new "Please remove all files from the git index, and stash all changes in '#{magento_path}' before continuing"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def detect_version
|
29
|
+
config_dirty = false
|
30
|
+
magento_version_file = "#{magento_path}/app/Mage.php"
|
31
|
+
|
32
|
+
if Hem.project_config[:magento_edition].nil?
|
33
|
+
magento_edition = nil
|
34
|
+
if magento_version_file
|
35
|
+
args = [ "php -r \"require '#{magento_version_file}'; echo Mage::getEdition();\""]
|
36
|
+
|
37
|
+
magento_edition = run(*args, :capture => true).to_s.downcase
|
38
|
+
end
|
39
|
+
|
40
|
+
edition_options = ['community', 'enterprise', 'professional', 'go']
|
41
|
+
|
42
|
+
unless edition_options.include? magento_edition
|
43
|
+
raise Hem::Error.new "Invalid Magento edition '#{magento_edition}' was found when calling Mage::getEdition(), skipping patches"
|
44
|
+
end
|
45
|
+
|
46
|
+
Hem.project_config[:magento_edition] = magento_edition
|
47
|
+
config_dirty = true
|
48
|
+
end
|
49
|
+
|
50
|
+
if Hem.project_config[:magento_version].nil?
|
51
|
+
magento_version = nil
|
52
|
+
if magento_version_file
|
53
|
+
args = [ "php -r \"require '#{magento_version_file}'; echo Mage::getVersion();\""]
|
54
|
+
|
55
|
+
magento_version = run(*args, :capture => true)
|
56
|
+
end
|
57
|
+
|
58
|
+
version_regex = /^\d+(\.\d+){3}$/
|
59
|
+
|
60
|
+
unless version_regex.match(magento_version)
|
61
|
+
raise Hem::Error.new "Invalid Magento version '#{magento_version}' was found when calling Mage::getVersion(), skipping patches"
|
62
|
+
end
|
63
|
+
|
64
|
+
Hem.project_config[:magento_version] = magento_version
|
65
|
+
config_dirty = true
|
66
|
+
end
|
67
|
+
|
68
|
+
if config_dirty
|
69
|
+
Hem::Config::File.save(Hem.project_config_file, Hem.project_config)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def detect_tools
|
74
|
+
use_vm = shell("which which", :exit_status => true) != 0
|
75
|
+
|
76
|
+
tools = ['patch', 'sed']
|
77
|
+
tools_command = tools.map {|tool| "which #{tool}"}.join " && "
|
78
|
+
status = 0
|
79
|
+
|
80
|
+
unless use_vm
|
81
|
+
status = shell(tools_command, :exit_status => true)
|
82
|
+
use_vm = status != 0
|
83
|
+
end
|
84
|
+
|
85
|
+
if use_vm
|
86
|
+
status = run(tools_command, :exit_status => true)
|
87
|
+
end
|
88
|
+
|
89
|
+
if status != 0
|
90
|
+
raise Hem::UserError.new "Please make sure '#{tools.join(',')}' is installed on your host or VM before continuing"
|
91
|
+
end
|
92
|
+
|
93
|
+
use_vm
|
94
|
+
end
|
95
|
+
|
96
|
+
desc "Apply patches to Magento"
|
97
|
+
task "apply" do
|
98
|
+
detect_clean
|
99
|
+
detect_version
|
100
|
+
|
101
|
+
config = Hem.project_config
|
102
|
+
|
103
|
+
sync = Hem::Lib::S3::Sync.new(Hem.aws_credentials)
|
104
|
+
|
105
|
+
patches_path = "#{Hem.project_path}/tools/patches"
|
106
|
+
incoming_path = "#{patches_path}/incoming"
|
107
|
+
|
108
|
+
Hem.ui.success("Downloading Magento #{config[:magento_edition].capitalize} #{config[:magento_version]} patches")
|
109
|
+
changes = sync.sync(
|
110
|
+
"s3://inviqa-assets-magento/#{config[:magento_edition]}/patches/#{config[:magento_version]}/",
|
111
|
+
"#{incoming_path}/",
|
112
|
+
:delete => false
|
113
|
+
)
|
114
|
+
Hem.ui.separator
|
115
|
+
|
116
|
+
use_vm = false
|
117
|
+
use_vm = detect_tools if Dir.glob("#{incoming_path}/*.sh").length > 0
|
118
|
+
|
119
|
+
patch_files = Dir.glob("#{incoming_path}/*.{sh,patch,diff}")
|
120
|
+
|
121
|
+
Hem.ui.success("#{patch_files.length} new patches found")
|
122
|
+
|
123
|
+
Hem.ui.separator
|
124
|
+
|
125
|
+
patch_files.each do |file|
|
126
|
+
filename = File.basename(file)
|
127
|
+
base_filename = File.basename(filename, File.extname(filename))
|
128
|
+
|
129
|
+
if File.exist?("#{patches_path}/#{filename}")
|
130
|
+
Hem.ui.debug("Patch #{filename} has already been applied, so skipping it")
|
131
|
+
|
132
|
+
File.delete file
|
133
|
+
next
|
134
|
+
end
|
135
|
+
|
136
|
+
if File.exist?("#{patches_path}/#{base_filename}.skip")
|
137
|
+
File.delete file
|
138
|
+
next
|
139
|
+
end
|
140
|
+
|
141
|
+
Hem.ui.success("Applying patch #{filename}")
|
142
|
+
|
143
|
+
yaml_file = File.join(File.dirname(file), base_filename + ".yaml")
|
144
|
+
|
145
|
+
metadata = {
|
146
|
+
'commit_message' => "Apply Magento patch #{filename}"
|
147
|
+
}
|
148
|
+
if File.exist?(yaml_file)
|
149
|
+
metadata = Hem::Config::File.load(yaml_file)
|
150
|
+
end
|
151
|
+
|
152
|
+
Hem.ui.info(metadata['description']) unless metadata['description'].nil?
|
153
|
+
|
154
|
+
patch_options = %w( yes never skip )
|
155
|
+
answer = Hem.ui.ask_choice('Do you want to apply this patch?', patch_options)
|
156
|
+
|
157
|
+
if answer == 'skip'
|
158
|
+
next
|
159
|
+
end
|
160
|
+
|
161
|
+
if answer == 'never'
|
162
|
+
File.delete file
|
163
|
+
File.write("#{patches_path}/#{base_filename}.skip", '')
|
164
|
+
|
165
|
+
shell "git add '#{patches_path}/#{base_filename}.skip'"
|
166
|
+
shell "git commit -m 'Add a skip file for patch #{filename}'"
|
167
|
+
next
|
168
|
+
end
|
169
|
+
|
170
|
+
if /\.sh$/.match(file)
|
171
|
+
File.rename file, "#{magento_path}/#{filename}"
|
172
|
+
file = "#{magento_path}/#{filename}"
|
173
|
+
if use_vm
|
174
|
+
run "cd #{magento_path} && sh #{filename}", :realtime => true, :indent => 2
|
175
|
+
else
|
176
|
+
shell "cd #{magento_path} && sh #{filename}", :realtime => true, :indent => 2
|
177
|
+
end
|
178
|
+
else
|
179
|
+
shell "git apply --directory #{magento_path} #{file}"
|
180
|
+
end
|
181
|
+
File.rename file, "#{patches_path}/#{filename}"
|
182
|
+
shell "git add #{magento_path}"
|
183
|
+
shell "git add #{patches_path}/#{filename}"
|
184
|
+
|
185
|
+
if File.exist?(yaml_file)
|
186
|
+
yaml_filename = File.basename(yaml_file)
|
187
|
+
File.rename yaml_file, "#{patches_path}/#{yaml_filename}"
|
188
|
+
shell "git add #{patches_path}/#{yaml_filename}"
|
189
|
+
end
|
190
|
+
shell "git commit -m #{metadata['commit_message'].shellescape}"
|
191
|
+
|
192
|
+
Hem.ui.separator
|
193
|
+
end
|
194
|
+
|
195
|
+
Hem.ui.success("Finished applying #{patch_files.length} patches")
|
196
|
+
end
|
197
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
desc "Setup script tasks"
|
2
|
+
namespace :'setup-scripts' do
|
3
|
+
desc "Run magento setup scripts"
|
4
|
+
task :run => ['magento:tools:n98magerun'] do
|
5
|
+
Hem.ui.success "Running setup scripts"
|
6
|
+
run "bin/n98-magerun.phar cache:clean config", realtime: true, indent: 2
|
7
|
+
run "bin/n98-magerun.phar sys:setup:incremental -n", realtime: true, indent: 2
|
8
|
+
Hem.ui.separator
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
namespace :tools do
|
2
|
+
desc "Fetches the n98-magerun utility"
|
3
|
+
task :n98magerun do
|
4
|
+
FileUtils.mkdir_p "bin"
|
5
|
+
run '"wget" --no-check-certificate "https://raw.github.com/netz98/n98-magerun/master/n98-magerun.phar" -O bin/n98-magerun.phar'
|
6
|
+
FileUtils.chmod 0755, "bin/n98-magerun.phar"
|
7
|
+
end
|
8
|
+
end
|
data/lib/hem/tasks/magento1.rb
CHANGED
@@ -1,277 +1,15 @@
|
|
1
|
-
namespace :tools do
|
2
|
-
desc "Fetches the n98-magerun utility"
|
3
|
-
task :n98magerun do
|
4
|
-
FileUtils.mkdir_p "bin"
|
5
|
-
run_command '"wget" --no-check-certificate "https://raw.github.com/netz98/n98-magerun/master/n98-magerun.phar" -O bin/n98-magerun.phar'
|
6
|
-
FileUtils.chmod 0755, "bin/n98-magerun.phar"
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
1
|
desc "Magento related tasks"
|
11
2
|
namespace :magento do
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
files = locate('*app/Mage.php')
|
18
|
-
unless files.length > 0
|
19
|
-
raise Hem::UserError.new "Could not find app/Mage.php in the git repository, this command should only be run for Magento projects"
|
20
|
-
end
|
21
|
-
|
22
|
-
/(?:(.*)\/)app\/Mage\.php/.match(files[0])
|
23
|
-
@magento_path = $1
|
24
|
-
end
|
25
|
-
@magento_path
|
26
|
-
end
|
27
|
-
|
28
|
-
def detect_clean
|
29
|
-
status = shell('git status -z', :capture => true, :strip => false)
|
30
|
-
status.split("\u0000").each do |line|
|
31
|
-
match = line.match(/^([\s\S]{2})\s+(.*)$/)
|
32
|
-
next if match.nil?
|
33
|
-
|
34
|
-
if ![' ', '?'].include?($1[0]) || $2.start_with?(magento_path)
|
35
|
-
raise Hem::UserError.new "Please remove all files from the git index, and stash all changes in '#{magento_path}' before continuing"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def detect_version
|
41
|
-
config_dirty = false
|
42
|
-
magento_version_file = "#{magento_path}/app/Mage.php"
|
43
|
-
|
44
|
-
if Hem.project_config[:magento_edition].nil?
|
45
|
-
magento_edition = nil
|
46
|
-
if magento_version_file
|
47
|
-
args = [ "php -r \"require '#{magento_version_file}'; echo Mage::getEdition();\""]
|
48
|
-
|
49
|
-
magento_edition = run_command(*args, :capture => true).to_s.downcase
|
50
|
-
end
|
51
|
-
|
52
|
-
edition_options = ['community', 'enterprise', 'professional', 'go']
|
53
|
-
|
54
|
-
unless edition_options.include? magento_edition
|
55
|
-
raise Hem::Error.new "Invalid Magento edition '#{magento_edition}' was found when calling Mage::getEdition(), skipping patches"
|
56
|
-
end
|
57
|
-
|
58
|
-
Hem.project_config[:magento_edition] = magento_edition
|
59
|
-
config_dirty = true
|
60
|
-
end
|
61
|
-
|
62
|
-
if Hem.project_config[:magento_version].nil?
|
63
|
-
magento_version = nil
|
64
|
-
if magento_version_file
|
65
|
-
args = [ "php -r \"require '#{magento_version_file}'; echo Mage::getVersion();\""]
|
66
|
-
|
67
|
-
magento_version = run_command(*args, :capture => true)
|
68
|
-
end
|
69
|
-
|
70
|
-
version_regex = /^\d+(\.\d+){3}$/
|
71
|
-
|
72
|
-
unless version_regex.match(magento_version)
|
73
|
-
raise Hem::Error.new "Invalid Magento version '#{magento_version}' was found when calling Mage::getVersion(), skipping patches"
|
74
|
-
end
|
75
|
-
|
76
|
-
Hem.project_config[:magento_version] = magento_version
|
77
|
-
config_dirty = true
|
78
|
-
end
|
79
|
-
|
80
|
-
if config_dirty
|
81
|
-
Hem::Config::File.save(Hem.project_config_file, Hem.project_config)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def detect_tools
|
86
|
-
use_vm = shell("which which", :exit_status => true) != 0
|
87
|
-
|
88
|
-
tools = ['patch', 'sed']
|
89
|
-
tools_command = tools.map {|tool| "which #{tool}"}.join " && "
|
90
|
-
status = 0
|
91
|
-
|
92
|
-
unless use_vm
|
93
|
-
status = shell(tools_command, :exit_status => true)
|
94
|
-
use_vm = status != 0
|
95
|
-
end
|
96
|
-
|
97
|
-
if use_vm
|
98
|
-
status = run_command(tools_command, :exit_status => true)
|
99
|
-
end
|
100
|
-
|
101
|
-
if status != 0
|
102
|
-
raise Hem::UserError.new "Please make sure '#{tools.join(',')}' is installed on your host or VM before continuing"
|
103
|
-
end
|
104
|
-
|
105
|
-
use_vm
|
106
|
-
end
|
107
|
-
|
108
|
-
desc "Apply patches to Magento"
|
109
|
-
task "apply" do
|
110
|
-
detect_clean
|
111
|
-
detect_version
|
112
|
-
|
113
|
-
config = Hem.project_config
|
114
|
-
|
115
|
-
sync = Hem::Lib::S3::Sync.new(Hem.aws_credentials)
|
116
|
-
|
117
|
-
patches_path = "#{Hem.project_path}/tools/patches"
|
118
|
-
incoming_path = "#{patches_path}/incoming"
|
119
|
-
|
120
|
-
Hem.ui.success("Downloading Magento #{config[:magento_edition].capitalize} #{config[:magento_version]} patches")
|
121
|
-
changes = sync.sync(
|
122
|
-
"s3://inviqa-assets-magento/#{config[:magento_edition]}/patches/#{config[:magento_version]}/",
|
123
|
-
"#{incoming_path}/",
|
124
|
-
:delete => false
|
125
|
-
)
|
126
|
-
Hem.ui.separator
|
127
|
-
|
128
|
-
use_vm = false
|
129
|
-
use_vm = detect_tools if Dir.glob("#{incoming_path}/*.sh").length > 0
|
130
|
-
|
131
|
-
patch_files = Dir.glob("#{incoming_path}/*.{sh,patch,diff}")
|
132
|
-
|
133
|
-
Hem.ui.success("#{patch_files.length} new patches found")
|
134
|
-
|
135
|
-
Hem.ui.separator
|
136
|
-
|
137
|
-
patch_files.each do |file|
|
138
|
-
filename = File.basename(file)
|
139
|
-
base_filename = File.basename(filename, File.extname(filename))
|
140
|
-
|
141
|
-
if File.exist?("#{patches_path}/#{filename}")
|
142
|
-
Hem.ui.debug("Patch #{filename} has already been applied, so skipping it")
|
143
|
-
|
144
|
-
File.delete file
|
145
|
-
next
|
146
|
-
end
|
147
|
-
|
148
|
-
if File.exist?("#{patches_path}/#{base_filename}.skip")
|
149
|
-
File.delete file
|
150
|
-
next
|
151
|
-
end
|
152
|
-
|
153
|
-
Hem.ui.success("Applying patch #{filename}")
|
154
|
-
|
155
|
-
yaml_file = File.join(File.dirname(file), base_filename + ".yaml")
|
156
|
-
|
157
|
-
metadata = {
|
158
|
-
'commit_message' => "Apply Magento patch #{filename}"
|
159
|
-
}
|
160
|
-
if File.exist?(yaml_file)
|
161
|
-
metadata = Hem::Config::File.load(yaml_file)
|
162
|
-
end
|
163
|
-
|
164
|
-
Hem.ui.info(metadata['description']) unless metadata['description'].nil?
|
165
|
-
|
166
|
-
patch_options = %w( yes never skip )
|
167
|
-
answer = Hem.ui.ask_choice('Do you want to apply this patch?', patch_options)
|
168
|
-
|
169
|
-
if answer == 'skip'
|
170
|
-
next
|
171
|
-
end
|
172
|
-
|
173
|
-
if answer == 'never'
|
174
|
-
File.delete file
|
175
|
-
File.write("#{patches_path}/#{base_filename}.skip", '')
|
176
|
-
|
177
|
-
shell "git add '#{patches_path}/#{base_filename}.skip'"
|
178
|
-
shell "git commit -m 'Add a skip file for patch #{filename}'"
|
179
|
-
next
|
180
|
-
end
|
181
|
-
|
182
|
-
if /\.sh$/.match(file)
|
183
|
-
File.rename file, "#{magento_path}/#{filename}"
|
184
|
-
file = "#{magento_path}/#{filename}"
|
185
|
-
if use_vm
|
186
|
-
run_command "cd #{magento_path} && sh #{filename}", :realtime => true, :indent => 2
|
187
|
-
else
|
188
|
-
shell "cd #{magento_path} && sh #{filename}", :realtime => true, :indent => 2
|
189
|
-
end
|
190
|
-
else
|
191
|
-
shell "git apply --directory #{magento_path} #{file}"
|
192
|
-
end
|
193
|
-
File.rename file, "#{patches_path}/#{filename}"
|
194
|
-
shell "git add #{magento_path}"
|
195
|
-
shell "git add #{patches_path}/#{filename}"
|
196
|
-
|
197
|
-
if File.exist?(yaml_file)
|
198
|
-
yaml_filename = File.basename(yaml_file)
|
199
|
-
File.rename yaml_file, "#{patches_path}/#{yaml_filename}"
|
200
|
-
shell "git add #{patches_path}/#{yaml_filename}"
|
201
|
-
end
|
202
|
-
shell "git commit -m #{metadata['commit_message'].shellescape}"
|
203
|
-
|
204
|
-
Hem.ui.separator
|
205
|
-
end
|
206
|
-
|
207
|
-
Hem.ui.success("Finished applying #{patch_files.length} patches")
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
desc "Setup script tasks"
|
212
|
-
namespace :'setup-scripts' do
|
213
|
-
desc "Run magento setup scripts"
|
214
|
-
task :run => ['tools:n98magerun'] do
|
215
|
-
Hem.ui.success "Running setup scripts"
|
216
|
-
run_command("bin/n98-magerun.phar cache:clean config", :realtime => true, :indent => 2)
|
217
|
-
run_command("bin/n98-magerun.phar sys:setup:incremental -n", :realtime => true, :indent => 2)
|
218
|
-
Hem.ui.separator
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
desc "Cache tasks"
|
223
|
-
namespace :cache do
|
224
|
-
desc "Clear cache"
|
225
|
-
task :clear => ['tools:n98magerun'] do
|
226
|
-
Hem.ui.success "Clearing magento cache"
|
227
|
-
run_command("bin/n98-magerun.phar cache:flush", :realtime => true, :indent => 2)
|
228
|
-
Hem.ui.separator
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
desc "Configuration related tasks"
|
233
|
-
namespace :config do
|
234
|
-
desc "Configure magento base URLs"
|
235
|
-
task :'configure-urls' => ['tools:n98magerun'] do
|
236
|
-
Hem.ui.success "Configuring magento base urls"
|
237
|
-
domain = Hem.project_config.hostname
|
238
|
-
run_command("bin/n98-magerun.phar config:set web/unsecure/base_url 'http://#{domain}/'", :realtime => true, :indent => 2)
|
239
|
-
run_command("bin/n98-magerun.phar config:set web/secure/base_url 'https://#{domain}/'", :realtime => true, :indent => 2)
|
240
|
-
Hem.ui.separator
|
241
|
-
end
|
242
|
-
|
243
|
-
desc "Enable magento errors"
|
244
|
-
task :'enable-errors' do
|
245
|
-
error_config = File.join(Hem.project_path, 'public/errors/local.xml')
|
246
|
-
|
247
|
-
FileUtils.cp(
|
248
|
-
error_config + ".sample",
|
249
|
-
error_config
|
250
|
-
) unless File.exists? error_config
|
251
|
-
end
|
252
|
-
|
253
|
-
desc "Create admin user"
|
254
|
-
task :'create-admin-user' do
|
255
|
-
initialized = run_command("bin/n98-magerun.phar admin:user:list | grep admin", :exit_status => true) == 0
|
256
|
-
unless initialized
|
257
|
-
Hem.ui.success "Creating admin user"
|
258
|
-
run_command("bin/n98-magerun.phar admin:user:create admin '' admin admin admin", :realtime => true, :indent => 2)
|
259
|
-
Hem.ui.separator
|
260
|
-
end
|
261
|
-
end
|
262
|
-
|
263
|
-
desc "Enable rewrites"
|
264
|
-
task :'enable-rewrites' do
|
265
|
-
Hem.ui.success "Enabling rewrites"
|
266
|
-
run_command("bin/n98-magerun.phar config:set web/seo/use_rewrites 1", :realtime => true, :indent => 2)
|
267
|
-
Hem.ui.separator
|
268
|
-
end
|
269
|
-
end
|
3
|
+
require_relative 'magento1/cache'
|
4
|
+
require_relative 'magento1/config'
|
5
|
+
require_relative 'magento1/patches'
|
6
|
+
require_relative 'magento1/setup-scripts'
|
7
|
+
require_relative 'magento1/tools'
|
270
8
|
|
271
9
|
desc "Initializes magento specifics on the virtual machine after a fresh build"
|
272
10
|
task :'initialize-vm' => [
|
273
11
|
'magento:config:enable-errors',
|
274
|
-
'tools:n98magerun',
|
12
|
+
'magento:tools:n98magerun',
|
275
13
|
'magento:setup-scripts:run',
|
276
14
|
'magento:config:configure-urls',
|
277
15
|
'magento:config:create-admin-user',
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hem-tasks-magento1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Thompson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -51,6 +51,11 @@ files:
|
|
51
51
|
- Rakefile
|
52
52
|
- hem-tasks-magento1.gemspec
|
53
53
|
- lib/hem/tasks/magento1.rb
|
54
|
+
- lib/hem/tasks/magento1/cache.rb
|
55
|
+
- lib/hem/tasks/magento1/config.rb
|
56
|
+
- lib/hem/tasks/magento1/patches.rb
|
57
|
+
- lib/hem/tasks/magento1/setup-scripts.rb
|
58
|
+
- lib/hem/tasks/magento1/tools.rb
|
54
59
|
- lib/hem/tasks/magento1/version.rb
|
55
60
|
homepage: ''
|
56
61
|
licenses:
|