rails-app-installer 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@ require 'rails-installer'
6
6
  class AppInstaller < RailsInstaller
7
7
  application_name 'my_shiny_metal_app'
8
8
  support_location 'our shiny website'
9
- rails_version '1.1.4'
9
+ rails_version '1.1.6'
10
10
  end
11
11
 
12
12
  # Installer program
@@ -5,7 +5,7 @@ require 'rails-installer'
5
5
  class TypoInstaller < RailsInstaller
6
6
  application_name 'typo'
7
7
  support_location 'the Typo mailing list'
8
- rails_version '1.1.5'
8
+ rails_version '1.1.6'
9
9
 
10
10
  def install_post_hook
11
11
  sweep_cache
@@ -9,17 +9,30 @@ require 'rails-installer/web-servers'
9
9
  require 'rails-installer/commands'
10
10
 
11
11
  #
12
+ # = Rails Application Installer
12
13
  # An installer for Rails applications.
13
14
  #
14
15
  # The Rails Application Installer is designed to make it easy for end-users to
15
16
  # install open-source Rails apps with a minimum amount of effort. When built
16
17
  # properly, all the user needs to do is run:
17
18
  #
18
- # $ gem install my_app
19
+ # $ sudo gem install my_app
19
20
  # $ my_app install /some/path
20
21
  #
21
- # To use this installer, you'll need to create a small driver program (the
22
- # 'my_app' program from above). Here's a minimal example:
22
+ # Users who need to install your .gem but don't have the right permissions can
23
+ # do this instead:
24
+ #
25
+ # $ export GEM_PATH=~/gems
26
+ # $ gem install -i ~gems my_app
27
+ # $ ~gems/bin/my_app install /some/path
28
+ #
29
+ # == Adding the installer to your application
30
+ #
31
+ # (This example assumes that your program is called 'my_app'. Change this to
32
+ # match your application's actual name)
33
+ #
34
+ # First, create a small driver program and put it into bin/my_app.
35
+ # Here's a minimal example:
23
36
  #
24
37
  # #!/usr/bin/env ruby
25
38
  #
@@ -27,9 +40,9 @@ require 'rails-installer/commands'
27
40
  # require 'rails-installer'
28
41
  #
29
42
  # class AppInstaller < RailsInstaller
30
- # application_name 'my_shiny_metal_app'
43
+ # application_name 'my_app'
31
44
  # support_location 'our shiny website'
32
- # rails_version '1.1.4'
45
+ # rails_version '1.1.6'
33
46
  # end
34
47
  #
35
48
  # # Installer program
@@ -41,9 +54,84 @@ require 'rails-installer/commands'
41
54
  # end
42
55
  # app.execute_command(*ARGV)
43
56
  #
