creategem 0.3.4 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 130a0d4f150ce606650a52b1ceaaa28ceeb4dce8
4
- data.tar.gz: b82c84ebed256de1c6b784eb49b9a24bd185b4bb
3
+ metadata.gz: 6f48209b55ebe08850596c465d39376708202bb7
4
+ data.tar.gz: 9455fd151bc68ad391ad66d21aebef8881dc7e3d
5
5
  SHA512:
6
- metadata.gz: 1d18159df06fb0afe73669c97639922bf7eee66cf4c97fa1943e55a513fa3d0e784d18d7cd688c26188ec85e18a246134d39d8830f22b8e27bfd7bb221a869c1
7
- data.tar.gz: 11d2b9b8acf6e2ec697cb0bcabe67c7e2c5b0dd5c0d130af9bea86f326beaceb2717ed22d222fc0705c05088da2dbcf57ea8ea4240dde9696da8dea98e423e1d
6
+ metadata.gz: 669b165c14e9bbbb8763446bcef82156cc1a7423c6c2e45caeb94de65d041331c0dd59cf42fc5f38cc89ae1c616d7817ce5da5e2528443fe5472d386153fc8c0
7
+ data.tar.gz: 715cbf83173ccf674e108ed7112d63811ba4cfcd0bc6a23accd3751857229ac9d90d22440f9993de67ec1c4274f7641f383bb69242dc625d982cc64542748159
data/lib/creategem/cli.rb CHANGED
@@ -31,11 +31,12 @@ module Creategem
31
31
  option :executable, type: :boolean, default: false, desc: "When true, gem with executable is created"
32
32
  def plugin(gem_name)
33
33
  @plugin = true
34
- @engine = options[:engine]
34
+ @engine = options[:engine] || options[:mountable]
35
35
  @mountable = options[:mountable]
36
36
  create_gem_scaffold(gem_name)
37
37
  create_plugin_scaffold(gem_name)
38
38
  create_engine_scaffold(gem_name)
39
+ create_mountable_scaffold(gem_name)
39
40
  initialize_repository(gem_name)
40
41
  end
41
42
 
@@ -70,6 +71,11 @@ module Creategem
70
71
  directory "engine_scaffold", gem_name
71
72
  end
72
73
 
74
+ def create_mountable_scaffold(gem_name)
75
+ say "Create a rails mountable engine scaffold for gem named: #{gem_name}", :green
76
+ directory "mountable_scaffold", gem_name
77
+ end
78
+
73
79
  def initialize_repository(gem_name)
74
80
  Dir.chdir gem_name do
75
81
  run "chmod +x bin/*"
@@ -1,3 +1,3 @@
1
1
  module Creategem
2
- VERSION = '0.3.4'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -0,0 +1,6 @@
1
+ <% if @mountable -%>
2
+ <%= @class_name %>::Engine.routes.draw do
3
+ <% else -%>
4
+ Rails.application.routes.draw do
5
+ <% end -%>
6
+ end
@@ -1,4 +1,7 @@
1
1
  module <%= @class_name %>
2
2
  class Engine < ::Rails::Engine
3
+ <% if @mountable -%>
4
+ isolate_namespace <%= @class_name %>
5
+ <% end -%>
3
6
  end
4
7
  end
@@ -16,6 +16,9 @@ Minitest.backtrace_filter = Minitest::BacktraceFilter.new
16
16
  <% if @plugin -%>
17
17
  require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
18
18
  ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
19
+ <% if @mountable -%>
20
+ ActiveRecord::Migrator.migrations_paths << File.expand_path('../../db/migrate', __FILE__)
21
+ <% end -%>
19
22
  require "rails/test_help"
20
23
 
21
24
  # Load support files
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,5 @@
1
+ module <%= @class_name %>
2
+ class ApplicationController < ActionController::Base
3
+ protect_from_forgery with: :exception
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ module <%= @class_name %>
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Rplugin</title>
5
+ <%%= stylesheet_link_tag "<%= @gem_name %>/application", media: "all" %>
6
+ <%%= javascript_include_tag "<%= @gem_name %>/application" %>
7
+ <%%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,5 @@
1
+ Rails.application.routes.draw do
2
+ <% if @mountable %>
3
+ mount <%= @class_name %>::Engine => "/<%= @gem_name %>"
4
+ <% end %>
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: creategem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Jancev
@@ -174,7 +174,7 @@ files:
174
174
  - templates/engine_scaffold/app/models/.keep
