maruto 0.0.10 → 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0083f53e3076bf2dc44be857c447fc331b7bbc6e
4
+ data.tar.gz: 8e827f8f33add2acea9d74c588043462d627b437
5
+ SHA512:
6
+ metadata.gz: 1aa5be1fa7983da6f278e47cc95ab14a3f674e7a5368759ddc80211953d9bf4024ec8c6e5619005180f480e38979128afacc98d4acefaa08c8b973eb6fc75a7f
7
+ data.tar.gz: 2b0cc72e2b1e6cc3a34bd1f08c8f6df12fbf77787194ab1b69a463bde419a8f1ba69f3112339170b361fa71b291d2a8ee41d4fb0538f8a0ead8c2a5ad58748d8
@@ -1 +1 @@
1
- 1.9.3
1
+ 2.3.1
@@ -1,8 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "1.9.2"
4
- - "1.9.3"
5
- - "2.0.0"
3
+ - 2.0
4
+ - 2.2
6
5
  - jruby-19mode # JRuby in 1.9 mode
7
6
  - rbx-19mode
8
7
  script: bundle exec rake test
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # Maruto
5
5
 
6
- Magento Ruby Tools, requires ruby >= 1.9.2
6
+ Magento Ruby Tools, requires ruby >= 2
7
7
 
8
8
  ## Installation
9
9
 
@@ -37,12 +37,11 @@ module Maruto
37
37
  # puts mm_name
38
38
  # puts mm_config
39
39
 
40
- parts = mm_name.split('_')
41
- abort "module:#{mm_name} - unrecognized module name format" unless parts.size == 2
42
- config_path = "app/code/#{mm_config[:code_pool]}/#{parts[0]}/#{parts[1]}/etc/config.xml"
40
+ config_path = "app/code/#{mm_config[:code_pool]}/#{mm_name.gsub(/_/, '/')}/etc/config.xml"
43
41
 
44
- if !File.exists?(config_path)
45
- @warnings << "module:#{mm_name} is defined (#{mm_config[:defined]}) but does not exists (#{config_path})"
42
+ if !File.exist?(config_path)
43
+ # duplicate warning see new code in module_definition.rb
44
+ # @warnings << "module:#{mm_name} is defined (#{mm_config[:defined]}) but does not exists (#{config_path})"
46
45
  next
47
46
  end
48
47
 
@@ -5,7 +5,7 @@ module Maruto::MagentoVersion
5
5
 
6
6
  def self.read_magento_version()
7
7
  mage = 'app/Mage.php'
8
- return nil unless File.exists? mage
8
+ return nil unless File.exist? mage
9
9
  File.open mage do |file|
10
10
  # newer magento version have a getVersionInfo function
11
11
  newer = file.find { |line| line =~ /getVersionInfo/ }
@@ -85,19 +85,12 @@ module Maruto::ModuleDefinition
85
85
  m[:warnings] << { :file => m[:defined], :message => "duplicate module definition (in '#{h[mod_name][:defined]}' and '#{m[:defined]}')" }
86
86
  end
87
87
  if m[:active]
88
- parts = mod_name.to_s.split('_')
89
88
  h[mod_name] = m
90
- if parts.size != 2
89
+ m[:config_path] = "app/code/#{m[:code_pool]}/#{mod_name.to_s.gsub(/_/, '/')}/etc/config.xml"
90
+ if !File.exist?(m[:config_path])
91
91
  m[:warnings] ||= []
92
- m[:warnings] << { :file => m[:defined], :message => "invalid module name" }
92
+ m[:warnings]<< { :file => m[:defined], :message => "config.xml is missing (searching '#{m[:config_path]}' for #{m[:name]})" }
93
93
  m[:active] = false
94
- else
95
- m[:config_path] = "app/code/#{m[:code_pool]}/#{parts[0]}/#{parts[1]}/etc/config.xml"
96
- if !File.exists?(m[:config_path])
97
- m[:warnings] ||= []
98
- m[:warnings]<< { :file => m[:defined], :message => "config.xml is missing (searching '#{m[:config_path]}' for #{m[:name]})" }
99
- m[:active] = false
100
- end
101
94
  end
102
95
  else
103
96
  if m[:code_pool] == :core and m[:name].to_s.start_with? 'Mage_' then
