modular_engine 0.9.4 → 0.9.5
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.
- checksums.yaml +4 -4
- data/lib/generators/modular/engine_generator.rb +11 -13
- data/lib/modular_engine/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6aae4aad5415d55229a5516ee37efa9761511e36
|
4
|
+
data.tar.gz: 1addaca9e979e0188ec51e8671fadd0a9f4b59db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19ae11906725526d24b68fd78558d18d8c91f447ddd37a641af41d4adb660016f6c0ee332976e1dba5e381a8e59021910dbeb276a78efacd762af4dbb6460704
|
7
|
+
data.tar.gz: 46f97650548ab8c7ff0f8401314ceb90ff8547ade8cc6a51272d69c8d8f51605e5feb35de8d70abbdaf508b231c7a1e982a74f9e5439003c992fbb1cee8ca002
|
@@ -1,8 +1,6 @@
|
|
1
|
-
#lib/generators/modular_engine_generator/install_generator.rb
|
2
1
|
require 'rails/generators'
|
3
2
|
require 'active_support/core_ext/hash/slice'
|
4
3
|
require "rails/generators/rails/app/app_generator"
|
5
|
-
#require "rails/generators/app_base"
|
6
4
|
require 'date'
|
7
5
|
|
8
6
|
module Modular
|
@@ -58,10 +56,10 @@ module Modular
|
|
58
56
|
def test
|
59
57
|
template "test/test_helper.rb"
|
60
58
|
template "test/%namespaced_name%_test.rb"
|
61
|
-
append_file "Rakefile", <<-EOF
|
62
|
-
|
63
|
-
|
64
|
-
|
59
|
+
append_file "Rakefile", <<-EOF.gsub(/^\s+\|/, '')
|
60
|
+
|#{rakefile_test_tasks}
|
61
|
+
|
|
62
|
+
|task default: :test
|
65
63
|
EOF
|
66
64
|
if engine?
|
67
65
|
template "test/integration/navigation_test.rb"
|
@@ -115,13 +113,13 @@ module Modular
|
|
115
113
|
alias_method :app_path, :engine_path
|
116
114
|
|
117
115
|
class_option :namespace, type: :string, default: '',
|
118
|
-
desc: 'Add one or more namespace to your modular engine. Ex: namespace1::namespace2'
|
116
|
+
desc: 'Add one or more namespace to your modular engine. Ex: namespace1::namespace2'
|
119
117
|
|
120
118
|
def initialize(*args)
|
121
119
|
super
|
122
120
|
|
123
121
|
unless engine_path
|
124
|
-
raise Error,
|
122
|
+
raise Error, 'Engine name should be provided in arguments. For details run: rails g modular:engine --help'
|
125
123
|
end
|
126
124
|
end
|
127
125
|
|
@@ -196,7 +194,7 @@ module Modular
|
|
196
194
|
end
|
197
195
|
|
198
196
|
def namespaced_name
|
199
|
-
@namespaced_name ||= modules.join('/').
|
197
|
+
@namespaced_name ||= modules.join('/').underscore#name.gsub('-', '/')
|
200
198
|
end
|
201
199
|
|
202
200
|
protected
|
@@ -226,7 +224,7 @@ module Modular
|
|
226
224
|
end
|
227
225
|
|
228
226
|
def engine_loader
|
229
|
-
@engine_loader ||= modules.join('_').
|
227
|
+
@engine_loader ||= modules.join('_').underscore
|
230
228
|
end
|
231
229
|
|
232
230
|
def wrap_in_modules(content)
|
@@ -285,8 +283,8 @@ module Modular
|
|
285
283
|
raise Rails::Generators::Error, "Invalid engine name #{original_name}. Please give a name which does not start with numbers."
|
286
284
|
elsif Rails::Generators::RESERVED_NAMES.include?(name)
|
287
285
|
raise Rails::Generators::Error, "Invalid engine name #{original_name}. Please give a name which does not match one of the reserved rails words."
|
288
|
-
elsif Object.const_defined?(
|
289
|
-
|
286
|
+
elsif Object.const_defined?(modules.first)
|
287
|
+
warn "[WARNING]: Constant #{modules.first} is already defined. Please choose another namespace."
|
290
288
|
end
|
291
289
|
end
|
292
290
|
|
@@ -311,10 +309,10 @@ module Modular
|
|
311
309
|
app_path.sub(/^#{rails_app_path}\//, '')
|
312
310
|
end
|
313
311
|
|
312
|
+
#TODO remove from project or finish it
|
314
313
|
def rakefile_test_tasks
|
315
314
|
''
|
316
315
|
end
|
317
|
-
|
318
316
|
end
|
319
317
|
|
320
318
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: modular_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thibault
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|