diff --git a/.gitignore b/.gitignore index 9a05408..c577914 100644 --- a/.gitignore +++ b/.gitignore @@ -1,32 +1,18 @@ -config/database.yml -log/ -log/* -*.swp -*.swo *~ -tmp/ -tmp/* -.dotest -.dotest/**/* +*.swo +*.swp +.dotest/* .DS_Store -coverage -coverage/**/* +config/database.yml +config/deploy.rb +coverage/* db/data/legacy/log/* db/*.sqlite +db/schema.rb log/* -log/*.log public/stylesheets/scaffold.css -tmp/**/* -public/photo_album_photo_images/ public/photo_album_photo_images/* -public/uploads/*/* -public/themes -public/themes/* -public/themes/*/* +public/uploads/* themes/* -public/themes -public/themes/* -config/deploy.rb -public/ansuz_themes.xml -vendor/gems -vendor/gems/* +tmp/* +vendor/gems/* \ No newline at end of file diff --git a/README.markdown b/README.markdown index adb9160..28b50bc 100644 --- a/README.markdown +++ b/README.markdown @@ -19,11 +19,13 @@ Ansuz is licensed via the BSD license. 1. clone from github: git clone git://github.com/knewter/ansuz.git 2. install gems: sudo rake gems:install - 2. rake ansuz:install + 3. create proper config/database.yml (note: install script supports this, but db script creation is bugged, so should be done externally from the script) + 3. create databases for development & test environments (note: install script is currently bugged for this) + 4. rake ansuz:install NOTE: SQLite has problems with ansuz, please don't use it for now. -NOTE: See the [Ansuz Site Laucher](http://github.com/knewter/ansuz_launcher/tree/master) +NOTE: See the [Ansuz Site Launcher](http://github.com/knewter/ansuz_launcher/tree/master) If run with sudo on a server with passenger set up and all the gems already installed, it will check out a new ansuz and set up a fresh database for it and set up a vhost diff --git a/app/2 b/app/2 deleted file mode 100644 index 181bcfa..0000000 --- a/app/2 +++ /dev/null @@ -1,459 +0,0 @@ -html{ - background-color: #ddd; -} - -body{ - font-family: "Bitstream Vera Sans", Arial, sans-serif; - background-color: #ddd; -} - -h1, h2, h3, h4, h5, h6{ - font-family: Georgia,"Times New Roman",Times,serif; -} - -h1{ - text-align: left; - font-size: 200%; - padding: 10px; -} - -h1.title{ - background-color: #222; - color: white; - font-size: 250%; -} - -h1 a.button2{ - font-family: "Bitstream Vera Sans", Arial, sans-serif; - font-size: 14px; - position: relative; - left: 20px; - top: -5px; -} - -h3{ - font-size: 130%; -} - -em{ - font-weight: 600; -} - -#outside{ - position: relative; -} - -#wrapper{ - position: relative; -} - -#header { - width:100%; - text-align: left; - color: white; - padding: 10px; - height: 40px; -} - -#header h1{ - font-size: 250%; -} - -#toolbar{ - background-color: #ddd; - text-align: left; - position: absolute; - top: 0; - height: 20px; - left: 0; - width: 100%; -} - -#content{ - padding-top: 55px; -} - -#sidebar{ - float: left; - width: 25%; - background-color: #ddd; - text-align: left; -} - -#sidebar h2{ - background-color: #bbb; - padding: 4px; - margin: 4px 0; -} - -#sidebar input.text{ - width: 96%; -} - -#doc2{ - width: 71%; - float: left; - margin-right: 10px; -} - -/* Tabs */ -#hd { - width:100%; - height: 27px; - background: #555; -} - -#hd ul { - float: left; -} - -#hd ul#base-links { - float: right; -} - -#hd ul li { - display:inline; -} - -#hd ul li a, #hd ul li span { - text-decoration: none; - padding: 4px 10px; - background:#555; - color: white; -} - -#hd ul li span { - background:#555; - color: white; -} - -#hd ul li a:hover { - background:#333; -} - -#hd ul li { - text-decoration:none; -} - -#bd { - background:white; - padding:5px; - margin-left: 10px; - border-width: 0 2px 2px 0px; - border-style: solid; - border-color: #aaa; - min-height: 400px; -} - -#bd h1{ - font-size: 200%; - padding: 0; - margin-bottom: 10px; - color: black; -} - -#bd h2{ - font-size: 140%; -} - -label.title_label{ - display: block; -} - -.clear{ clear: both; float: none !important; } - -ul.grid{ - display: block; -} - -ul.grid li.item{ - display: block; - float: left; - width: 214px; - margin-right: 10px; -} - -ul.grid li.item img{ - border: 10px solid #ddd; -} - -ul.grid li.item img:hover { - border: 10px solid #bbb; -} -ul.grid li.item.active img { - border-color: #777; -} -#tree li li:hover { - background-color: #eee; -} - -#admin-menu{ - position: relative; - z-index: 200; - font-size: 1.2em; -} - -#admin-menu li{ - float: left; - position: relative; - width: 150px; - z-index: 100; - margin-right: 20px; -} - -#admin-menu li:hover span{ - background: #333; -} - -#admin-menu li span, #admin-menu li a{ - display: block; - width: 150px; -} -#admin-menu li span{ - cursor: default; -} - -#admin-menu li a span{ - cursor: pointer; -} - -#admin-menu li ul{ - display: none; - padding: 0; - margin: 0; - opacity: .9; -} - -#admin-menu li:hover ul{ - display: block; - background: white; -} - -#admin-menu li ul li a, #admin-menu li ul li span{ - padding: 4px 10px; - border-bottom: 1px solid #333; -} - -#admin-menu li ul li a span, #admin-menu li ul li span span{ - padding: 0; - border: 0; -} - -#admin-menu li span.note{ - margin: 0; - font-size: 75%; - font-style: oblique; - background: transparent; -} - -#admin-menu li li:hover a{ - background-color: #333; -} - -.note{ - margin: 10px 0; - background-color: #ccc; - padding: 10px; -} - -#sidebar > .note:first-child { - margin-top: 0; -} - -#sidebar .form-table th, #sidebar .form-table td{ - border-bottom: 0; -} - -a.button{ - padding: 10px; - color: #444; - text-decoration: none; - width: 200px; - display: block; - font-weight: bold; -} -a.button:hover { - color: black; -} -a.button.icon{ - padding-left: 30px; - width: 180px; - background-repeat: no-repeat; - background-position: 5px 10px; -} -a.button.icon.add{ - background-image: url(/images/famfamfam_icons/add.png) -} -a.button.icon.remove{ - background-image: url(/images/famfamfam_icons/delete.png) -} -a.button.icon.back{ - background-image: url(/images/famfamfam_icons/arrow_left.png) -} -a.button.icon.forward{ - background-image: url(/images/famfamfam_icons/arrow_right.png) -} -a.button.icon.edit{ - background-image: url(/images/famfamfam_icons/pencil.png) -} -a.button.icon.rss{ - background-image: url(/images/famfamfam_icons/rss.png) -} -#tree ul li .page_controls ul.dropdown li{ - float: none; -} - -/* Dropdown menu stuff for 'add page' */ - -div.outerbox{ - font-size: 100%; -} - -div.cmDiv{ - border: 0; -} - -.clickMenu li a{ - margin-right: 0 !important; -} - -.clickMenu li.main{ - font-size: 85%; - padding: 4px; - color: white; - border: 0; -} - -.clickMenu ul{ - border: 0; - background-color: #777; -} - -.clickMenu li.main:hover { - background-color: #444; - cursor: pointer; -} - -.clickMenu li.main li{ - min-width: 120px !important; - padding: 4px; -} - -.clickMenu li.main li a{ - color: white; -} - -li.main ul.innerBox li:hover, .clickMenu li.main ul.innerBox li:hover a { - background-color: #666; -} -.clickMenu li.main ul.innerBox li a{ - display: block; - width: 150px; -} -.clickMenu li.main ul.innerBox li a:hover { - cursor: pointer; -} - -/* End Dropdown menu stuff for 'add page' */ - -.ui-tabs-hide{ display: none; } - - -input.text, textarea{ - font-size: 1.5em; - padding: 4px; - margin-bottom: 1em; -} - -input.button, a.button2{ - background-color: #ccc; - border: 1px solid #aaa; - font-size: 1.2em; - padding: 4px; - text-decoration: none; - color: #333; -} - -input.button:hover, a.button2:hover { - background-color: #bbb; - cursor: pointer; -} -li.clear{ - height: 0 !important; - padding: 0 !important; -} - -#page-plugins-tabs li{ - padding-right:10px; - margin-right:10px; -} -#page-plugins-tabs li.top{ - position: relative; -} -#page-plugins-tabs li.top a.delete{ - position: absolute; - right: 0; - height: 21px; - top: 1px; - cursor: pointer; -} -#page-plugins-tabs li.top a.delete:hover { - background-color: #bbb; -} -#advance_display_options{ - display: none; -} -input, textarea{ - border-style: solid; - border-width: 1px; - border-color: #bbb; -} -input:focus, textarea:focus { - border-color: #888; -} - -.blog-post-form input.title{ - width: 98%; -} -.toggle-content-box{ - margin-bottom: 10px; -} -a.toggle-link{ - padding: 4px; - display: block; - background-color: #555; - color: white; - text-decoration: none; -} -a.toggle-link:hover { - background-color: #444; -} - -#supplemental-nav{ -position:absolute; -top: 0; -right: 0; -} -#supplemental-nav ul li{ -float: left; -margin-right: 20px; -margin-top: 8px; -} -#supplemental-nav ul li a{ -color: white; -text-decoration: none; -padding: 8px 12px; -} -#supplemental-nav ul li a:hover { - background-color: #333; -} -#bd .fullwidth{ - margin: 0 -5px 0 -5px !important; -} -ul.admin_actions li{ - float: left; - padding: 2px 6px; -} -.blog_post p{ - margin-bottom: 1em; -} diff --git a/config/initializers/load_ansuz_task.rb b/config/initializers/load_ansuz_task.rb new file mode 100644 index 0000000..0c5de47 --- /dev/null +++ b/config/initializers/load_ansuz_task.rb @@ -0,0 +1 @@ +#Rake::Task["ansuz:create_db_config"].invoke diff --git a/db/schema.rb b/db/schema.rb deleted file mode 100644 index 9ad7eba..0000000 --- a/db/schema.rb +++ /dev/null @@ -1,351 +0,0 @@ -# This file is auto-generated from the current state of the database. Instead of editing this file, -# please use the migrations feature of Active Record to incrementally modify your database, and -# then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your database schema. If you need -# to create the application database on another system, you should be using db:schema:load, not running -# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 20090125222830) do - - create_table "ansuz_themes", :force => true do |t| - t.string "name" - t.string "repository_url" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "blog_comments", :force => true do |t| - t.string "author" - t.string "email" - t.string "website" - t.text "text" - t.integer "blog_post_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "blog_posts", :force => true do |t| - t.string "title" - t.text "contents" - t.integer "created_by" - t.datetime "created_at" - t.datetime "updated_at" - t.string "url" - t.integer "creator_id" - t.integer "updater_id" - t.integer "deleter_id" - end - - create_table "comments", :force => true do |t| - t.string "name" - t.string "email" - t.string "website" - t.text "comments" - t.string "commentable_type" - t.integer "commentable_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "content_section_versions", :force => true do |t| - t.integer "content_section_id" - t.integer "version" - t.integer "author_id" - t.string "name" - t.text "contents" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "content_sections", :force => true do |t| - t.string "name" - t.text "contents" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "version", :default => 1 - end - - create_table "feed_readers", :force => true do |t| - t.string "name" - end - - add_index "feed_readers", ["name"], :name => "index_feed_readers_on_name" - - create_table "form_builder_responses", :force => true do |t| - t.integer "form_builder_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "form_builders", :force => true do |t| - t.string "name" - t.string "submit_text" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "form_field_responses", :force => true do |t| - t.integer "form_builder_response_id" - t.integer "form_field_id" - t.string "string" - t.boolean "boolean" - t.text "text" - end - - create_table "form_field_text_areas", :force => true do |t| - t.string "label" - end - - create_table "form_field_text_fields", :force => true do |t| - t.string "label" - end - - create_table "form_fields", :force => true do |t| - t.integer "form_builder_id" - t.integer "position" - t.string "field_type" - t.integer "field_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "forums", :force => true do |t| - t.string "name" - t.string "description" - t.integer "topics_count", :default => 0 - t.integer "posts_count", :default => 0 - t.integer "position" - t.text "description_html" - end - - create_table "fyles", :force => true do |t| - t.string "mime_type" - t.string "file_name" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "has_settings_settings", :force => true do |t| - t.text "settings" - t.integer "configurable_id" - 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" - t.integer "position" - t.integer "parent_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "moderatorships", :force => true do |t| - t.integer "forum_id" - t.integer "user_id" - end - - add_index "moderatorships", ["forum_id"], :name => "index_moderatorships_on_forum_id" - - create_table "monitorships", :force => true do |t| - t.integer "topic_id" - t.integer "user_id" - t.boolean "active", :default => true - end - - create_table "page_metadatas", :force => true do |t| - t.integer "page_id" - t.string "title" - t.string "subject" - t.text "description" - t.string "publisher" - t.string "rights" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "page_plugins", :force => true do |t| - t.integer "page_id" - t.string "module_type" - t.integer "module_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "position" - end - - create_table "pages", :force => true do |t| - t.string "name" - t.string "title" - t.string "full_title" - t.text "body" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "page_order", :default => 0 - t.integer "parent_id" - t.string "page_type", :default => "page" - t.boolean "display_title", :default => true - 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 - - add_index "pages", ["publish_at"], :name => "index_pages_on_publish_at" - add_index "pages", ["published"], :name => "index_pages_on_published" - add_index "pages", ["status"], :name => "index_pages_on_status" - - create_table "photo_album_photos", :force => true do |t| - t.integer "photo_album_id" - t.string "title" - t.text "caption" - t.string "photo_album_photo_image_file_name" - t.string "photo_album_photo_image_content_type" - t.integer "photo_album_photo_image_file_size" - end - - create_table "photo_albums", :force => true do |t| - t.string "name" - 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" - t.text "body" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "forum_id" - t.text "body_html" - end - - add_index "posts", ["forum_id", "created_at"], :name => "index_posts_on_forum_id" - add_index "posts", ["topic_id", "created_at"], :name => "index_posts_on_topic_id" - add_index "posts", ["user_id", "created_at"], :name => "index_posts_on_user_id" - - create_table "proto_page_plugins", :force => true do |t| - t.string "name" - t.string "type" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "roles", :force => true do |t| - t.string "name", :limit => 40 - t.string "authorizable_type", :limit => 40 - t.integer "authorizable_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "roles_users", :id => false, :force => true do |t| - t.integer "user_id" - t.integer "role_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "scrollable_content_sections", :force => true do |t| - t.integer "scrollable_content_id" - t.string "title" - t.text "contents" - end - - create_table "scrollable_contents", :force => true do |t| - t.string "name" - end - - create_table "site_settings", :force => true do |t| - t.string "name" - t.string "user_theme_name" - t.datetime "created_at" - t.datetime "updated_at" - t.string "site_title" - t.boolean "show_inline_edit_links", :default => false - t.text "custom_css" - end - - create_table "taggings", :force => true do |t| - t.integer "tag_id" - t.integer "taggable_id" - t.string "taggable_type" - t.integer "user_id" - end - - add_index "taggings", ["tag_id", "taggable_type"], :name => "index_taggings_on_tag_id_and_taggable_type" - add_index "taggings", ["taggable_id", "taggable_type"], :name => "index_taggings_on_taggable_id_and_taggable_type" - add_index "taggings", ["user_id", "tag_id", "taggable_type"], :name => "index_taggings_on_user_id_and_tag_id_and_taggable_type" - add_index "taggings", ["user_id", "taggable_id", "taggable_type"], :name => "index_taggings_on_user_id_and_taggable_id_and_taggable_type" - - create_table "tags", :force => true do |t| - t.string "name" - t.integer "taggings_count", :default => 0, :null => false - end - - add_index "tags", ["name"], :name => "index_tags_on_name" - add_index "tags", ["taggings_count"], :name => "index_tags_on_taggings_count" - - create_table "testimonials", :force => true do |t| - t.text "content" - t.string "attributed_to" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "topics", :force => true do |t| - t.integer "forum_id" - t.integer "user_id" - t.string "title" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "hits", :default => 0 - t.integer "sticky", :default => 0 - t.integer "posts_count", :default => 0 - t.datetime "replied_at" - t.boolean "locked", :default => false - t.integer "replied_by" - t.integer "last_post_id" - end - - add_index "topics", ["forum_id", "replied_at"], :name => "index_topics_on_forum_id_and_replied_at" - add_index "topics", ["forum_id", "sticky", "replied_at"], :name => "index_topics_on_sticky_and_replied_at" - add_index "topics", ["forum_id"], :name => "index_topics_on_forum_id" - - create_table "users", :force => true do |t| - t.string "login" - t.string "email" - t.string "crypted_password", :limit => 40 - t.string "salt", :limit => 40 - t.datetime "created_at" - t.datetime "updated_at" - t.string "remember_token" - t.datetime "remember_token_expires_at" - t.integer "posts_count", :default => 0 - t.datetime "last_seen_at" - t.boolean "admin", :default => false - end - -end diff --git a/lib/ansuz/installer.rb b/lib/ansuz/installer.rb index f851e8b..9ca6285 100644 --- a/lib/ansuz/installer.rb +++ b/lib/ansuz/installer.rb @@ -7,10 +7,11 @@ def initialize(environment = ENV['RAILS_ENV'], stdin = $stdin, stdout = $stdout) @themes = [] @stdin = stdin @stdout = stdout - @state = :started + @state = :started # this helps with the tests end - def choose_theme(theme_directory = File.join(RAILS_ROOT, "public", "themes")) + def choose_theme(theme_directory = File.join(RAILS_ROOT, "themes")) + FileUtils.mkdir_p( theme_directory ) unless File.directory?( theme_directory ) @themes = Dir.entries(theme_directory).select{|d| d =~ /^\w|^\d/}.collect{|theme| theme="- #{theme}"} if( @themes.any? ) @stdout.puts "[ansuz] Themes:\n" + @themes.join("\n") @@ -22,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." @@ -30,7 +35,20 @@ def choose_theme(theme_directory = File.join(RAILS_ROOT, "public", "themes")) end else @state = :no_themes_available - @stdout.puts "[ansuz]No themes available!" + @stdout.puts "[ansuz] No themes available!" + end + end + + def get_user_response_for(question, default_response="") + @state = :getting_user_response + @stdout.puts question + @stdin = rewind(@stdin) + response = @stdin.gets.chomp.strip + @state = :got_user_response + if( response.nil? || response.blank? ) + return default_response + else + return response end end @@ -46,10 +64,9 @@ def get_user_response_for(question, default_response="") def create_db_config(database_yaml_path = File.join(RAILS_ROOT, "config", "database.yml") ) unless( File.exists?( database_yaml_path ) ) - @stdout.puts "[ansuz] Database config does not exist? Would you like one created for you? (Rails will not boot until it has a valid db config)" - @state = :user_wants_database_yaml - response = @stdin.gets.chomp + response = get_user_response_for("[ansuz] Database config does not exist? Would you like one created for you? (Rails will not boot until it has a valid db config)") if( response =~ /^y|^yes/i ) + @state = :user_wants_database_yaml config = { } config["adapter"] = get_user_response_for("[ansuz] Database Wizard: Which adapter will the CMS use? ( mysql, sqlite, etc) ", "mysql").downcase if( config["adapter"] != "sqlite" ) @@ -59,28 +76,10 @@ 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 - database_config = {} - ["production","development","test"].each do |env| - database_config[env] = {} - config.each_pair do |key,val| - case key - when "database": - database_config[env][key] = val + "_" + env - when "location": - database_config[env][key] = val + "/#{env}.sqlite" - else - database_config[env][key] = val - end - end - end - - database_yaml = YAML::dump( database_config ).gsub(/^---/,'') - handle = File.open( File.join(RAILS_ROOT, "config", "database.yml"),"w" ) - handle.puts( database_yaml ) - handle.close + create_config_for_environment(["production","development","test"], config) @state = :database_yaml_created_successfully @stdout.puts "[ansuz] Database configuration created successfully" else @@ -93,15 +92,13 @@ def create_db_config(database_yaml_path = File.join(RAILS_ROOT, "config", "datab def install unless( File.exists?( File.join(RAILS_ROOT, "config", "database.yml") ) ) - @stdout.puts "[ansuz]Please create a config/database.yml file before running this task." - return false + #@stdout.puts "[ansuz] Please create a config/database.yml file before running this task." + #return false + create_db_config end @stdout.puts "[ansuz] Creating database .." Kernel.silence_stream(@stdout) do - # FIXME - # Invoking db tasks causes a rollback of some kind during testing -james - #Rake::Task['db:create:all'].invoke create_database end @@ -115,44 +112,77 @@ def install migrate_plugins end - if( User.find(:all, :conditions => ["login = 'admin'"]).empty? ) - @stdout.puts "[ansuz] Enter a password for the default admin user:" - @stdout.flush - password = @stdin.gets.chomp - u = User.new :login => 'admin', :email => 'admin@example.com', :password => password, :password_confirmation => password - u.save - u.has_role 'admin' - u.save # Not sure why we save twice. Josh? - @stdout.puts "[ansuz] Admin user created with login 'admin' and the password you entered." - else - @stdout.puts "[ansuz] Admin user already exists." - end - # Create public/uploads directory for FCKeditor - unless( File.directory?( File.join(RAILS_ROOT, "public", "uploads") ) ) - @stdout.puts "[ansuz] Creating public/uploads directory for FCKeditor.." - FileUtils.mkdir( File.join(RAILS_ROOT, "public", "uploads") ) + create_fckeditor_uploads_dir + + choose_theme + @state = :installation_complete + end + + protected + + def create_config_for_environment( environments, config ) + @state = :creating_config + database_config = {} + environments.each do |environment| + database_config[environment] = {} + config.each_pair do |key,val| + case key + when "database": + database_config[environment][key] = val + "_" + environment + when "location": + database_config[environment][key] = val + "/#{environment}.sqlite" + else + database_config[environment][key] = val + end + end end - self.choose_theme + database_yaml = YAML::dump( database_config ).gsub(/^---/,'') + handle = File.open( File.join(RAILS_ROOT, "config", "database.yml"),"w" ) + handle.puts( database_yaml ) + handle.close + end - @stdout.puts "[ansuz] Finished! Start Ansuz with `script/server` on Linux or `ruby script/server` on Windows." + def create_default_admin_user(password) + u = User.new :login => 'admin', :email => 'admin@example.com', :password => password, :password_confirmation => password + u.has_role 'admin' + u.save + @stdout.puts "[ansuz] Admin user created with login 'admin' and the password you entered." end + def create_fckeditor_uploads_dir + @state = :creating_fckeditor_uploads_dir + unless( File.directory?( File.join(RAILS_ROOT, "public", "uploads") ) ) + @stdout.puts "[ansuz] Creating public/uploads directory for FCKeditor.." + FileUtils.mkdir_p( File.join(RAILS_ROOT, "public", "uploads") ) + @state = :created_fckeditor_uploads_dir + else + @state = :fckeditor_uploads_dir_already_exists + end + end - end + # FIXME: Somthing is causing this to be currently broken, should be fixed! + def create_database + @state = :creating_databases + system "rake db:create:all" + end - protected - def create_database - system "rake db:create:all" - end + def migrate_database + @state = :migrating_database + system "rake db:migrate" + end - def migrate_database - system "rake db:migrate" - end + def migrate_plugins + @state = :migrating_plugins + system "rake db:migrate:plugins" + end - def migrate_plugins - system "rake db:migrate:plugins" + def rewind(io) + if( io.is_a?(StringIO) ) # In non-test environment, we can't seek through STDIN, it gets rewound for us I suppose -james + io.rewind + end + io + end end - end diff --git a/lib/tasks/ansuz.rake b/lib/tasks/ansuz.rake index 2db355f..a042485 100644 --- a/lib/tasks/ansuz.rake +++ b/lib/tasks/ansuz.rake @@ -1,145 +1,24 @@ require "yaml" +require File.join(File.dirname(__FILE__), "..","ansuz","installer.rb") +@installer = Ansuz::Installer.new namespace :ansuz do desc "Set the CMS theme" task(:choose_theme => :environment) do - themes = Dir.entries( File.join(RAILS_ROOT, "themes")).select{|d| d =~ /^\w|^\d/}.collect{|theme| theme="- #{theme}"} - if( themes.any? ) - STDOUT.puts "[ansuz] Themes:\n" + themes.join("\n") - STDOUT.puts "[ansuz] Enter a selection above, or leave blank for default" - theme_choice = $stdin.gets.chomp - unless( theme_choice.blank? ) - theme = theme_choice.detect{|t| t == theme_choice} - if( theme ) - SiteSetting.find_or_create_by_name(:default).update_attribute(:user_theme_name, theme) - else - STDOUT.puts "[ansuz] invalid theme." - end - end - else - STDOUT.puts "[ansuz] No themes available!" - end - + @installer.choose_theme end # Called at the beginning of the initializer in config/environment.rb before Rails complains about not having a db" desc "Build a basic database.yml" task(:create_db_config) do - unless( File.exists?( File.join(RAILS_ROOT, "config", "database.yml") ) ) - STDOUT.puts "[ansuz] Database config does not exist? Would you like one created for you? (Rails will not boot until it has a valid db config)" - response = $stdin.gets.chomp - if( response =~ /^y|^yes/i ) - config = { } - STDOUT.puts "[ansuz] Database Wizard: Which adapter will the CMS use? ( mysql, sqlite, etc) " - database_adapter = $stdin.gets.chomp.strip - database_adapter = "mysql" if database_adapter.blank? - config["adapter"] = database_adapter.downcase - if( database_adapter != "sqlite" ) - STDOUT.puts "[ansuz] Host (localhost):" - database_host = $stdin.gets.chomp.strip - database_host = "localhost" if database_host.blank? - config["host"] = database_host - - STDOUT.puts "[ansuz] Username (root):" - database_username = $stdin.gets.chomp.strip - database_username = "root" if database_username.blank? - config["user"] = database_username - - STDOUT.puts "[ansuz] Password:" - database_password = $stdin.gets.chomp.strip - database_password = nil if database_password.blank? - config["password"] = database_password - - STDOUT.puts "[ansuz] Socket (/var/run/mysqld/mysqld.sock): " - database_socket = $stdin.gets.chomp.strip - database_socket = "/var/run/mysqld/mysqld.sock" if database_socket.blank? - config["socket"] = database_socket - - STDOUT.puts "[ansuz] Database Name Prefix (ansuz):" - database_prefix = $stdin.gets.chomp.strip - database_prefix = "ansuz" if database_prefix.blank? - config["database"] = database_prefix - else - STDOUT.puts "[ansuz] Database Location (db/development.sqlite):" - database_location = $stdin.gets.chomp.strip - database_location = "db" if database_location.blank? - config["database"] = database_location - end - - database_config = {} - ["production","development","test"].each do |env| - database_config[env] = {} - config.each_pair do |key,val| - case key - when "database": - database_config[env][key] = val + "_" + env - when "location": - database_config[env][key] = val + "/#{env}.sqlite" - else - database_config[env][key] = val - end - end - end - - database_yaml = YAML::dump( database_config ).gsub(/^---/,'') - handle = File.open( File.join(RAILS_ROOT, "config", "database.yml"),"w" ) - handle.puts( database_yaml ) - handle.close - STDOUT.puts "[ansuz] Database configuration created successfully" - end - end + @installer.create_db_config end desc "Run all the necessary tasks to install Ansuz" - task(:install => :environment) do - - unless( File.exists?( File.join(RAILS_ROOT, "config", "database.yml") ) ) - STDOUT.puts "[ansuz]Please create a config/database.yml file before running this task." - return false - end - - STDOUT.puts "[ansuz] Creating database .." - Kernel.silence_stream(STDOUT) do - # FIXME - # Invoking db tasks causes a rollback of some kind during testing -james - #Rake::Task['db:create:all'].invoke - `rake db:create:all` - end - - STDOUT.puts "[ansuz] Migrating tables .." - Kernel.silence_stream(STDOUT) do - #Rake::Task['db:migrate'].invoke - `rake db:migrate` - end - - STDOUT.puts "[ansuz] Migrating plugins .." - Kernel.silence_stream(STDOUT) do - #Rake::Task['db:migrate:plugins'].invoke - `rake db:migrate:plugins` - end - - if( User.find(:all, :conditions => ["login = 'admin'"]).empty? ) - STDOUT.puts "[ansuz] Enter a password for the default admin user:" - STDOUT.flush - password = $stdin.gets.chomp - u = User.new :login => 'admin', :email => 'admin@example.com', :password => password, :password_confirmation => password - u.has_role 'admin' - u.save - STDOUT.puts "[ansuz] Admin user created with login 'admin' and the password you entered." - else - STDOUT.puts "[ansuz] Admin user already exists." - end - - # Create public/uploads directory for FCKeditor - unless( File.directory?( File.join(RAILS_ROOT, "public", "uploads") ) ) - STDOUT.puts "[ansuz] Creating public/uploads directory for FCKeditor.." - FileUtils.mkdir( File.join(RAILS_ROOT, "public", "uploads") ) - else - STDOUT.puts "[ansuz] public/uploads directory for FCKeditor already exists." - end - - Rake::Task["ansuz:choose_theme"].invoke - + task(:install) do + @installer.create_db_config + @installer.install + system("rake utils:create_admin") STDOUT.puts "[ansuz] Finished! Start Ansuz with `script/server` on Linux or `ruby script/server` on Windows." end diff --git a/public/themes/dark_glow/images/bg.gif b/public/themes/dark_glow/images/bg.gif new file mode 100644 index 0000000..6fc5bb3 Binary files /dev/null and b/public/themes/dark_glow/images/bg.gif differ diff --git a/public/themes/dark_glow/images/bg2.gif b/public/themes/dark_glow/images/bg2.gif new file mode 100644 index 0000000..e93980a Binary files /dev/null and b/public/themes/dark_glow/images/bg2.gif differ diff --git a/public/themes/dark_glow/images/rss-128.png b/public/themes/dark_glow/images/rss-128.png new file mode 100644 index 0000000..0894471 Binary files /dev/null and b/public/themes/dark_glow/images/rss-128.png differ diff --git a/public/themes/dark_glow/stylesheets/base.css b/public/themes/dark_glow/stylesheets/base.css new file mode 100644 index 0000000..7fc7786 --- /dev/null +++ b/public/themes/dark_glow/stylesheets/base.css @@ -0,0 +1,259 @@ +/* Layout */ +html{ + background: #333; +} +body{ + background: white url(/themes/dark_glow/images/bg.gif) center top no-repeat; + color: #444; + font-family: Georgia,sans-serif; + font-size: 1.2em; +} +#content_wrapper{ + width: 920px; + margin: 0 auto; + line-height: 145%; +} +#sidebar{ + width:180px; + float:right; +} +#content{ + width: 710px; +} +#sidebar .rss.widget h3{ + margin-bottom: 10px; +} +#sidebar .rss img{ + display: block; + margin: 0 auto; +} +#header h1{ + font-size: 300%; + line-height: 100%; + margin-top: .45em; + margin-bottom: 0; + color: white; +} +#navigation{ + width: 850px; + margin-bottom: 40px; +} +#navigation h3{ + display: none; +} +#navigation li{ + list-style-type: none; + float: left; + width: 140px; + position: relative; + z-index: 80; +} +#navigation li.first a{ + padding-left: 0; +} +#navigation li a, #navigation li.active li a{ + padding: 5px 10px; + display: block; + text-decoration: none; + cursor: pointer; + color: #555; + font-size: 130%; +} +#navigation li.active li a:hover { + cursor: pointer; +} +#navigation li.active a, +#navigation li.active a:hover { + color: white; + cursor: default; +} +#navigation li a:hover { + color: #ddd; +} +#navigation li ul{ + display: none; +} +#navigation li li a{ +} +#navigation li:hover ul{ + display: block; +} +#footerbg{ + background: #333333 url(/themes/dark_glow/images/bg2.gif) no-repeat scroll center top; +} +#footer{ + width: 920px; + margin: 0 auto; + background: #333333 url(/themes/dark_glow/images/bg2.gif) no-repeat scroll center top; +} +/* End Layout */ +/* Utilities */ +.clear{ + clear: both; +} +/* End Utilities */ +/* Blog Posts */ +.blog_post{ + margin-bottom: 40px; + padding-bottom: 40px; + border-bottom: 1px solid #ccc; +} +.blog_post h2{ + margin-bottom: 0; +} +.blog_post h2 a{ + text-decoration: none; + color: black; +} +.blog_post h2 a:hover { + text-decoration: underline; +} +.blog_post h3.supplemental{ + font-size: 75%; + margin-bottom: 10px; +} +/* End Blog Posts */ + +li{ + list-style-type: square; +} + +h1{ font-size: 200%; margin-bottom: 1em; } +h2{ + color: black; + font-size: 150%; + margin-bottom: .75em; +} +h3, h4, h5{ font-size: 125%; margin-bottom: .5em; } +p{ margin-bottom: 10px; } +blockquote{ + font-style: oblique; + border-left: 2px solid #999; + padding: 10px 20px; + background-color: #eee; +} + +#sidebar{ + font-size: 80%; +} + +#sidebar .widget h3{ + padding: 2px 6px; + background-color: #222; + color: white; + margin-bottom: 2px; +} + +#sidebar .widget li{ + list-style-type: none; + margin-bottom: 1px; +} +#sidebar .widget li a{ + display: block; + color: white; + text-decoration: none; + padding: 2px 6px; + background-color: #444; + color: #eee; +} +#sidebar .widget li a:hover { + background-color: #333; + color: white; +} +table.subdued th{ + vertical-align: top; + padding-bottom: 10px; + padding-right: 10px; +} +table.subdued td{ + vertical-align: top; +} +form#new_comment{ + background-color: #ddd; + padding: 10px; + border-top: 6px solid #999; + margin-bottom: 10px; + color: #555; +} +form#new_comment h3{ + color: black; +} +.comments{ + margin-top: 20px; +} +.comments h4{ + float: right; + font-size: 75%; + position: relative; + top: -38px; +} +.comments .comment{ + border-top: 1px solid #bbb; + margin-bottom: 0; +} + +.login-block, .signup-block{ + font-size: 75%; + width: 330px; + height: 400px; + float: left; + padding: 10px; + background-color: #eee; +} +.login-block { + border-right: 1px solid #ccc; + } + +.email-login { + margin: 0 !important; } + +.signup-container { + } + +.signup-block { + } + +p.login-session label { + text-align: right; + display: block; + float: left; + width: 100px; +} +p.login-session input { + margin-left: 15px; + width: 160px; + } +p.login-session input.button { + float: right; + margin-right: 50px; + width: 100px; +} +p.remember-submit{ + float: right; + margin-right: 50px; +} + +p.signup-session label { + text-align: right; + display: block; + float: left; + width: 140px; +} +p.signup-session input { + margin-left: 15px; + width: 140px; +} +p.signup-session input.button { + float: right; + width: 160px; + margin-right: 30px; + } +p.signup-session span.signup-subtext { + margin-left: 195px; } +.hTagcloud a{ + text-decoration: none; + color: #333; +} +.hTagcloud a:hover { + text-decoration: underline; +} diff --git a/public/themes/default-pink/images/background-red-squares-7.png b/public/themes/default-pink/images/background-red-squares-7.png new file mode 100644 index 0000000..eacd33b Binary files /dev/null and b/public/themes/default-pink/images/background-red-squares-7.png differ diff --git a/public/themes/default-pink/javascript/nothing b/public/themes/default-pink/javascript/nothing new file mode 100644 index 0000000..e69de29 diff --git a/public/themes/default-pink/stylesheets/base.css b/public/themes/default-pink/stylesheets/base.css new file mode 100644 index 0000000..ab62f88 --- /dev/null +++ b/public/themes/default-pink/stylesheets/base.css @@ -0,0 +1,129 @@ +html { + background:#000; + color: #ddd; + /* background-image: url(/images/background-blue-squares.png); */ + /* background-image: url(/images/background-blue-squares-2.png); */ + /* background-image: url(/images/background-blue-squares-3.png); */ + /* background-image: url(/images/background-blue-squares-4.png); */ + /* background-image: url(/images/background-blue-squares-5.png); */ + /* background-image: url(/images/background-blue-squares-6.png); */ + /* background-image: url(/images/background-blue-squares-7.png); */ + background-image: url(/themes/default/images/background-red-squares-7.png); + background-repeat: repeat-x; +} +body{ + font-family: "Gill Sans","Franklin Gothic Medium","Lucida Grande",Arial,Helvetica; +} +#main{ + width: 800px; + margin: 0 auto; + position: relative; +} +#header{ + margin-bottom: 10px; +} +#header h1{ + font-size: 260%; + color: #fff; + background-color: #000; + padding: 10px 0; + width: 260px; +} +#header .credits{ + display: block; + background-color: #c2c655; + color: #111; + position: absolute; + top: 0; + left: 500px; + padding: 4px 10px 10px 10px; + line-height: 1.4em; +} +#header .credits a{ + background-color: #868a1f; + padding: 2px; + color: white; +} +#header h1 span.logo{ + padding-left: 20px; + background-image: url(/images/ansuz_logo.png); + background-repeat: no-repeat; + background-position: center; + background-color: #111; + margin-right: 10px; +} +#sidebar{ + width: 200px; + float: left; + margin: 0 10px 0 0; +} +#navigation h3{ + display: none; +} +#navigation li a{ + padding: 5px 10px; + background-color: #111; + color: #ccc; + display: block; + text-decoration: none; +} +#navigation li.active a, +#navigation li.active a:hover { + background-color: #c8379a; + color: white; + cursor: default; +} +#navigation li a:hover { + color: white; + border-left: 4px solid #C8379A; + padding-left: 6px; + background-color: #222; +} +div#breadcrumb{ + background-color: #222; + margin: -10px -10px 5px -10px; + padding: 10px; +} +#content{ + width: 570px; + background-color: #333; + float: left; + padding: 10px; +} +#footer{ + margin-top: 10px; + background-color: #111; + color: #aaa; + padding: 10px; +} +div.clear{ + clear: both; +} +h2{ + font-size: 175%; + color: #C8379A; +} +h3{ + font-size: 120%; + color: #C8379A; + background-color: #111; + padding: 6px 10px; + margin: 20px 0 6px; +} +p{ + margin-bottom: 10px; +} +ol{ + margin-left: 20px; +} +ol li{ + list-style-type: decimal; +} +.module{ + background-color: #333; + color: #ccc; + padding: 10px; +} +a{ + color: #C8379A; +} diff --git a/public/themes/default-pink/stylesheets/tables.css b/public/themes/default-pink/stylesheets/tables.css new file mode 100644 index 0000000..b3e5c2e --- /dev/null +++ b/public/themes/default-pink/stylesheets/tables.css @@ -0,0 +1,139 @@ +form.subdued, +div.subdued{ + background-color: #eee; + padding: 10px; + border: 1px solid #aaa; +} +table.subdued{ + width: 100%; +} +table.subdued thead th{ + background-color: #222; + color: white; + font-weight: normal; + padding: 4px; + border: 0; +} +div.form form table.subdued td{ + vertical-align: top; +} + +table.subdued { + margin: 0; + padding: 0; + font: normal 0.9em tahoma, arial, sans-serif; + line-height: 1.4em; + border-collapse: collapse; + color: #333; + background: #F0F0F0; + margin-bottom: 10px; + } + + + +table.subdued caption { + margin: 0; + height: 32px; + padding: 0; + color: #4F6480; + line-height: 2em; + text-align: left; + font: bold 150% georgia, serif; + text-transform: uppercase; + letter-spacing: 0.14em; + } + +thead { + color: #fff; + background: #5E7796; + } + +thead tr th { + padding: 4px 8px 4px 8px; + border: 0; + } + +hr{ + border: 0; + color: #222; + background-color: #aca883; + height: 1px; +} + + +thead th { + } + +tfoot { + background: #fff; + } + +tfoot tr td, tfoot tr th, tbody tr td { + padding: 4px; + } + +tbody tr { + border-style: solid; + border-color: #bbb; + border-width: 0 0 1px 0; + background: #eee; + } + +tbody th { + background-color: #222; + color: white; + font-weight: normal; + padding: 4px; + border-color: #222; + border-width: 0 4px 0 0; + border-style: solid; + } + +tbody tr th a:link { + font: bold 0.9em tahoma, arial, sans-serif; + color: #5E7796; + text-decoration: underline; + + } + +tbody tr th a:visited { + color: #5E7796; + text-decoration: none; + + } + +tbody tr th a:hover { + color: #5E7796; + text-decoration: none; + + } + +tbody tr th a:active { + color: #5E7796; + text-decoration: line-through; + } + +tbody td a:link { + color: #0084ff; + text-decoration: underline; + } + +tbody td a:visited { + color: #0084ff; + text-decoration: none; + } + +tbody td a:hover { + color: #0084ff; + text-decoration: none; + } + +tbody td a:active { + color: #0084ff; + text-decoration: underline; + } +tbody tr.selected td, +tbody tr.selected:hover td{ + background-color: #2580A2; + color: white; +} diff --git a/public/themes/default/images/background-red-squares-7.png b/public/themes/default/images/background-red-squares-7.png new file mode 100644 index 0000000..eacd33b Binary files /dev/null and b/public/themes/default/images/background-red-squares-7.png differ diff --git a/public/themes/default/javascript/nothing b/public/themes/default/javascript/nothing new file mode 100644 index 0000000..e69de29 diff --git a/public/themes/default/stylesheets/base.css b/public/themes/default/stylesheets/base.css new file mode 100644 index 0000000..469c44c --- /dev/null +++ b/public/themes/default/stylesheets/base.css @@ -0,0 +1,155 @@ +html { + background:#000; + color: #ddd; + /* background-image: url(/images/background-blue-squares.png); */ + /* background-image: url(/images/background-blue-squares-2.png); */ + /* background-image: url(/images/background-blue-squares-3.png); */ + /* background-image: url(/images/background-blue-squares-4.png); */ + /* background-image: url(/images/background-blue-squares-5.png); */ + /* background-image: url(/images/background-blue-squares-6.png); */ + background-image: url(/images/background-blue-squares-7.png); + background-repeat: repeat-x; +} +body{ + font-family: "Gill Sans","Franklin Gothic Medium","Lucida Grande",Arial,Helvetica; +} +#main{ + width: 800px; + margin: 0 auto; + position: relative; +} +#header{ + margin-bottom: 10px; +} +#header h1{ + font-size: 260%; + color: #fff; + background-color: #000; + padding: 10px 0; + width: 260px; +} +#header .credits{ + display: block; + background-color: #c2c655; + color: #111; + position: absolute; + top: 0; + left: 500px; + padding: 4px 10px 10px 10px; + line-height: 1.4em; +} +#header .credits a{ + background-color: #868a1f; + padding: 2px; + color: white; +} +#header h1 span.logo{ + padding-left: 20px; + background-image: url(/images/ansuz_logo.png); + background-repeat: no-repeat; + background-position: center; + background-color: #111; + margin-right: 10px; +} +#sidebar{ + width: 200px; + float: left; + margin: 0 10px 0 0; +} +#navigation h3{ + display: none; +} +#navigation li a{ + padding: 5px 10px; + background-color: #111; + color: #ccc; + display: block; + text-decoration: none; +} +#navigation li.active a, +#navigation li.active a:hover { + background-color: #0084ff; + color: white; + cursor: default; +} +#navigation li a:hover { + color: white; + border-left: 4px solid #0084ff; + padding-left: 6px; + background-color: #222; +} +div#breadcrumb{ + background-color: #222; + margin: -10px -10px 5px -10px; + padding: 10px; +} +#content{ + width: 570px; + background-color: #333; + float: left; + padding: 10px; +} +#footer{ + margin-top: 10px; + background-color: #111; + color: #aaa; + padding: 10px; +} +div.clear{ + clear: both; +} +h2{ + font-size: 175%; + color: #0084ff; +} +h3{ + font-size: 120%; + color: #0084ff; + background-color: #111; + padding: 6px 10px; + margin: 20px 0 6px; +} +p{ + margin-bottom: 10px; +} +ol{ + margin-left: 20px; +} +ol li{ + list-style-type: decimal; +} +.module{ + background-color: #333; + color: #ccc; + padding: 10px; +} +a{ + color: #0084FF; +} +ul.photos.item-list a{ + opacity: .8; +} +ul.photos.item-list a:hover { + opacity: 1; +} +.wide{ + width: 100%; +} +strong{ + font-weight: bold; +} +em{ + font-style: oblique; +} + +.flickr-js-images{ + height: 185px !important; + width: 240px !important; + padding:0; + margin:0; + overflow: hidden; +} + +.flickr-js-images img{ + border: none; +} diff --git a/public/themes/default/stylesheets/tables.css b/public/themes/default/stylesheets/tables.css new file mode 100644 index 0000000..b3e5c2e --- /dev/null +++ b/public/themes/default/stylesheets/tables.css @@ -0,0 +1,139 @@ +form.subdued, +div.subdued{ + background-color: #eee; + padding: 10px; + border: 1px solid #aaa; +} +table.subdued{ + width: 100%; +} +table.subdued thead th{ + background-color: #222; + color: white; + font-weight: normal; + padding: 4px; + border: 0; +} +div.form form table.subdued td{ + vertical-align: top; +} + +table.subdued { + margin: 0; + padding: 0; + font: normal 0.9em tahoma, arial, sans-serif; + line-height: 1.4em; + border-collapse: collapse; + color: #333; + background: #F0F0F0; + margin-bottom: 10px; + } + + + +table.subdued caption { + margin: 0; + height: 32px; + padding: 0; + color: #4F6480; + line-height: 2em; + text-align: left; + font: bold 150% georgia, serif; + text-transform: uppercase; + letter-spacing: 0.14em; + } + +thead { + color: #fff; + background: #5E7796; + } + +thead tr th { + padding: 4px 8px 4px 8px; + border: 0; + } + +hr{ + border: 0; + color: #222; + background-color: #aca883; + height: 1px; +} + + +thead th { + } + +tfoot { + background: #fff; + } + +tfoot tr td, tfoot tr th, tbody tr td { + padding: 4px; + } + +tbody tr { + border-style: solid; + border-color: #bbb; + border-width: 0 0 1px 0; + background: #eee; + } + +tbody th { + background-color: #222; + color: white; + font-weight: normal; + padding: 4px; + border-color: #222; + border-width: 0 4px 0 0; + border-style: solid; + } + +tbody tr th a:link { + font: bold 0.9em tahoma, arial, sans-serif; + color: #5E7796; + text-decoration: underline; + + } + +tbody tr th a:visited { + color: #5E7796; + text-decoration: none; + + } + +tbody tr th a:hover { + color: #5E7796; + text-decoration: none; + + } + +tbody tr th a:active { + color: #5E7796; + text-decoration: line-through; + } + +tbody td a:link { + color: #0084ff; + text-decoration: underline; + } + +tbody td a:visited { + color: #0084ff; + text-decoration: none; + } + +tbody td a:hover { + color: #0084ff; + text-decoration: none; + } + +tbody td a:active { + color: #0084ff; + text-decoration: underline; + } +tbody tr.selected td, +tbody tr.selected:hover td{ + background-color: #2580A2; + color: white; +} diff --git a/public/themes/isotope11/images/bg.png b/public/themes/isotope11/images/bg.png new file mode 100644 index 0000000..51a6f71 Binary files /dev/null and b/public/themes/isotope11/images/bg.png differ diff --git a/public/themes/isotope11/images/bg_y.png b/public/themes/isotope11/images/bg_y.png new file mode 100644 index 0000000..e785d13 Binary files /dev/null and b/public/themes/isotope11/images/bg_y.png differ diff --git a/public/themes/isotope11/images/curved_footer.png b/public/themes/isotope11/images/curved_footer.png new file mode 100644 index 0000000..007fd44 Binary files /dev/null and b/public/themes/isotope11/images/curved_footer.png differ diff --git a/public/themes/isotope11/images/curved_header.png b/public/themes/isotope11/images/curved_header.png new file mode 100644 index 0000000..bd8ee57 Binary files /dev/null and b/public/themes/isotope11/images/curved_header.png differ diff --git a/public/themes/isotope11/images/footer_bg.png b/public/themes/isotope11/images/footer_bg.png new file mode 100644 index 0000000..3091277 Binary files /dev/null and b/public/themes/isotope11/images/footer_bg.png differ diff --git a/public/themes/isotope11/images/logo.png b/public/themes/isotope11/images/logo.png new file mode 100644 index 0000000..c36777f Binary files /dev/null and b/public/themes/isotope11/images/logo.png differ diff --git a/public/themes/isotope11/images/scroll_arrow_left.png b/public/themes/isotope11/images/scroll_arrow_left.png new file mode 100644 index 0000000..0775727 Binary files /dev/null and b/public/themes/isotope11/images/scroll_arrow_left.png differ diff --git a/public/themes/isotope11/images/scroll_arrow_right.png b/public/themes/isotope11/images/scroll_arrow_right.png new file mode 100644 index 0000000..78318f5 Binary files /dev/null and b/public/themes/isotope11/images/scroll_arrow_right.png differ diff --git a/public/themes/isotope11/stylesheets/base.css b/public/themes/isotope11/stylesheets/base.css new file mode 100644 index 0000000..fe2aa4e --- /dev/null +++ b/public/themes/isotope11/stylesheets/base.css @@ -0,0 +1,319 @@ +html{ + background: #5D5A42; +} +body{ + font-family: Arial, Helvetica; + background: #5D5A42; +} +#wrapper{ + background: #ACA883 url(/themes/isotope11/images/bg_y.png) repeat-x scroll 0 0; + color: black; +} +#content_wrapper{ + background: #ACA883 url(/themes/isotope11/images/bg.png) no-repeat scroll 0 0; + width: 920px; + margin: 0 auto; +} +#main{ + width: 850px; + margin: 0 auto; + position: relative; +} +#header{ + margin-bottom: 10px; +} +#header h1{ + background: transparent url(/themes/isotope11/images/logo.png) no-repeat scroll 0 0; + font-size: 260%; + padding: 10px 0; + width: 260px; + color: #002f2f; + height: 81px; + width: 257px; + position: relative; + top: 30px; + left: 4px; +} +#header span.logotext{ + display: none; +} +#header .credits{ + display: block; + background-color: #aca883; + background-color: #666; + color: white; + position: absolute; + top: 0; + right: 0; + padding: 5px 10px; + z-index:81; +} +#header .credits a{ + background-color: #868a1f; + padding: 2px; + color: white; +} +#header h1 span.logo{ +} +#sidebar{ + width: 200px; + float: left; + margin: 0 10px 0 0; +} +#navigation{ + position: absolute; + top: 0; + width: 850px; +} +#navigation h3{ + display: none; +} +#navigation li{ + float: left; + width: 100px; + position: relative; + z-index: 80; +} +#navigation li a, #navigation li.active li a{ + padding: 5px 10px; + background: #dad7b4 none repeat scroll 0 50%; + color: #666; + display: block; + text-decoration: none; + cursor: pointer; +} +#navigation li.active li a:hover { + cursor: pointer; +} +#navigation li.active a, +#navigation li.active a:hover { + background: #aca883 none repeat scroll 0 50%; + color: white; + cursor: default; +} +#navigation li a:hover { + background-color: #d5d1ad; +} +#navigation li ul{ + margin-left: -999999px; +} +#navigation li li a{ +} +#navigation li:hover ul{ + margin-left: -999999px; +} +div#breadcrumb{ + margin: -30px 0 0 70px; + padding: 10px; +} +#content{ + position: relative; + z-index: 79; + min-height: 400px; +} +#footer{ + background: #5D5A42; + color: #efecca; + padding: 10px; + text-align: center; + margin: 10px auto 0 auto; +} +#footer a, #footer a:visited { + color: white; +} +#footer a, #footer a:visited { + color: #efecca; +} +div.clear{ + clear: both; +} +h2{ + font-size: 175%; + color: #559096; + border-bottom: 1px solid #cccccc; +} +h3{ + font-size: 120%; + color: #559096; + margin: 20px 0 6px; +} +p{ + margin-bottom: 10px; +} +ol{ + margin-left: 20px; +} +ol li{ + list-style-type: decimal; +} +.module{ + background-color: #333; + color: #ccc; + padding: 10px; +} +a{ + color: #0084FF; +} +div.curved div.content{ + background-color: white; + padding: 0 10px; + font-size: 200%; + color: #3b7a81; + text-align: center; +} + +div.curved div.content em{ + color: black; +} +div.curved div.content em.love{ + color: red; +} +.twocol .col{ + width: 415px; + float: left; +} +.twocol .col h3{ + font-size: 230%; + color: black; + margin-top: 0; +} +.twocol .col h3 span{ + font-size: 50%; + text-align: left; + color: #5d5a42; +} +.twocol .col:hover h3{ + border-color: black; +} +.twocol .col:hover h3 span{ + color: black; +} +.twocol .left.col{ + margin-right:20px; +} +div.scrollable ul.navi{ + margin: 0; + left: 0; + width:850px; +} +div.items{ + width: 850px; + height: 250px; + background: transparent; + border: none; +} +a.prev, a.next{ + position: absolute; + width: 40px; + height: 100px; + cursor: pointer; + margin-top: 30px; +} +a.prev{ + left: -40px; + background: transparent url(/themes/isotope11/images/scroll_arrow_left.png) repeat scroll 0 0; +} +a.prev:hover { + background: transparent url(/themes/isotope11/images/scroll_arrow_left.png) repeat scroll 0 0; + background-position: 0 100px; +} +a.next{ + right: -40px; + background: transparent url(/themes/isotope11/images/scroll_arrow_right.png) repeat scroll 0 0; +} +a.next:hover { + background: transparent url(/themes/isotope11/images/scroll_arrow_right.png) repeat scroll 0 0; + background-position: 0 100px; +} +ul.navi{ + border: none; +} + +ul.navi li{ + background: transparent; +} +ul.navi a{ + background: transparent; + color: white; + border: 0; + color: #5d5a42; + border-top: 1px solid transparent; +} +ul.navi li.active a{ + background-color: #5d5a42; + color: white; + border-width: 1px 0; + border-top: 1px solid white; +} +ul.navi a:hover { + border-color: transparent; + color: black; +} +ul#top-nav{ + position: relative; + z-index: 80; +} + +.blog_post .curved .contents{ + background-color: white; + padding: 10px; +} + +.blog_post{ + position: relative; + top: 0; + left: 0; +} + +.blog_post h2.title{ + border: 0; + margin-top: -10px; + margin-bottom: 10px; + font-size: 200%; +} + +.blog_post h2.title a{ + color: #559096; +} + +.blog_post h3.time{ + position: absolute; + left: -100px; + top: 0; + width: 80px; + padding: 10px; + background-color: #559096; + color: white; + text-align: right; +} + +#testimonials{ + width: 560px; + height: 60px; + text-align: right; + position: absolute; + right: 0; + top: 50px; + color: #5D5A42; +} + +#testimonials .testimonial{ + width: 560px; + height: 60px; +} + +.testimonial .content{ + font-size: 1.1em; +} +.testimonial .attributed_to{ + font-style: oblique; + color: black; +} +div.note{ + padding: 10px; + background-color: #5D5A42; + color: white; +} +div.note a{ + color: #eee; +} diff --git a/public/themes/knewter/stylesheets/base.css b/public/themes/knewter/stylesheets/base.css new file mode 100644 index 0000000..4d1868f --- /dev/null +++ b/public/themes/knewter/stylesheets/base.css @@ -0,0 +1,101 @@ +/* Layout */ +body{ + background: white; + color: #444; + font-family: Georgia,sans-serif; + font-size: 1.2em; +} +#content_wrapper{ + width: 920px; + margin: 0 auto; + line-height: 145%; +} +#sidebar{ + width:200px; + float:right; +} +#header h1{ + font-size: 300%; + line-height: 100%; + margin-top: .25em; + margin-bottom: 0; +} +#navigation{ + width: 850px; + margin-bottom: 40px; +} +#navigation h3{ + display: none; +} +#navigation li{ + list-style-type: none; + float: left; + width: 100px; + position: relative; + z-index: 80; +} +#navigation li.first a{ + padding-left: 0; +} +#navigation li a, #navigation li.active li a{ + padding: 5px 10px; + display: block; + text-decoration: none; + cursor: pointer; + color: #555; + font-size: 130%; +} +#navigation li.active li a:hover { + cursor: pointer; +} +#navigation li.active a, +#navigation li.active a:hover { + color: black; + cursor: default; +} +#navigation li a:hover { + color: black; +} +#navigation li ul{ + display: none; +} +#navigation li li a{ +} +#navigation li:hover ul{ + display: block; +} +#footer{ + margin-top: 40px; +} +/* End Layout */ +/* Utilities */ +.clear{ + clear: both; +} +/* End Utilities */ +/* Blog Posts */ +.blog_post{ + margin-bottom: 40px; +} +.blog_post h2{ + margin-bottom: 0; +} +.blog_post h3.supplemental{ + font-size: 75%; + margin-bottom: 10px; +} +/* End Blog Posts */ + +li{ + list-style-type: square; +} + +h1{ font-size: 200%; margin-bottom: 1em; } +h2{ + color: black; + font-size: 150%; + margin-bottom: .75em; +} +h3, h4, h5{ font-size: 125%; margin-bottom: .5em; } +p{ margin-bottom: 10px; } +blockquote{ padding: 10px 20px; } diff --git a/public/themes/primeengineering/images/dropshadow_bg.png b/public/themes/primeengineering/images/dropshadow_bg.png new file mode 100644 index 0000000..9876ab0 Binary files /dev/null and b/public/themes/primeengineering/images/dropshadow_bg.png differ diff --git a/public/themes/primeengineering/images/header_bg_1.png b/public/themes/primeengineering/images/header_bg_1.png new file mode 100644 index 0000000..953613d Binary files /dev/null and b/public/themes/primeengineering/images/header_bg_1.png differ diff --git a/public/themes/primeengineering/images/prime_logo.png b/public/themes/primeengineering/images/prime_logo.png new file mode 100644 index 0000000..f15c86d Binary files /dev/null and b/public/themes/primeengineering/images/prime_logo.png differ diff --git a/public/themes/primeengineering/javascript/nothing b/public/themes/primeengineering/javascript/nothing new file mode 100644 index 0000000..e69de29 diff --git a/public/themes/primeengineering/stylesheets/base.css b/public/themes/primeengineering/stylesheets/base.css new file mode 100644 index 0000000..6dfba0f --- /dev/null +++ b/public/themes/primeengineering/stylesheets/base.css @@ -0,0 +1,128 @@ +html, body{ + background-color: #5e0000; + background-image: url(/themes/primeengineering/images/dropshadow_bg.png); + background-repeat: repeat-y; + background-position: center top; +} +#content_wrapper{ + width: 950px; + margin: 0 auto; +} +#header{ + height: 122px; + background-image: url(/themes/primeengineering/images/header_bg_1.png); + background-color: #0f0000; + position: relative; +} +#header h1{ + position: absolute; + left: 15px; + top: 15px; + background-image: url(/themes/primeengineering/images/prime_logo.png); + width: 357px; + height: 90px; +} +#header h1 span{ + display: none; +} +#header h2{ + font-family: Georgia, serif; + font-size: 2em; + left: 354px; + top: 82px; + position: absolute; + color: #ddd; + font-style: oblique; +} +h2{ + font-size: 150%; +} +h3{ + font-size: 130%; +} +#navigation{ + position: absolute; + right: 10px; + top: 12px; +} +#navigation h3{ + display: none; +} +#navigation li{ + float: left; + position: relative; +} +#navigation li a{ + color: #ddd; + text-decoration: none; + margin: 10px; + text-transform: uppercase; + font-size: 125%; +} +#navigation li a:hover { + color: white; +} +#navigation li.active a{ + color: white; + font-weight: bold; +} +#navigation li ul{ + position: absolute; + left: -9999%; +} +#navigation li li a{ +} +#navigation li:hover ul{ + left: auto; +} +#content{ + background-color: white; + min-height: 500px; + padding: 10px; +} +#subfooter{ + background-color: #0f0000; + min-height: 60px; +} +#footer{ + background-color: #270000; + padding: 10px; + min-height: 20px; +} +#footer h3{ + background-color: black; + color: white; + margin: -10px -10px 10px -10px; + padding: 10px; +} +.clear{ + clear: both; +} +.fourcol .col{ + width: 25%; + float: left; + color: #ddd; +} +.fourcol .col .innards{ + padding: 10px; +} +.fourcol .col h4{ + font-weight: 600; + text-transform: uppercase; + color: white; +} +.fourcol .col li{ + margin-bottom: 10px; +} +.imgprin{ + height: 535px; +} +table.form-table tbody th{ + background-color: #ddd; + text-align: right; + padding: 10px; + vertical-align: top; +} +table.form-table tbody td{ + padding: 10px; +} diff --git a/spec/ansuz_installer_spec.rb b/spec/ansuz_installer_spec.rb index 0fcf98b..c86d2c5 100644 --- a/spec/ansuz_installer_spec.rb +++ b/spec/ansuz_installer_spec.rb @@ -3,6 +3,60 @@ # TODO CHECK FOR NO THEMES! describe Ansuz::Installer do + + describe "creating a database.yml" do + before(:each) do + @stdin = StringIO.new("","r+") # Fake STDIN + @stdout = StringIO.new("","r+") + @installer = Ansuz::Installer.new('test', @stdin, @stdout ) + @database_yaml_path = File.join(RAILS_ROOT, "config", "database.yml") + @database_yaml_backup_path = File.join(RAILS_ROOT, "config", "database.yml.bak") + + # Don't destroy the database config!! + if( !File.exists?( @database_yaml_backup_path ) && File.exists?( @database_yaml_path ) ) + FileUtils.cp( @database_yaml_path , @database_yaml_backup_path ) + end + + if( File.exists?( @database_yaml_path ) ) + FileUtils.rm( @database_yaml_path ) + end + end + + it "should not continue if the user enters a newline or anything other than y/yes" do + @stdin.write "banjo\n" + @stdin.rewind + @installer.create_db_config + @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 "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 + end + + after(:each) do + @stdout.truncate(0) + @stdin.close_write + if( File.exists?( @database_yaml_backup_path ) && !File.exists?( @database_yaml_path ) ) + FileUtils.cp( @database_yaml_backup_path , @database_yaml_path ) + end + end + end + describe "choosing a theme" do before(:each) do @stdin = StringIO.new("","r+") # Fake STDIN/STDOUT @@ -14,7 +68,7 @@ end it "should show a list of themes available" do - @stdin.write "a_test_theme\n" # We gotta write and rewind, or the method won't see anything + @stdin.write "a_test_theme\n" @stdin.rewind @installer.choose_theme( @theme_dir ) @@ -43,45 +97,5 @@ FileUtils.rm_r(@theme_dir) end end - - describe "creating a database.yml" do - before(:each) do - @stdin = StringIO.new("","r+") # Fake STDIN - @stdout = StringIO.new("","r+") - @installer = Ansuz::Installer.new('test', @stdin, @stdout ) - @database_yaml_path = File.join(RAILS_ROOT, "config", "database.yml") - @database_yaml_backup_path = File.join(RAILS_ROOT, "config", "database.yml.bak") - - # Don't destroy the database config!! - if( !File.exists?( @database_yaml_backup_path ) && File.exists?( @database_yaml_path ) ) - FileUtils.cp( @database_yaml_path , @database_yaml_backup_path ) - end - - if( File.exists?( @database_yaml_path ) ) - FileUtils.rm( @database_yaml_path ) - end - @stdout.truncate(0) - end - - it "should not continue if the user enters a newline or anything other than y/yes" do - @stdin.write "banjo\n" - @stdin.rewind - @installer.create_db_config - @installer.state.should == :user_doesnt_want_database_yaml - end - - it "should prompt the user if he/she wants a database.yml created for them" do - # @stdin.write "yes\n" - # @stdin.rewind - # @installer.create_db_config - # @installer.state.should == :user_wants_database_yaml - end - - after(:each) do - if( File.exists?( @database_yaml_backup_path ) && !File.exists?( @database_yaml_path ) ) - FileUtils.cp( @database_yaml_backup_path , @database_yaml_path ) - end - end - end end diff --git a/vendor/plugins/has_settings/db/migrate/001_create_has_settings_settings.rb b/vendor/plugins/has_settings/db/migrate/001_create_has_settings_settings.rb new file mode 100644 index 0000000..af03652 --- /dev/null +++ b/vendor/plugins/has_settings/db/migrate/001_create_has_settings_settings.rb @@ -0,0 +1,13 @@ +class CreateHasSettingsSettings < ActiveRecord::Migration + def self.up + create_table :has_settings_settings do |t| + t.text :settings + t.integer :configurable_id + t.string :configurable_type + end + end + + def self.down + drop_table :has_settings_settings + end +end diff --git a/vendor/plugins/has_settings/db/migrate/20081220_create_has_settings_settings.rb b/vendor/plugins/has_settings/db/migrate/20081220_create_has_settings_settings.rb deleted file mode 100644 index 5cf4369..0000000 --- a/vendor/plugins/has_settings/db/migrate/20081220_create_has_settings_settings.rb +++ /dev/null @@ -1,16 +0,0 @@ -class CreateHasSettingsSettings < ActiveRecord::Migration - def self.up - begin - create_table :has_settings_settings do |t| - t.text :settings - t.integer :configurable_id - t.string :configurable_type - end - rescue - end - end - - def self.down - drop_table :has_settings_settings - end -end