amardaxini-enginator 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.
- data/README +3 -1
- data/README.txt +21 -40
- data/Rakefile +1 -1
- data/Readme.rdoc +17 -1
- data/enginator.gemspec +3 -3
- data/rails_generators/USAGE +2 -1
- data/rails_generators/engine_generator.rb +24 -2
- metadata +4 -3
data/README
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= engine_generator
|
2
2
|
|
3
|
-
* http://github.com/amardaxini
|
3
|
+
* http://github.com/amardaxini/enginator
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
@@ -26,5 +26,7 @@ What it Does
|
|
26
26
|
# Copy routes.rb and paste into vendor/plugins/engine/config/routes.rb
|
27
27
|
# Copy migrate folder into vendor/plugins/engine/db/migrate
|
28
28
|
# Making Significant change in migration file thwn paste into mainapp/db/migrate folder
|
29
|
+
# rename application_helper to engine_names_helper
|
30
|
+
# rename application.html.erb to engine_names.html.erb
|
29
31
|
|
30
32
|
|
data/README.txt
CHANGED
@@ -1,48 +1,29 @@
|
|
1
|
-
=
|
1
|
+
= engine_generator
|
2
2
|
|
3
|
-
*
|
3
|
+
* http://github.com/amardaxini/enginator
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
7
|
-
|
7
|
+
Engine Generator is Used for generating a Rails Engine
|
8
|
+
In this engine has separate Database which Does not relate with Main application database
|
8
9
|
|
9
10
|
== FEATURES/PROBLEMS:
|
10
11
|
|
11
|
-
|
12
|
+
While installing application as engine we have to copy several files
|
13
|
+
After copy Engine has one single database but here engine has its own database
|
14
|
+
|
15
|
+
# sudo gem install amardaxini-engine_generator
|
16
|
+
# /script/generate engine engine_name sourcedir:pluggapleapplicationpath
|
17
|
+
# change user_name and password in database.yml
|
18
|
+
# rake db:create:all
|
19
|
+
# rake db:migrate
|
20
|
+
If database is other than mysql change database.yml
|
21
|
+
What it Does
|
22
|
+
# It copies sourcepath/app folder to engine name/app
|
23
|
+
# Add self.connection :#{engine name}_dev to all model
|
24
|
+
# Removing application controller and added engine controller which inherits from main app controller
|
25
|
+
# Remaining Application controller in heri from engine controller
|
26
|
+
# Copy routes.rb and paste into vendor/plugins/engine/config/routes.rb
|
27
|
+
# Copy migrate folder into vendor/plugins/engine/db/migrate
|
28
|
+
# Making Significant change in migration file thwn paste into mainapp/db/migrate folder
|
12
29
|
|
13
|
-
== SYNOPSIS:
|
14
|
-
|
15
|
-
FIX (code sample of usage)
|
16
|
-
|
17
|
-
== REQUIREMENTS:
|
18
|
-
|
19
|
-
* FIX (list of requirements)
|
20
|
-
|
21
|
-
== INSTALL:
|
22
|
-
|
23
|
-
* FIX (sudo gem install, anything else)
|
24
|
-
|
25
|
-
== LICENSE:
|
26
|
-
|
27
|
-
(The MIT License)
|
28
|
-
|
29
|
-
Copyright (c) 2009 FIX
|
30
|
-
|
31
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
32
|
-
a copy of this software and associated documentation files (the
|
33
|
-
'Software'), to deal in the Software without restriction, including
|
34
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
35
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
36
|
-
permit persons to whom the Software is furnished to do so, subject to
|
37
|
-
the following conditions:
|
38
|
-
|
39
|
-
The above copyright notice and this permission notice shall be
|
40
|
-
included in all copies or substantial portions of the Software.
|
41
|
-
|
42
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
43
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
44
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
45
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
46
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
47
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
48
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
data/Readme.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= engine_generator
|
2
2
|
|
3
|
-
* http://github.com/amardaxini
|
3
|
+
* http://github.com/amardaxini/enginator
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
@@ -13,18 +13,34 @@ While installing application as engine we have to copy several files
|
|
13
13
|
After copy Engine has one single database but here engine has its own database
|
14
14
|
|
15
15
|
# sudo gem install amardaxini-engine_generator
|
16
|
+
|
16
17
|
# /script/generate engine engine_name sourcedir:pluggapleapplicationpath
|
18
|
+
|
17
19
|
# change user_name and password in database.yml
|
20
|
+
|
18
21
|
# rake db:create:all
|
22
|
+
|
19
23
|
# rake db:migrate
|
24
|
+
|
20
25
|
If database is other than mysql change database.yml
|
21
26
|
What it Does
|
27
|
+
|
22
28
|
# It copies sourcepath/app folder to engine name/app
|
29
|
+
|
23
30
|
# Add self.connection :#{engine name}_dev to all model
|
31
|
+
|
24
32
|
# Removing application controller and added engine controller which inherits from main app controller
|
33
|
+
|
25
34
|
# Remaining Application controller in heri from engine controller
|
35
|
+
|
26
36
|
# Copy routes.rb and paste into vendor/plugins/engine/config/routes.rb
|
37
|
+
|
27
38
|
# Copy migrate folder into vendor/plugins/engine/db/migrate
|
39
|
+
|
28
40
|
# Making Significant change in migration file thwn paste into mainapp/db/migrate folder
|
29
41
|
|
42
|
+
# rename application_helper to engine_names_helper
|
43
|
+
|
44
|
+
# rename application.html.erb to engine_names.html.erb
|
45
|
+
|
30
46
|
|
data/enginator.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{enginator}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Amar Daxini"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-08-05}
|
10
10
|
s.default_executable = %q{Enginator.rb}
|
11
11
|
s.description = %q{A collection of useful generator scripts for Rails engine.}
|
12
12
|
s.email = %q{amar.daxini (at) gmail (dot) com}
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Enginator", "--main", "README"]
|
18
18
|
s.require_paths = ["lib"]
|
19
19
|
s.rubyforge_project = %q{enginator}
|
20
|
-
s.rubygems_version = %q{1.3.
|
20
|
+
s.rubygems_version = %q{1.3.5}
|
21
21
|
s.summary = %q{A collection of useful generator scripts for Rails engine.}
|
22
22
|
s.test_files = ["test/test_enginator.rb"]
|
23
23
|
|
data/rails_generators/USAGE
CHANGED
@@ -12,8 +12,9 @@ Example:
|
|
12
12
|
2)change user_name and password in database.yml
|
13
13
|
3)rake db:create:all
|
14
14
|
4)rake db:migrate
|
15
|
+
|
15
16
|
If database is other than mysql change database.yml
|
16
|
-
|
17
|
+
if source_dir is not given then copies own app folder
|
17
18
|
The above generator copy your source application app folder to vendor/app/#{engine_name}/app
|
18
19
|
Copy routes.rb
|
19
20
|
Check that route file any map.root or any map.{...} change as needed
|
@@ -98,7 +98,10 @@ class EngineGenerator < Rails::Generator::NamedBase
|
|
98
98
|
# now Change Plugin ApplicationController to #plural_class_name and inhrit from main ApplicationController
|
99
99
|
#prepend line require 'application_controller.rb'
|
100
100
|
change_application_controller_of_engine
|
101
|
-
|
101
|
+
#change application_helper.rb to filename.helper
|
102
|
+
change_application_helper_of_engine
|
103
|
+
#renaming application.html.erb to file_name.html.erb
|
104
|
+
rename_application_html
|
102
105
|
#Added all migration to base migration
|
103
106
|
FileUtils.cp_r(@plugin_path+"/db/migrate/.",'db/migrate')
|
104
107
|
end
|
@@ -191,7 +194,26 @@ class EngineGenerator < Rails::Generator::NamedBase
|
|
191
194
|
File.rename("#{plugin_path}/app/controllers/application_controller.rb","#{plugin_path}/app/controllers/#{plural_name}_controller.rb")
|
192
195
|
end
|
193
196
|
|
194
|
-
|
197
|
+
def change_application_helper_of_engine
|
198
|
+
|
199
|
+
application_content = ""
|
200
|
+
application_helper_file = File.open("#{plugin_path}/app/helpers/application_helper.rb","r")
|
201
|
+
application_helper_file .each do |line|
|
202
|
+
application_content += "#{line} "
|
203
|
+
end
|
204
|
+
app1 = "module #{plural_class_name}"
|
205
|
+
application_content.sub!(/module ApplicationHelper{1}/,"#{app1}")
|
206
|
+
application_helper_file = File.open("#{plugin_path}/app/helpers/application_helper.rb","w")
|
207
|
+
application_helper_file.write(application_content)
|
208
|
+
application_helper_file.close
|
209
|
+
File.rename("#{plugin_path}/app/helpers/application_helper.rb","#{plugin_path}/app/helpers/#{plural_name}_helper.rb")
|
210
|
+
end
|
211
|
+
def rename_application_html
|
212
|
+
file_flag = File.exists?("#{plugin_path}/app/views/layouts/application.html.erb")
|
213
|
+
if file_flag
|
214
|
+
File.rename("#{plugin_path}/app/views/layouts/application.html.erb","#{plugin_path}/app/views/layouts/#{plural_name}.html.erb")
|
215
|
+
end
|
216
|
+
end
|
195
217
|
|
196
218
|
end
|
197
219
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amardaxini-enginator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amar Daxini
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-05 00:00:00 -07:00
|
13
13
|
default_executable: Enginator.rb
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- test/test_enginator.rb
|
55
55
|
has_rdoc: false
|
56
56
|
homepage: ""
|
57
|
+
licenses:
|
57
58
|
post_install_message:
|
58
59
|
rdoc_options:
|
59
60
|
- --line-numbers
|
@@ -79,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
80
|
requirements: []
|
80
81
|
|
81
82
|
rubyforge_project: enginator
|
82
|
-
rubygems_version: 1.
|
83
|
+
rubygems_version: 1.3.5
|
83
84
|
signing_key:
|
84
85
|
specification_version: 3
|
85
86
|
summary: A collection of useful generator scripts for Rails engine.
|