install_generator 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  SPEC = Gem::Specification.new do |spec|
3
3
  spec.name="install_generator"
4
- spec.version="0.0.1"
4
+ spec.version="0.0.2"
5
5
  spec.author="Eugen Minciu"
6
6
  spec.email="minciue@gmail.com"
7
7
  spec.homepage="http://www.tufat.com/oslink.php"
@@ -3,50 +3,51 @@ class InstallGenerator < Rails::Generator::NamedBase
3
3
  record do |m|
4
4
 
5
5
  #Controller
6
- m.template "controllers/install_controller.rb", "app/controllers/#{file_name}_controller.rb", :collision => :ask
6
+ m.template "controllers/install_controller.rb", "app/controllers/#{file_name}_controller.rb"
7
7
 
8
8
  #Models
9
- m.file "models/database.rb", "app/models/database.rb", :collision => :ask
10
- m.file "models/mail_server.rb", "app/models/mail_server.rb", :collision => :ask
11
- m.file "models/site_config.rb", "app/models/site_config.rb", :collision => :ask
9
+ m.file "models/database.rb", "app/models/database.rb"
10
+ m.file "models/mail_server.rb", "app/models/mail_server.rb"
11
+ m.file "models/site_config.rb", "app/models/site_config.rb"
12
12
 
13
13
  #Helpers
14
- m.template "helpers/install_helper.rb", "app/helpers/#{file_name}_helper.rb", :collision => :ask
14
+ m.template "helpers/install_helper.rb", "app/helpers/#{file_name}_helper.rb"
15
15
 
16
16
  #Tests
17
- m.file "test/unit/database_test.rb", "test/unit/database_test.rb", :collision => :ask
18
- m.file "test/unit/mail_server_test.rb", "test/unit/mail_server_test.rb", :collision => :ask
19
- m.file "test/unit/site_config_test.rb", "test/unit/site_config_test.rb", :collision => :ask
17
+ m.file "test/unit/database_test.rb", "test/unit/database_test.rb"
18
+ m.file "test/unit/mail_server_test.rb", "test/unit/mail_server_test.rb"
19
+ m.file "test/unit/site_config_test.rb", "test/unit/site_config_test.rb"
20
20
 
21
21
  #Views
22
22
  m.directory "app/views/#{file_name}"
23
- m.file "views/install/confirm_options.rhtml", "app/views/#{file_name}/confirm_options.rhtml", :collision => :ask
24
- m.file "views/install/config_mail.rhtml", "app/views/#{file_name}/config_mail.rhtml", :collision => :ask
25
- m.file "views/install/select_db.rhtml", "app/views/#{file_name}/select_db.rhtml", :collision => :ask
26
- m.file "views/install/show_authentication_options.rhtml", "app/views/#{file_name}/show_authentication_options.rhtml", :collision => :ask
27
- m.file "views/install/show_db_options.rhtml", "app/views/#{file_name}/show_db_options.rhtml", :collision => :ask
28
- m.file "views/install/welcome.rhtml", "app/views/#{file_name}/welcome.rhtml", :collision => :ask
29
- m.file "views/install/select_language.rhtml", "app/views/#{file_name}/select_language.rhtml", :collision => :ask
30
- m.file "views/install/read_site_settings.rhtml", "app/views/#{file_name}/read_site_settings.rhtml", :collision => :ask
31
- m.file "views/install/save_options.rhtml", "app/views/#{file_name}/save_options.rhtml", :collision => :ask
23
+ m.file "views/install/confirm_options.rhtml", "app/views/#{file_name}/confirm_options.rhtml"
24
+ m.file "views/install/config_mail.rhtml", "app/views/#{file_name}/config_mail.rhtml"
25
+ m.file "views/install/select_db.rhtml", "app/views/#{file_name}/select_db.rhtml"
26
+ m.file "views/install/show_authentication_options.rhtml", "app/views/#{file_name}/show_authentication_options.rhtml"
27
+ m.file "views/install/show_db_options.rhtml", "app/views/#{file_name}/show_db_options.rhtml"
28
+ m.file "views/install/welcome.rhtml", "app/views/#{file_name}/welcome.rhtml"
29
+ m.file "views/install/select_language.rhtml", "app/views/#{file_name}/select_language.rhtml"
30
+ m.file "views/install/read_site_settings.rhtml", "app/views/#{file_name}/read_site_settings.rhtml"
31
+ m.file "views/install/save_options.rhtml", "app/views/#{file_name}/save_options.rhtml"
32
32
 
