lathe 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,15 +3,20 @@ module <%=package%>
3
3
  class Engine < ::Rails::Engine
4
4
  isolate_namespace <%=package%>
5
5
 
6
- initializer '<%=app_path%>.before' do |app|
7
- #这儿的代码在rails启动是最先执行
6
+ initializer '<%=app_path%>.before' do |app|
7
+ #这儿的代码在rails启动是最先执行
8
+ #加载migrate
9
+ unless app.root.to_s.match root.to_s
10
+ app.config.paths["db/migrate"] += config.paths["db/migrate"].expanded
11
+ end
8
12
  end
13
+
9
14
  initializer '<%=app_path%>.behind', :after=> :disable_dependency_loading do |app|
10
- #这儿的代码在rails加载器都加载完成以后再执行
11
- #加载API
12
- ::API.send "include",<%=package%>::ApiV1<%=app_name.camelize%>
15
+ #这儿的代码在rails加载器都加载完成以后再执行
16
+ #加载API
17
+ ::API.send "include",<%=package%>::ApiV1<%=app_name.camelize%>
13
18
 
14
- MiniApp.apps << {:title=>I18n.t("ft.mini_app.<%=app_name%>.app_text"),:create_url=>'/mini_apps/<%=app_name%>s/new',:icon=> ActionController::Base.helpers.asset_path('<%=app_path%>/<%=app_name%>_white.png')}
15
- end
19
+ MiniApp.apps << {:title=>I18n.t("ft.mini_app.<%=app_name%>.app_text"),:create_url=>'/mini_apps/<%=app_name%>s/new',:icon=> ActionController::Base.helpers.asset_path('<%=app_path%>/<%=app_name%>_white.png')}
20
+ end
16
21
  end
17
22
  end
@@ -24,7 +24,11 @@ module <%=package%>
24
24
  *= require <%=app_path%>/application
25
25
  RUBY
26
26
  end
27
- rake "<%=app_path%>:install:migrations"
27
+
28
+ MiniApp.where(:name=>"<%=app_name%>").delete_all
29
+ num=MiniApp.maximum(:order_number)+10
30
+ mini_app = <%=package%>::Service.new(:name=>"<%=app_name%>", :order_number=>num)
31
+ mini_app.save!
28
32
 
29
33
  readme "README"
30
34
  end
@@ -0,0 +1,19 @@
1
+ module <%=package%>
2
+ module Generators
3
+ class UninstallGenerator < ::Rails::Generators::Base
4
+
5
+ desc "Uninstall <%=package%>."
6
+
7
+ def install
8
+ gsub_file 'config/routes.rb', /\n.*<%=package%>::Engine.*\n\n/, "\n"
9
+ gsub_file 'app/assets/javascripts/application.js', /\n.*<%=app_path%>.*\n/, "\n"
10
+ gsub_file 'app/assets/javascripts/mobile.js', /\n.*<%=app_path%>.*\n/, "\n"
11
+ gsub_file 'app/assets/stylesheets/application.css', /\n.*<%=app_path%>.*\n/, "\n"
12
+ gsub_file 'app/assets/stylesheets/mobile.css', /\n.*<%=app_path%>.*\n/, "\n"
13
+
14
+ MiniApp.where(:name=>"<%=app_name%>").delete_all
15
+
16
+ end
17
+ end
18
+ end
19
+ end
data/lib/lathe/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lathe
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lathe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -71,13 +71,13 @@ files:
71
71
  - lib/lathe/generators/mini_app/config/locales/fontend.en.yml.tt
72
72
  - lib/lathe/generators/mini_app/config/locales/fontend.zh-CN.yml.tt
73
73
  - lib/lathe/generators/mini_app/config/routes.rb.tt
74
- - lib/lathe/generators/mini_app/db/migrate/%now%_add_type_to_%app_path%.rb.tt
75
- - lib/lathe/generators/mini_app/db/migrate/%now1%_create_%app_path%_%app_name%_models.rb.tt
74
+ - lib/lathe/generators/mini_app/db/migrate/%now%_create_%app_path%_%app_name%_models.rb.tt
76
75
  - lib/lathe/generators/mini_app/lib/%app_path%.rb.tt
77
76
  - lib/lathe/generators/mini_app/lib/%app_path%/engine.rb.tt
78
77
  - lib/lathe/generators/mini_app/lib/%app_path%/version.rb.tt
79
78
  - lib/lathe/generators/mini_app/lib/generators/%app_path%/install_generator.rb.tt
80
79
  - lib/lathe/generators/mini_app/lib/generators/%app_path%/templates/README
80
+ - lib/lathe/generators/mini_app/lib/generators/%app_path%/uninstall_generator.rb.tt
81
81
  - lib/lathe/generators/mini_app/lib/tasks/%app_path%_tasks.rake.tt
82
82
  - lib/lathe/string.rb
83
83
  - lib/lathe/version.rb
@@ -1,9 +0,0 @@
1
- class AddTypeTo<%=package%> < ActiveRecord::Migration
2
- def change
3
-
4
- MiniApp.where(:name=>"<%=app_name%>").delete_all
5
- mini_app = <%=package%>::Service.new(:name=>"<%=app_name%>", :order_number=>90)
6
- mini_app.save!
7
-
8
- end
9
- end