44
- # Place this in your application's gem/ directory, and then add it to your
45
- # .gem using the 'executables' gemspec option. See the examples/ directory for
46
- # more complex examples.
57
+ # This is a simple example; you can extend the installer to add new commands and
58
+ # install steps. See the examples/ directory for more complex examples.
59
+ #
60
+ # Second, you'll need some schema files in db/schema.*.sql. The schema_generator
61
+ # plugin can generate these automatically from your migrations:
62
+ #
63
+ # $ sudo gem install schema_generator
64
+ # $ ./script/generate schemas
65
+ # $ svn add db/schema.*.sql
66
+ # $ svn add db/schema_version
67
+ #
68
+ # Third, build a .gem file. Make sure that it depends on the rails-app-installer
69
+ # GEM. Make sure that the generated schema files and the installer that you put in
70
+ # bin/ are included in your .gem, and the gem knows that bin/my_app is supposed to
71
+ # be executable. Here's an example from Typo's .gemspec. This may be more complex
72
+ # then you need.
73
+ #
74
+ # $:.unshift '../lib'
75
+ # require 'rubygems'
76
+ # require 'rake'
77
+ #
78
+ # spec = Gem::Specification.new do |s|
79
+ # s.name = "typo"
80
+ # s.version = "4.0.2"
81
+ # s.summary = "Modern weblog engine."
82
+ # s.has_rdoc = false
83
+ #
84
+ # s.files = Dir.glob('**/*', File::FNM_DOTMATCH).reject do |f|
85
+ # [ /\.$/, /config\/database.yml$/, /config\/database.yml-/,
86
+ # /database\.sqlite/,
87
+ # /\.log$/, /^pkg/, /\.svn/, /^vendor\/rails/,
88
+ # /^public\/(files|xml|articles|pages|index.html)/,
89
+ # /^public\/(stylesheets|javascripts|images)\/theme/, /\~$/,
90
+ # /\/\._/, /\/#/ ].any? {|regex| f =~ regex }
91
+ # end
92
+ # s.require_path = '.'
93
+ # s.author = "Tobias Luetke"
94
+ # s.email = "tobi@leetsoft.com"
95
+ # s.homepage = "http://www.typosphere.org"
96
+ # s.rubyforge_project = "typo"
97
+ # s.platform = Gem::Platform::RUBY
98
+ # s.executables = ['typo']
99
+ #
100
+ # s.add_dependency("rails", "= 1.1.6")
101
+ # s.add_dependency("rails-app-installer", ">= 0.1.2")
102
+ # end
103
+ #
104
+ # if $0==__FILE__
105
+ # Gem::manage_gems
106
+ # Gem::Builder.new(spec).build
107
+ # end
108
+ #
109
+ # == Using your .gem
110
+ #
111
+ # You can test your new gem by running 'sudo gem install ./my_app-1.0.0.gem'. Once you're
112
+ # happy with it, upload it to Rubyforge and it'll automatically be added to the master
113
+ # gem index.
114
+ #
115
+ # Users should be able to download and install it using the commands at the top of this
116
+ # document.
117
+ #
118
+ # === Non-standard install options
119
+ #
120
+ # By default, the installer uses SQLite3 and Mongrel when installing your app.
121
+ # The user can override this at install time with some flags. Examples:
122
+ #
123
+ # # install using SQLite3 and Mongrel
124
+ # $ my_app install /some/path
125
+ #
126
+ # # install using MySQL and Mongrel
127
+ # $ my_app install /some/path database=mysql db_user=my_app db_name=my_app db_host=localhost db_password=password
128
+ #
129
+ # # install using PostgreSQL and Mongrel
130
+ # $ my_app install /some/path database=postgresql db_user=my_app db_name=my_app db_host=localhost db_password=password
131
+ #
132
+ # # install using SQLite3 and mongrel_cluster
133
+ # $ my_app install /some/path web-server=mongrel_cluster threads=4
134
+ #
47
135
  class RailsInstaller
48
136
  include FileUtils
49
137
  attr_accessor :install_directory, :source_directory, :config
@@ -243,7 +243,7 @@ class RailsInstaller
243
243
  <<: *login
244
244
 
245
245
  test:
246
- database: #{db_name installer}-test
246
+ database: #{db_name installer}_test
247
247
  <<: *login
248
248
  }
249
249
  end
@@ -251,8 +251,10 @@ class RailsInstaller
251
251
  # Create a MySQL database.
252
252
  def self.create_database(installer)
253
253
  installer.message "Creating MySQL database"
254
- system("mysql -u #{db_user installer} -p#{installer.config['db_password']} -e 'create database #{db_name installer}'")
255
- system("mysql -u #{db_user installer} -p#{installer.config['db_password']} -e 'create database #{db_name installer}-test'")
254
+ base_command = "mysql -u #{db_user installer} "
255
+ base_command << "-p#{installer.config['db_password']}" if installer.config['db_password']
256
+ system("#{base_command} -e 'create database #{db_name installer}'")
257
+ system("#{base_command} -e 'create database #{db_name installer}_test'")
256
258
  end
257
259
  end
258
260
  end
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.8.10
3
3
  specification_version: 1
4
4
  name: rails-app-installer
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.3
6
+ version: 0.1.4
7
7
  date: 2006-08-10
8
8
  summary: An installer for Rails apps
9
9
  require_paths: