matrioshka 0.1.0 → 0.1.1
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.
@@ -16,5 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
17
|
gem.require_paths = ['lib']
|
18
18
|
|
19
|
-
gem.add_dependency 'matrioshka', '>= 0.1.
|
19
|
+
gem.add_dependency 'matrioshka', '>= 0.1.1'
|
20
|
+
|
21
|
+
gem.post_install_message = "Please run `rake <%= application.underscore.gsub('/', '_') %>:link` to finish the installation."
|
20
22
|
end
|
@@ -5,11 +5,20 @@ module <%= application %>
|
|
5
5
|
|
6
6
|
class Engine < ::Rails::Engine
|
7
7
|
initializer 'matrioshka', :before => :set_autoload_paths do |app|
|
8
|
+
|
9
|
+
# Rails
|
8
10
|
app.class.configure do
|
9
11
|
config.i18n.load_path += Dir[<%= application %>::Engine.root.join(*%w(config locales *.{rb,yml})).to_s]
|
10
12
|
config.autoload_paths += %W(#{<%= application %>::Engine.root.join 'lib'})
|
11
13
|
config.paths['db/migrate'] += <%= application %>::Engine.paths['db/migrate'].existent
|
12
14
|
end
|
15
|
+
|
16
|
+
<% if defined?(ActiveAdmin) %>
|
17
|
+
# ActiveAdmin
|
18
|
+
ActiveAdmin.setup do |config|
|
19
|
+
config.load_paths << <%= application %>::Engine.root.join('app/admin')
|
20
|
+
end
|
21
|
+
<% end %>
|
13
22
|
end
|
14
23
|
end
|
15
24
|
end
|
@@ -8,7 +8,9 @@ namespace '<%= application.underscore.gsub('/', '_') %>' do
|
|
8
8
|
if location == Rails.root.to_s
|
9
9
|
puts "This task was successfully registered. Call it from the gem consumer not from the gem itself."
|
10
10
|
else
|
11
|
-
generator.copy_gemfile_from location, '<%= application
|
11
|
+
generator.copy_gemfile_from location, '<%= application %>'
|
12
|
+
generator.prepend_seeds '<%= application %>'
|
13
|
+
generator.run "bundle install"
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
data/lib/matrioshka/generator.rb
CHANGED
@@ -3,16 +3,16 @@ module Matrioshka
|
|
3
3
|
source_root '.'
|
4
4
|
|
5
5
|
def copy_gemfile_from(location, name)
|
6
|
-
copy_file Pathname.new(location).join('Gemfile'), "Gemfile.#{name}"
|
6
|
+
copy_file Pathname.new(location).join('Gemfile'), "Gemfile.#{name.underscore.gsub('/', '-')}"
|
7
7
|
prepend_gemfile name
|
8
|
-
|
9
|
-
inside Rails.root do
|
10
|
-
run "bundle install"
|
11
|
-
end
|
12
8
|
end
|
13
9
|
|
14
10
|
def prepend_gemfile(name)
|
15
|
-
prepend_file 'Gemfile', "eval_gemfile 'Gemfile.#{name}'\n"
|
11
|
+
prepend_file 'Gemfile', "eval_gemfile 'Gemfile.#{name.underscore.gsub('/', '-')}'\n"
|
12
|
+
end
|
13
|
+
|
14
|
+
def prepend_seeds(name)
|
15
|
+
prepend_file 'db/seeds.rb', "load #{name}::Engine.root.join(*%w(db seeds.rb))\n"
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/lib/matrioshka/version.rb
CHANGED