maruto 0.0.9 → 0.0.10
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/.travis.yml +0 -3
- data/README.md +5 -4
- data/lib/maruto/magento_config.rb +7 -3
- data/lib/maruto/module_definition.rb +25 -16
- data/lib/maruto/runner.rb +5 -8
- data/lib/maruto/version.rb +1 -1
- data/maruto.gemspec +1 -1
- metadata +4 -4
data/.travis.yml
CHANGED
data/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# Maruto
|
|
5
5
|
|
|
6
|
-
Magento Ruby Tools
|
|
6
|
+
Magento Ruby Tools, requires ruby >= 1.9.2
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
@@ -28,6 +28,7 @@ Or install it yourself as:
|
|
|
28
28
|
1. Fork it
|
|
29
29
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
30
30
|
3. Run the tests (`bundle exec rake test`)
|
|
31
|
-
4.
|
|
32
|
-
5.
|
|
33
|
-
6.
|
|
31
|
+
4. Run the dev version of maruto (`ruby -Ilib bin/maruto ...`)
|
|
32
|
+
5. Commit your changes (`git commit -am 'Add some feature'`)
|
|
33
|
+
6. Push to the branch (`git push origin my-new-feature`)
|
|
34
|
+
7. Create new Pull Request
|
|
@@ -127,13 +127,17 @@ module Maruto
|
|
|
127
127
|
name = xml_node.name
|
|
128
128
|
config = {
|
|
129
129
|
:active => xml_node.at_xpath('active').content == 'true',
|
|
130
|
-
:code_pool => xml_node.at_xpath('codePool').content,
|
|
131
130
|
:dependencies => xml_node.xpath('depends/*').map(&:name),
|
|
132
131
|
:defined => file,
|
|
133
132
|
}
|
|
133
|
+
# deprecated will be deleted
|
|
134
|
+
if xml_node.at_xpath('codePool') then
|
|
135
|
+
config[:code_pool] = xml_node.at_xpath('codePool').content
|
|
136
|
+
else
|
|
137
|
+
#@warnings << "module:#{name} - ..."
|
|
138
|
+
end
|
|
134
139
|
if @modules.include? name then
|
|
135
|
-
#
|
|
136
|
-
@warnings << "module:#{name} - duplicate module definition (#{@modules[name][:defined]} and file)"
|
|
140
|
+
#@warnings << "module:#{name} - duplicate module definition (#{@modules[name][:defined]} and file)"
|
|
137
141
|
end
|
|
138
142
|
@modules[name] = config
|
|
139
143
|
end
|
|
@@ -5,23 +5,32 @@ require 'tsort'
|
|
|
5
5
|
module Maruto::ModuleDefinition
|
|
6
6
|
|
|
7
7
|
def self.parse_module_definition(xml_node)
|
|
8
|
-
module_definition = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
8
|
+
module_definition = { :name => xml_node.name.to_sym }
|
|
9
|
+
|
|
10
|
+
module_definition[:active] = !(/^(false|off)$/ =~ xml_node.at_xpath('active').content) if xml_node.at_xpath('active')
|
|
11
|
+
module_definition[:code_pool] = xml_node.at_xpath('codePool').content.to_sym if xml_node.at_xpath('codePool')
|
|
13
12
|
|
|
14
13
|
deps = xml_node.xpath('depends/*').map { |e| e.name.to_sym }
|
|
15
14
|
module_definition[:dependencies] = deps if deps.size > 0
|
|
16
15
|
|
|
17
|
-
unless /^(true|false|off)$/ =~ xml_node.at_xpath('active').content then
|
|
16
|
+
unless xml_node.at_xpath('active') and /^(true|false|off)$/ =~ xml_node.at_xpath('active').content then
|
|
18
17
|
module_definition[:warnings] = []
|
|
19
|
-
|
|
18
|
+
# TODO write test
|
|
19
|
+
if xml_node.at_xpath('active')
|
|
20
|
+
module_definition[:warnings] << { :message => "value for active element should be in ['true','false','off'] (element: #{xml_node.at_xpath('active')})" }
|
|
21
|
+
else
|
|
22
|
+
module_definition[:warnings] << { :message => "missing element: active (#{xml_node.path})" }
|
|
23
|
+
end
|
|
20
24
|
end
|
|
21
25
|
|
|
22
|
-
unless /^(core|community|local)$/ =~ xml_node.at_xpath('codePool').content then
|
|
26
|
+
unless xml_node.at_xpath('codePool') and /^(core|community|local)$/ =~ xml_node.at_xpath('codePool').content then
|
|
23
27
|
module_definition[:warnings] ||= []
|
|
24
|
-
|
|
28
|
+
# TODO write test
|
|
29
|
+
if xml_node.at_xpath('codePool')
|
|
30
|
+
module_definition[:warnings] << { :message => "value for codePool element should be in ['core','community','local'] (element: #{xml_node.at_xpath('codePool')})" }
|
|
31
|
+
else
|
|
32
|
+
module_definition[:warnings] << { :message => "missing element: codePool (#{xml_node.path})" }
|
|
33
|
+
end
|
|
25
34
|
end
|
|
26
35
|
|
|
27
36
|
module_definition
|
|
@@ -68,14 +77,14 @@ module Maruto::ModuleDefinition
|
|
|
68
77
|
def self.analyse_module_definitions(module_definitions)
|
|
69
78
|
h = Hash.new
|
|
70
79
|
module_definitions.each do |m|
|
|
80
|
+
mod_name = m[:name]
|
|
81
|
+
if h.include? mod_name then
|
|
82
|
+
# disable first module
|
|
83
|
+
h[mod_name][:active] = false
|
|
84
|
+
m[:warnings] ||= []
|
|
85
|
+
m[:warnings] << { :file => m[:defined], :message => "duplicate module definition (in '#{h[mod_name][:defined]}' and '#{m[:defined]}')" }
|
|
86
|
+
end
|
|
71
87
|
if m[:active]
|
|
72
|
-
mod_name = m[:name]
|
|
73
|
-
if h.include? mod_name then
|
|
74
|
-
# disable first module
|
|
75
|
-
h[mod_name][:active] = false
|
|
76
|
-
m[:warnings] ||= []
|
|
77
|
-
m[:warnings] << { :file => m[:defined], :message => "duplicate module definition (in '#{h[mod_name][:defined]}' and '#{m[:defined]}')" }
|
|
78
|
-
end
|
|
79
88
|
parts = mod_name.to_s.split('_')
|
|
80
89
|
h[mod_name] = m
|
|
81
90
|
if parts.size != 2
|
data/lib/maruto/runner.rb
CHANGED
|
@@ -94,21 +94,18 @@ class Maruto::Runner < Thor
|
|
|
94
94
|
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
desc "modules
|
|
97
|
+
desc "modules", "list modules"
|
|
98
98
|
method_option :magento_root, :aliases => "-m", :default => "."
|
|
99
|
-
def modules(
|
|
99
|
+
def modules()
|
|
100
100
|
|
|
101
101
|
magento_root = check_magento_folder()
|
|
102
102
|
|
|
103
103
|
magento = Maruto::MagentoInstance.load(magento_root)
|
|
104
104
|
|
|
105
|
-
|
|
106
105
|
magento[:all_modules].each do |name, m|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
puts "#{name}(active:#{m[:active]}, code_pool:#{m[:code_pool]}, defined:#{m[:defined]}#{deps})"
|
|
111
|
-
end
|
|
106
|
+
deps = ''
|
|
107
|
+
deps = ", dependencies:[#{m[:dependencies].collect{ |d| d.to_s }.join(', ')}]" if m[:dependencies]
|
|
108
|
+
puts "#{name}(active:#{m[:active]}, code_pool:#{m[:code_pool]}, defined:#{m[:defined]}#{deps})"
|
|
112
109
|
end
|
|
113
110
|
|
|
114
111
|
end
|
data/lib/maruto/version.rb
CHANGED
data/maruto.gemspec
CHANGED
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
19
|
spec.require_paths = ["lib"]
|
|
20
20
|
|
|
21
|
-
spec.add_dependency "nokogiri", "~> 1.
|
|
21
|
+
spec.add_dependency "nokogiri", "~> 1.6"
|
|
22
22
|
spec.add_dependency "thor", "~> 0.17"
|
|
23
23
|
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: maruto
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.10
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
12
|
+
date: 2013-08-14 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: nokogiri
|
|
@@ -18,7 +18,7 @@ dependencies:
|
|
|
18
18
|
requirements:
|
|
19
19
|
- - ~>
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: '1.
|
|
21
|
+
version: '1.6'
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -26,7 +26,7 @@ dependencies:
|
|
|
26
26
|
requirements:
|
|
27
27
|
- - ~>
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: '1.
|
|
29
|
+
version: '1.6'
|
|
30
30
|
- !ruby/object:Gem::Dependency
|
|
31
31
|
name: thor
|
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|