Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

fixed more nastiness in installer. gave up on sqlite being useful.

  • Loading branch information...
James Cook
James Cook committed Jan 30, 2009
1 parent 9f9b5a0 commit 8c0a31046989424ffe5e7dbeb0af0f05bab226ec
Showing with 20 additions and 30 deletions.
  1. +1 −0 .gitignore
  2. +1 −19 db/schema.rb
  3. +11 −6 lib/ansuz/installer.rb
  4. +7 −5 spec/ansuz_installer_spec.rb
@@ -1,4 +1,5 @@
config/database.yml
config/database.yml.bak
log/
log/*
*.swp
@@ -135,19 +135,6 @@
t.string "configurable_type"
end

create_table "media_player_playlist_items", :force => true do |t|
t.integer "media_player_id"
t.string "playlist_item_song_file_name"
t.string "playlist_item_song_content_type"
t.integer "playlist_item_song_file_size"
end

add_index "media_player_playlist_items", ["media_player_id"], :name => "index_media_player_playlist_items_on_media_player_id"

create_table "media_players", :force => true do |t|
t.string "name"
end

create_table "menu_entries", :force => true do |t|
t.string "name"
t.string "link"
@@ -194,6 +181,7 @@
t.string "name"
t.string "title"
t.string "full_title"
t.string "status"
t.text "body"
t.datetime "created_at"
t.datetime "updated_at"
@@ -204,7 +192,6 @@
t.boolean "published", :default => true
t.boolean "linked", :default => true
t.boolean "show_sub_menu", :default => false
t.string "status"
t.datetime "publish_at"
t.datetime "expires_on"
end
@@ -227,11 +214,6 @@
t.string "display_type"
end

create_table "plugin_schema_info", :id => false, :force => true do |t|
t.string "plugin_name"
t.integer "version"
end

create_table "posts", :force => true do |t|
t.integer "user_id"
t.integer "topic_id"
@@ -23,7 +23,11 @@ def choose_theme(theme_directory = File.join(RAILS_ROOT, "public", "themes"))
theme = @themes.detect{|t| t == theme_choice}
if( theme )
@state = :theme_installed
return SiteSetting.find_or_create_by_name(:default).update_attribute(:user_theme_name, theme)
begin
return SiteSetting.find_or_create_by_name(:default).update_attribute(:user_theme_name, theme)
rescue
STDERR.puts "Badness happened trying to set the default theme. SQLite does this a lot."
end
else
@state = :invalid_theme
@stdout.puts "[ansuz] invalid theme."
@@ -62,7 +66,7 @@ def create_db_config(database_yaml_path = File.join(RAILS_ROOT, "config", "datab
config["socket"] = get_user_response_for("[ansuz] Socket (/var/run/mysqld/mysqld.sock): ", "/var/run/mysqld/mysqld.sock")
config["database"] = get_user_response_for("[ansuz] Database Name Prefix (ansuz):", "ansuz")
else
config["database"] = get_user_response_for("[ansuz] Database Location (db/development.sqlite):", "db")
config["database"] = get_user_response_for("[ansuz] Database Location (db/development.sqlite):", "db/")
end

create_config_for_environment(["production","development","test"], config)
@@ -88,16 +92,17 @@ def install
create_database
end

@stdout.puts "[ansuz] Migrating tables .."
@stdout.puts "[ansuz] Migrating plugins .."
Kernel.silence_stream(@stdout) do
migrate_database
migrate_plugins
end

@stdout.puts "[ansuz] Migrating plugins .."
@stdout.puts "[ansuz] Migrating tables .."
Kernel.silence_stream(@stdout) do
migrate_plugins
migrate_database
end


# Create public/uploads directory for FCKeditor
create_fckeditor_uploads_dir

@@ -29,18 +29,20 @@
@installer.state.should == :user_doesnt_want_database_yaml
end

# You may be tempted to use sqlite for tests, but then you'd be in a world of pain. SQLite - is - the - devil
it "should prompt the user if he/she wants a database.yml created for them" do
@stdin.write "y\n"
@installer.create_db_config "pooptown"
@stdin.write "sqlite"
#@stdin.write "localhost"
#@stdin.write "root"
#@stdin.write ""
#@stdin.write "database"
@stdin.write "mysql\n"
@stdin.write "localhost"
@stdin.write "root"
@stdin.write ""
@stdin.write "\n"
@installer.state.should == :database_yaml_created_successfully
end

it "should run all the necessary rake tasks to get ansuz running" do
@stdin.write "y\n"
@installer.install
@installer.state.should == :installation_complete
File.exists?( File.join(RAILS_ROOT, "db", "schema.rb" )).should == true

0 comments on commit 8c0a310

Please sign in to comment.
You can’t perform that action at this time.