175
175
  - templates/engine_scaffold/app/views/.keep
176
176
  - templates/engine_scaffold/bin/rails.tt
177
- - templates/engine_scaffold/config/routes.rb
177
+ - templates/engine_scaffold/config/routes.rb.tt
178
178
  - templates/engine_scaffold/lib/%gem_name%/engine.rb.tt
179
179
  - templates/engine_scaffold/test/integration/navigation_test.rb
180
180
  - templates/executable_scaffold/exe/%gem_name%.tt
@@ -195,6 +195,11 @@ files:
195
195
  - templates/gem_scaffold/lib/%gem_name%/version.rb.tt
196
196
  - templates/gem_scaffold/test/%gem_name%_test.rb.tt
197
197
  - templates/gem_scaffold/test/test_helper.rb.tt
198
+ - templates/mountable_scaffold/app/assets/javascripts/%gem_name%/application.js
199
+ - templates/mountable_scaffold/app/assets/stylesheets/%gem_name%/application.css
200
+ - templates/mountable_scaffold/app/controllers/%gem_name%/application_controller.rb.tt
201
+ - templates/mountable_scaffold/app/helpers/%gem_name%/application_helper.rb.tt
202
+ - templates/mountable_scaffold/app/views/layouts/%gem_name%/application.html.erb.tt
198
203
  - templates/plugin_scaffold/lib/tasks/%gem_name%_tasks.rake.tt
199
204
  - templates/plugin_scaffold/test/dummy/README.rdoc
200
205
  - templates/plugin_scaffold/test/dummy/Rakefile
@@ -229,7 +234,7 @@ files:
229
234
  - templates/plugin_scaffold/test/dummy/config/initializers/session_store.rb
230
235
  - templates/plugin_scaffold/test/dummy/config/initializers/wrap_parameters.rb
231
236
  - templates/plugin_scaffold/test/dummy/config/locales/en.yml
232
- - templates/plugin_scaffold/test/dummy/config/routes.rb
237
+ - templates/plugin_scaffold/test/dummy/config/routes.rb.tt
233
238
  - templates/plugin_scaffold/test/dummy/config/secrets.yml
234
239
  - templates/plugin_scaffold/test/dummy/lib/assets/.keep
235
240
  - templates/plugin_scaffold/test/dummy/log/.keep
@@ -1,2 +0,0 @@
1
- Rails.application.routes.draw do
2
- end
@@ -1,56 +0,0 @@
1
- Rails.application.routes.draw do
2
- # The priority is based upon order of creation: first created -> highest priority.
3
- # See how all your routes lay out with "rake routes".
4
-
5
- # You can have the root of your site routed with "root"
6
- # root 'welcome#index'
7
-
8
- # Example of regular route:
9
- # get 'products/:id' => 'catalog#view'
10
-
11
- # Example of named route that can be invoked with purchase_url(id: product.id)
12
- # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
13
-
14
- # Example resource route (maps HTTP verbs to controller actions automatically):
15
- # resources :products
16
-
17
- # Example resource route with options:
18
- # resources :products do
19
- # member do
20
- # get 'short'
21
- # post 'toggle'
22
- # end
23
- #
24
- # collection do
25
- # get 'sold'
26
- # end
27
- # end
28
-
29
- # Example resource route with sub-resources:
30
- # resources :products do
31
- # resources :comments, :sales
32
- # resource :seller
33
- # end
34
-
35
- # Example resource route with more complex sub-resources:
36
- # resources :products do
37
- # resources :comments
38
- # resources :sales do
39
- # get 'recent', on: :collection
40
- # end
41
- # end
42
-
43
- # Example resource route with concerns:
44
- # concern :toggleable do
45
- # post 'toggle'
46
- # end
47
- # resources :posts, concerns: :toggleable
48
- # resources :photos, concerns: :toggleable
49
-
50
- # Example resource route within a namespace:
51
- # namespace :admin do
52
- # # Directs /admin/products/* to Admin::ProductsController
53
- # # (app/controllers/admin/products_controller.rb)
54
- # resources :products
55
- # end
56
- end