33
33
  # Partials
34
- m.file "views/install/_db_form.rhtml", "app/views/#{file_name}/_db_form.rhtml", :collision => :ask
35
- m.file "views/install/_mail_form.rhtml", "app/views/#{file_name}/_mail_form.rhtml", :collision => :ask
36
- m.file "views/install/_site_settings_form.rhtml", "app/views/#{file_name}/_site_settings_form.rhtml", :collision => :ask
34
+ m.file "views/install/_db_form.rhtml", "app/views/#{file_name}/_db_form.rhtml"
35
+ m.file "views/install/_mail_form.rhtml", "app/views/#{file_name}/_mail_form.rhtml"
36
+ m.file "views/install/_site_settings_form.rhtml", "app/views/#{file_name}/_site_settings_form.rhtml"
37
37
 
38
38
  #Layouts
39
- m.file "views/layouts/install.rhtml", "app/views/layouts/#{file_name}.rhtml", :collision => :ask
39
+ m.file "views/layouts/install.rhtml", "app/views/layouts/#{file_name}.rhtml"
40
40
 
41
41
  #Languages
42
42
  m.directory "lang"
43
- m.file "lang/en.yml", "lang/en.yml", :collision => :ask
44
- m.file "lang/ro.yml", "lang/ro.yml", :collision => :ask
43
+ m.file "lang/en.yml", "lang/en.yml"
44
+ m.file "lang/ro.yml", "lang/ro.yml"
45
45
 
46
46
  #Extra files
47
- m.file "LICENSE", "doc/LICENSE_FOR_INSTALL_GENERATOR", :collision => :ask
48
- m.file "INSTALL", "doc/INSTALL_FOR_INSTALL_GENERATOR", :collision => :ask
49
- m.file "README", "doc/README_FOR_INSTALL_GENERATOR", :collision => :ask
47
+ m.file "LICENSE", "doc/LICENSE_FOR_INSTALL_GENERATOR"
48
+ m.file "INSTALL", "doc/INSTALL_FOR_INSTALL_GENERATOR"
49
+ m.file "README", "doc/README_FOR_INSTALL_GENERATOR"
50
+ m.file "ChangeLog", "doc/ChangeLog_FOR_INSTALL_GENERATOR"
50
51
 
51
52
  end
52
53
  end
@@ -0,0 +1,10 @@
1
+ install_generator 0.0.2
2
+ * Updated the installation instructions
3
+ * The installer doesn't set up the Settings plugin on its own when you save
4
+ * This was removed to cut down on some time.
5
+ * Added a ChangeLog
6
+ * Fixed a stupid mistake that would redirect you in the wrong place if you didn't agree to the license
7
+ * Fixed a typo in the mail authentication form that caused a valid to fail if
8
+ any authentication besides 'none' was selected.
9
+ * Fixed some typos and bugs that caused the installer not to save properly.
10
+ * Fixed a bug that made the installer unable to save its configuration
@@ -11,12 +11,13 @@ GLoc.set_kcode
11
11
  GLoc.load_localized_strings
12
12
 
13
13
  3) Install the Settings plugin for your Ruby on Rails application
14
- Don't bother to generate the settings migration or migrate the database
15
- That will be done by the installer at the end automatically
14
+ You also have to generate the settings migration or migrate the database
16
15
 
17
16
  $ ruby script/plugin source http://beautifulpixel.textdriven.com/svn/plugins/settings
18
17
  $ ruby script/plugin install settings
18
+ $ ruby script/generate settings_migration
19
+ $ rake db:migrate
19
20
 
20
21
  4) Install the installer generator and add it to your application
21
22
  # gem install --remote install_generator
22
- $ ruby script/generate install
23
+ $ ruby script/generate install Install
@@ -76,16 +76,21 @@ class <%= class_name %>Controller < ApplicationController
76
76
  def confirm_options
77
77
  @back_action = :read_site_settings
78
78
  @forward_action = :save_options
79
+
79
80
  @db = load_db
80
81
  @mail = load_mailserver
81
-
82
82
  @site = load_site_settings
83
+
83
84
  redirect_to_form(:read_site_settings) unless @site.valid?
84
85
  end
85
86
 
86
87
  # Save the configuration options
87
88
  # Databases migrations are automatically performed
88
89
  def save_options
90
+ @db = load_db
91
+ @mail = load_mailserver
92
+ @site=load_site_settings
93
+
89
94
  @db.save
90
95
  @mail.save
91
96
  @site.save
@@ -127,7 +132,7 @@ class <%= class_name %>Controller < ApplicationController
127
132
  def redirect_to_license
128
133
  begin
129
134
  flash[:notice]=l(:must_agree_to_license)
130
- redirect_to :action => 'index'
135
+ redirect_to :action => 'welcome'
131
136
  end unless session[:license_agreed]==true
132
137
  end
133
138
 
@@ -35,7 +35,7 @@ admin_email: Administrator's email
35
35
  admin_password: Administrator's password
36
36
  description: Description
37
37
  site_information: Site information
38
- congratulation_settings_saved: Congratulations, your settings have been sucessfully saved!
38
+ congratulations_settings_saved: Congratulations, your settings have been sucessfully saved!
39
39
  dont_match: Don't Match
40
40
  confirmation_password: Password (confirm)
41
41
  admin_confirmation_password: Administrator's password (confirmation)
@@ -77,6 +77,8 @@ class Database < ActiveRecord::Base
77
77
  @databases['production']=@production
78
78
  # TODO : only have the next line execute if we're in a development environment
79
79
  @databases['development']='production'
80
+ # This should reload the database configuration because neither WEBrick or Mongrel reload the database configuration from 'config/database.yml'
81
+ ActiveRecord::Base.establish_connection(@production)
80
82
 
81
83
  begin
82
84
  File.open(file, 'w') do |out|
@@ -20,8 +20,8 @@ class SiteConfig < ActiveRecord::Base
20
20
 
21
21
  # Save the options. This requires the settings plugin to be installed
22
22
  def save
23
- system("ruby script/generate settings_migration")
24
23
  system("rake db:migrate")
24
+
25
25
  Settings.title=@title
26
26
  Settings.admin_username=@admin_username
27
27
  Settings.admin_name=@admin_name
@@ -6,5 +6,5 @@
6
6
  <%= password_field :mail, :password %><br />
7
7
 
8
8
  <%= l(:confirmation_password) %>:
9
- <%= password_field :mail, :password %><br />
9
+ <%= password_field :mail, :confirmation_password %><br />
10
10
  <% end if (@auth != 'none') -%>
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: install_generator
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.1
7
- date: 2006-07-28 00:00:00 +03:00
6
+ version: 0.0.2
7
+ date: 2006-07-30 00:00:00 +03:00
8
8
  summary: Generates a web-based installer for Ruby on Rails applications
9
9
  require_paths:
10
10
  - .
@@ -30,7 +30,7 @@ authors:
30
30
  - Eugen Minciu
31
31
  files:
32
32
  - ./USAGE
33
- - ./install_generator-0.0.1.gem
33
+ - ./install_generator-0.0.2.gem
34
34
  - ./install_generator.rb
35
35
  - ./install_generator.gemspec
36
36
  - ./templates
@@ -45,6 +45,7 @@ files:
45
45
  - ./templates/models
46
46
  - ./templates/helpers
47
47
  - ./templates/INSTALL
48
+ - ./templates/ChangeLog
48
49
  - ./templates/lang/en.yml
49
50
  - ./templates/lang/ro.yml
50
51
  - ./templates/test/unit