@@ -78,6 +78,10 @@ class Maruto::Runner < Thor
78
78
  end
79
79
  end
80
80
 
81
+ if magento[:warnings].empty?
82
+ exit 0
83
+ end
84
+ exit 1
81
85
  end
82
86
 
83
87
  desc "models", "list models sorted and grouped by their group_name"
@@ -171,5 +175,3 @@ class Maruto::Runner < Thor
171
175
  end
172
176
  end
173
177
  end
174
-
175
-
@@ -1,3 +1,3 @@
1
1
  module Maruto
2
- VERSION = "0.0.10"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -18,6 +18,8 @@ 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.required_ruby_version = '>= 2.0.0'
22
+
21
23
  spec.add_dependency "nokogiri", "~> 1.6"
22
24
  spec.add_dependency "thor", "~> 0.17"
23
25
 
@@ -170,10 +170,12 @@ describe Maruto::ModuleDefinition do
170
170
 
171
171
  describe "when analysing module definitions" do
172
172
  before do
173
- @module_a = { :name => :Mage_A, :code_pool => :core, :defined => 'a'}
174
- @module_b = { :name => :Mage_B, :code_pool => :core, :defined => 'b'}
175
- @module_c = { :name => :Mage_C, :code_pool => :core, :defined => 'c'}
176
- @module_d = { :name => :Mage_D, :code_pool => :core, :defined => 'd'}
173
+ @module_a = { :name => :Mage_A, :code_pool => :core, :defined => 'app/etc/modules/SomeFile.xml'}
174
+ @module_b = { :name => :Mage_B, :code_pool => :core, :defined => 'app/etc/modules/SomeFile.xml'}
175
+ @module_c = { :name => :Mage_C, :code_pool => :core, :defined => 'app/etc/modules/SomeFile.xml'}
176
+ @module_d = { :name => :Mage_D, :code_pool => :core, :defined => 'app/etc/modules/SomeFile.xml'}
177
+ @module_e = { :name => :Short, :code_pool => :core, :defined => 'app/etc/modules/SomeFile.xml'}
178
+ @module_f = { :name => :Long_A_B, :code_pool => :core, :defined => 'app/etc/modules/SomeFile.xml'}
177
179
  end
178
180
  it "will return an Array and a Hash" do
179
181
  a,h = Maruto::ModuleDefinition.analyse_module_definitions([])
@@ -188,6 +190,15 @@ describe Maruto::ModuleDefinition do
188
190
  a.size.must_equal 0
189
191
  h.size.must_equal 0
190
192
  end
193
+ it "will include active modules (in Array or Hash)" do
194
+ parsed_module_definitions = [
195
+ @module_a.merge({ :active => true }),
196
+ @module_e.merge({ :active => true }),
197
+ @module_f.merge({ :active => true }),
198
+ ]
199
+ a,h = Maruto::ModuleDefinition.analyse_module_definitions(parsed_module_definitions)
200
+ h.keys.must_equal [:Mage_A, :Short, :Long_A_B]
201
+ end
191
202
  it "will warn when a core/Mage_ module is inactive" do
