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.
@@ -1,11 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "1.8.7"
4
3
  - "1.9.2"
5
4
  - "1.9.3"
6
5
  - "2.0.0"
7
- - jruby-18mode # JRuby in 1.8 mode
8
6
  - jruby-19mode # JRuby in 1.9 mode
9
- - rbx-18mode
10
7
  - rbx-19mode
11
8
  script: bundle exec rake test
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. Commit your changes (`git commit -am 'Add some feature'`)
32
- 5. Push to the branch (`git push origin my-new-feature`)
33
- 6. Create new Pull Request
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
- # TODO test this
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
- :name => xml_node.name.to_sym,
10
- :active => !(/^(false|off)$/ =~ xml_node.at_xpath('active').content),
11
- :code_pool => xml_node.at_xpath('codePool').content.to_sym,
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
- module_definition[:warnings] << { :message => "value for active element should be in ['true','false','off'] (element: #{xml_node.at_xpath('active')})" }
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
- module_definition[:warnings] << { :message => "value for codePool element should be in ['core','community','local'] (element: #{xml_node.at_xpath('codePool')})" }
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
@@ -94,21 +94,18 @@ class Maruto::Runner < Thor
94
94
 
95
95
  end
96
96
 
97
- desc "modules FILTER", "list modules, optionally filtered by event name"
97
+ desc "modules", "list modules"
98
98
  method_option :magento_root, :aliases => "-m", :default => "."
99
- def modules(filter = nil)
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
- if filter.nil? or name.to_s.include? filter
108
- deps = ''
109
- deps = ", dependencies:[#{m[:dependencies].collect{ |d| d.to_s }.join(', ')}]" if m[:dependencies]
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
@@ -1,3 +1,3 @@
1
1
  module Maruto
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -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.5"
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.9
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-06-17 00:00:00.000000000 Z
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.5'
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.5'
29
+ version: '1.6'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: thor
32
32
  requirement: !ruby/object:Gem::Requirement