lathe 0.0.6 → 0.0.7
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.
- data/lib/lathe/generators/mini_app/db/migrate/{%now1%_create_%app_path%_%app_name%_models.rb.tt → %now%_create_%app_path%_%app_name%_models.rb.tt} +0 -0
- data/lib/lathe/generators/mini_app/lib/%app_path%/engine.rb.tt +12 -7
- data/lib/lathe/generators/mini_app/lib/generators/%app_path%/install_generator.rb.tt +5 -1
- data/lib/lathe/generators/mini_app/lib/generators/%app_path%/uninstall_generator.rb.tt +19 -0
- data/lib/lathe/version.rb +1 -1
- metadata +3 -3
- data/lib/lathe/generators/mini_app/db/migrate/%now%_add_type_to_%app_path%.rb.tt +0 -9
File without changes
|
@@ -3,15 +3,20 @@ module <%=package%>
|
|
3
3
|
class Engine < ::Rails::Engine
|
4
4
|
isolate_namespace <%=package%>
|
5
5
|
|
6
|
-
|
7
|
-
|
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
|
-
|
11
|
-
|
12
|
-
|
15
|
+
#这儿的代码在rails加载器都加载完成以后再执行
|
16
|
+
#加载API
|
17
|
+
::API.send "include",<%=package%>::ApiV1<%=app_name.camelize%>
|
13
18
|
|
14
|
-
|
15
|
-
|
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
|
-
|
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
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.
|
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%
|
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
|