192
203
  parsed_module_definitions = [
193
204
  @module_a.merge({ :active => false, :warnings => ['first warning'] }),
@@ -220,23 +231,19 @@ describe Maruto::ModuleDefinition do
220
231
  h[:Mage_A][:warnings].size.must_equal 2
221
232
  h[:Mage_A][:warnings][-1][:file].must_equal @module_a[:defined]
222
233
  end
223
- it "will deactivate modules with an invalid name and add a warning" do
224
- parsed_module_definitions = [
225
- { :name => :a, :active => true, :defined => 'a', :warnings => ['first warning'] },
226
- ]
227
- a,h = Maruto::ModuleDefinition.analyse_module_definitions(parsed_module_definitions)
228
- parsed_module_definitions[0][:active].must_equal false
229
- parsed_module_definitions[0][:warnings].size.must_equal 2
230
- parsed_module_definitions[0][:warnings][-1][:message].must_include "invalid module name"
231
- parsed_module_definitions[0][:warnings][-1][:file].must_equal 'a'
232
- end
233
234
  it "will add the path to the module's config.xml" do
234
235
  parsed_module_definitions = [
235
236
  @module_a.merge({ :active => true }),
237
+ @module_e.merge({ :active => true }),
238
+ @module_f.merge({ :active => true }),
236
239
  ]
237
240
  a,h = Maruto::ModuleDefinition.analyse_module_definitions(parsed_module_definitions)
238
241
  h[:Mage_A][:config_path].must_equal 'app/code/core/Mage/A/etc/config.xml'
239
242
  h[:Mage_A].wont_include :warnings
243
+ h[:Short][:config_path].must_equal 'app/code/core/Short/etc/config.xml'
244
+ h[:Short].wont_include :warnings
245
+ h[:Long_A_B][:config_path].must_equal 'app/code/core/Long/A/B/etc/config.xml'
246
+ h[:Long_A_B].wont_include :warnings
240
247
  end
241
248
  it "will deactivate modules without a config.xml and add a warning" do
242
249
  parsed_module_definitions = [
@@ -274,4 +281,3 @@ describe Maruto::ModuleDefinition do
274
281
  end
275
282
 
276
283
  end
277
-
metadata CHANGED
@@ -1,94 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maruto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jean-Luc Geering
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-08-14 00:00:00.000000000 Z
11
+ date: 2016-08-17 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: nokogiri
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.6'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.6'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: thor
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0.17'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0.17'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: bundler
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
47
  version: '1.3'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
54
  version: '1.3'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: minitest
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ~>
73
+ - - "~>"
84
74
  - !ruby/object:Gem::Version
85
75
  version: '5'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ~>
80
+ - - "~>"
92
81
  - !ruby/object:Gem::Version
93
82
  version: '5'
94
83
  description: Magento Ruby Tools
@@ -99,9 +88,9 @@ executables:
99
88
  extensions: []
100
89
  extra_rdoc_files: []
101
90
  files:
102
- - .gitignore
103
- - .ruby-version
104
- - .travis.yml
91
+ - ".gitignore"
92
+ - ".ruby-version"
93
+ - ".travis.yml"
105
94
  - Gemfile
106
95
  - LICENSE.txt
107
96
  - README.md
@@ -114,10 +103,12 @@ files:
114
103
  - fixtures/magento_1.7.0.2/app/Mage.php
115
104
  - fixtures/magento_1.7.0.2/app/code/core/Mage/Catalog/etc/config.xml
116
105
  - fixtures/magento_1.7.0.2/app/code/core/Mage/Sales/etc/config.xml
106
+ - fixtures/magento_root/app/code/core/Long/A/B/etc/config.xml
117
107
  - fixtures/magento_root/app/code/core/Mage/A/etc/config.xml
118
108
  - fixtures/magento_root/app/code/core/Mage/B/etc/config.xml
119
109
  - fixtures/magento_root/app/code/core/Mage/C/etc/config.xml
120
110
  - fixtures/magento_root/app/code/core/Mage/D/etc/config.xml
111
+ - fixtures/magento_root/app/code/core/Short/etc/config.xml
121
112
  - fixtures/magento_root/app/etc/modules/Bad_Example.xml
122
113
  - fixtures/magento_root/app/etc/modules/Mage_All.xml
123
114
  - fixtures/magento_root/app/etc/modules/Mage_Api.xml
@@ -142,27 +133,26 @@ files:
142
133
  homepage: https://github.com/jlgeering/maruto
143
134
  licenses:
144
135
  - MIT
136
+ metadata: {}
145
137
  post_install_message:
146
138
  rdoc_options: []
147
139
  require_paths:
148
140
  - lib
149
141
  required_ruby_version: !ruby/object:Gem::Requirement
150
- none: false
151
142
  requirements:
152
- - - ! '>='
143
+ - - ">="
153
144
  - !ruby/object:Gem::Version
154
- version: '0'
145
+ version: 2.0.0
155
146
  required_rubygems_version: !ruby/object:Gem::Requirement
156
- none: false
157
147
  requirements:
158
- - - ! '>='
148
+ - - ">="
159
149
  - !ruby/object:Gem::Version
160
150
  version: '0'
161
151
  requirements: []
162
152
  rubyforge_project:
163
- rubygems_version: 1.8.23
153
+ rubygems_version: 2.5.1
164
154
  signing_key:
165
- specification_version: 3
155
+ specification_version: 4
166
156
  summary: config parser and analyser, ...
167
157
  test_files:
168
158
  - spec/magento_version_spec.rb