diff --git a/Gemfile b/Gemfile index 41c2b515f..b512c3831 100644 --- a/Gemfile +++ b/Gemfile @@ -26,7 +26,7 @@ gem "russian" # gem 'ghoul_grack', '~> 0.0.1' gem 'grack', :git => 'git://github.com/rdblue/grack.git', :require => 'git_http' -gem "grit" +gem "grit", :git => 'git://github.com/mojombo/grit.git', :branch => 'master' gem 'whenever', :require => false gem 'delayed_job' gem 'highline', '~> 1.6.8' diff --git a/Gemfile.lock b/Gemfile.lock index aab3d2d14..100467c52 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,13 @@ +GIT + remote: git://github.com/mojombo/grit.git + revision: 3fc864f3c637e06e2fa7a81f6b48a5df58a9bc5b + branch: master + specs: + grit (2.4.1) + diff-lcs (~> 1.1) + mime-types (~> 1.15) + posix-spawn (~> 0.3.6) + GIT remote: git://github.com/rdblue/grack.git revision: 020be3fef3fb308b9d214252522aa5945bf6584a @@ -35,7 +45,7 @@ GEM activemodel (= 3.0.11) activesupport (= 3.0.11) activesupport (3.0.11) - airbrake (3.0.5) + airbrake (3.0.9) activesupport builder albino (1.3.3) @@ -44,14 +54,14 @@ GEM activerecord (>= 2.2.2) arel (2.0.10) bcrypt-ruby (3.0.1) - bluepill (0.0.51) + bluepill (0.0.52) activesupport (>= 3.0.0) daemons (~> 1.1.0) i18n (>= 0.5.0) - state_machine (~> 0.9.4) + state_machine (~> 1.1.0) builder (2.1.2) cancan (1.6.7) - cape (1.0.1) + cape (1.1.0) capistrano (2.9.0) highline net-scp (>= 1.0.0) @@ -64,11 +74,10 @@ GEM chronic (0.6.6) cocaine (0.2.1) creole (0.4.2) - daemons (1.1.4) - delayed_job (2.1.4) + daemons (1.1.6) + delayed_job (3.0.1) activesupport (~> 3.0) - daemons - devise (1.5.2) + devise (1.5.3) bcrypt-ruby (~> 3.0) orm_adapter (~> 0.0.3) warden (~> 1.1) @@ -91,9 +100,6 @@ GEM redcarpet sanitize (~> 2.0.0) sinatra (~> 1.0) - grit (2.4.1) - diff-lcs (~> 1.1) - mime-types (~> 1.15) haml (3.1.4) haml-rails (0.3.4) actionpack (~> 3.0) @@ -101,14 +107,14 @@ GEM haml (~> 3.0) railties (~> 3.0) hashie (1.2.0) - highline (1.6.8) + highline (1.6.11) hirb (0.6.0) - hpricot (0.8.5) + hpricot (0.8.6) i18n (0.5.0) jammit (0.6.5) yui-compressor (>= 0.9.3) - json (1.6.3) - kgio (2.6.0) + json (1.6.5) + kgio (2.7.2) mail (2.2.19) activesupport (>= 2.3.6) i18n (>= 0.4.0) @@ -122,19 +128,19 @@ GEM net-ssh (>= 1.99.1) net-sftp (2.0.5) net-ssh (>= 2.0.9) - net-ssh (2.2.1) + net-ssh (2.3.0) net-ssh-gateway (1.1.0) net-ssh (>= 1.99.1) newrelic_rpm (3.3.1) nokogiri (1.5.0) - omniauth (1.0.1) + omniauth (1.0.2) hashie (~> 1.2) rack omniauth-openid (1.0.1) omniauth (~> 1.0) rack-openid (~> 1.3.1) - orm_adapter (0.0.5) - paperclip (2.5.0) + orm_adapter (0.0.6) + paperclip (2.5.2) activerecord (>= 2.3.0) activesupport (>= 2.3.2) cocaine (>= 0.0.2) @@ -142,7 +148,7 @@ GEM pg (0.11.0) polyglot (0.3.3) posix-spawn (0.3.6) - rack (1.2.4) + rack (1.2.5) rack-mount (0.6.14) rack (>= 1.0.0) rack-openid (1.3.1) @@ -161,16 +167,18 @@ GEM rails-xmlrpc (0.3.6) rails3-generators (0.17.4) railties (>= 3.0.0) - rails3-jquery-autocomplete (1.0.4) + rails3-jquery-autocomplete (1.0.5) rails (~> 3.0) railties (3.0.11) + actionpack (= 3.0.11) + activesupport (= 3.0.11) rake (>= 0.8.7) rdoc (~> 3.4) thor (~> 0.14.4) raindrops (0.8.0) rake (0.9.2.2) rdiscount (1.6.8) - rdoc (3.11) + rdoc (3.12) json (~> 1.4) redcarpet (1.17.2) rr (1.0.4) @@ -197,12 +205,12 @@ GEM schema_plus (0.2.1) rails valuable - sexp_processor (3.0.8) + sexp_processor (3.0.10) silent-postgres (0.1.1) - sinatra (1.2.7) + sinatra (1.2.8) rack (~> 1.1) tilt (>= 1.2.2, < 2.0) - state_machine (0.9.4) + state_machine (1.1.2) thor (0.14.6) tilt (1.3.3) treetop (1.4.10) @@ -217,7 +225,7 @@ GEM warden (1.1.0) rack (>= 1.0) web-app-theme (0.7.0) - whenever (0.7.0) + whenever (0.7.2) activesupport (>= 2.3.4) chronic (~> 0.6.3) wikicloth (0.7.1) @@ -245,7 +253,7 @@ DEPENDENCIES factory_girl_rails (~> 1.4.0) gollum (= 1.3.1) grack! - grit + grit! haml-rails (~> 0.3.4) highline (~> 1.6.8) hirb diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 956b7983e..c216cd3db 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- #require 'lib/gollum' require 'cgi' @@ -35,7 +36,7 @@ class WikiController < ApplicationController @name = CGI.unescape(params[:id]) if page = @wiki.page(@name) @page = page - @content = page.raw_data + @content = page.raw_data.force_encoding(Encoding::UTF_8) render :edit else render :new @@ -68,7 +69,7 @@ class WikiController < ApplicationController format = params['format'].intern begin - @wiki.write_page(@name, format, params['content'], commit) + @wiki.write_page(@name, format, params['content'] || '', commit) redirect_to project_wiki_path(@project, CGI.escape(@name)) rescue Gollum::DuplicatePageError => e flash[:error] = t("flash.wiki.duplicate_page", :name => @name) @@ -250,7 +251,6 @@ class WikiController < ApplicationController def show_or_create_page if @page - puts @page.format @content = @page.formatted_data @editable = can?(:write, @project) render :show diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb index 12a1212af..f90913a2f 100644 --- a/app/helpers/wiki_helper.rb +++ b/app/helpers/wiki_helper.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- module WikiHelper def revert_path(project, first, second, name) diff --git a/app/views/wiki/_editor.html.haml b/app/views/wiki/_editor.html.haml index dce1567e9..fed194b16 100644 --- a/app/views/wiki/_editor.html.haml +++ b/app/views/wiki/_editor.html.haml @@ -18,7 +18,7 @@ %span= t("layout.wiki.expand_collapse") %h4 Footer - = text_area_tag :footer, footer.raw_data, :id => "gollum-editor-footer" + = text_area_tag :footer, footer.raw_data.force_encoding(Encoding::UTF_8), :id => "gollum-editor-footer" - if has_sidebar? #gollum-editor-edit-sidebar.collapsed @@ -26,7 +26,7 @@ %span= t("layout.wiki.expand_collapse") %h4 Sidebar - = text_area_tag :sidebar, sidebar.raw_data, :id => "gollum-editor-sidebar" + = text_area_tag :sidebar, sidebar.raw_data.force_encoding(Encoding::UTF_8), :id => "gollum-editor-sidebar" #gollum-editor-edit-summary.singleline = label_tag :message, t("layout.wiki.edit_commit_message"), :class => "jaws" diff --git a/config/environment.rb b/config/environment.rb index 0a6cad37f..521243091 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -2,5 +2,7 @@ # Load the rails application require File.expand_path('../application', __FILE__) +Encoding.default_external = Encoding::UTF_8 +Encoding.default_internal = Encoding::UTF_8 # Initialize the rails application Rosa::Application.initialize! diff --git a/db/migrate/20111221120208_add_has_wiki_to_projects.rb b/db/migrate/20111221120208_add_has_wiki_to_projects.rb index 8e411afd1..b944a6310 100644 --- a/db/migrate/20111221120208_add_has_wiki_to_projects.rb +++ b/db/migrate/20111221120208_add_has_wiki_to_projects.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- class AddHasWikiToProjects < ActiveRecord::Migration def self.up add_column :projects, :has_wiki, :boolean, :default => false diff --git a/db/migrate/20120126214421_add_projects_count_to_users.rb b/db/migrate/20120126214421_add_projects_count_to_users.rb index 7ec5c436c..89f9c1608 100644 --- a/db/migrate/20120126214421_add_projects_count_to_users.rb +++ b/db/migrate/20120126214421_add_projects_count_to_users.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- class AddProjectsCountToUsers < ActiveRecord::Migration def self.up add_column :users, :own_projects_count, :integer, :default => 0, :null => false diff --git a/db/migrate/20120126214447_add_projects_count_to_groups.rb b/db/migrate/20120126214447_add_projects_count_to_groups.rb index ed65a68ef..a76472633 100644 --- a/db/migrate/20120126214447_add_projects_count_to_groups.rb +++ b/db/migrate/20120126214447_add_projects_count_to_groups.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- class AddProjectsCountToGroups < ActiveRecord::Migration def self.up add_column :groups, :own_projects_count, :integer, :default => 0, :null => false diff --git a/db/schema.rb b/db/schema.rb deleted file mode 100644 index 7b685c7aa..000000000 --- a/db/schema.rb +++ /dev/null @@ -1,367 +0,0 @@ -# encoding: UTF-8 -# 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 => 20120127234602) do - - create_table "arches", :id => false, :force => true do |t| - t.integer "id", :null => false - t.string "name", :null => false - t.datetime "created_at" - t.datetime "updated_at" - t.index ["name"], :name => "index_arches_on_name", :unique => true - end - - create_table "authentications", :id => false, :force => true do |t| - t.integer "id", :null => false - t.integer "user_id" - t.string "provider" - t.string "uid" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["provider", "uid"], :name => "index_authentications_on_provider_and_uid", :unique => true - t.index ["user_id"], :name => "index_authentications_on_user_id" - end - - create_table "auto_build_lists", :id => false, :force => true do |t| - t.integer "id", :null => false - t.integer "project_id" - t.integer "arch_id" - t.integer "pl_id" - t.integer "bpl_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "build_list_items", :id => false, :force => true do |t| - t.integer "id", :null => false - t.string "name" - t.integer "level" - t.integer "status" - t.integer "build_list_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "version" - t.index ["build_list_id"], :name => "index_build_list_items_on_build_list_id" - end - - create_table "build_lists", :id => false, :force => true do |t| - t.integer "id", :null => false - t.integer "bs_id" - t.string "container_path" - t.integer "status" - t.string "project_version" - t.integer "project_id" - t.integer "arch_id" - t.datetime "notified_at" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "is_circle", :limit => 2 - t.text "additional_repos" - t.string "name" - t.integer "build_requires", :limit => 2 - t.string "update_type" - t.integer "bpl_id" - t.integer "pl_id" - t.text "include_repos" - t.integer "user_id" - t.integer "auto_publish", :limit => 2 - t.string "package_version" - t.string "commit_hash" - t.index ["arch_id"], :name => "index_build_lists_on_arch_id" - t.index ["bs_id"], :name => "index_build_lists_on_bs_id", :unique => true - t.index ["project_id"], :name => "index_build_lists_on_project_id" - end - - create_table "categories", :id => false, :force => true do |t| - t.integer "id", :null => false - t.string "name" - t.string "ancestry" - t.integer "projects_count", :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "comments", :id => false, :force => true do |t| - t.integer "id", :null => false - t.string "commentable_id" - t.string "commentable_type" - t.integer "user_id" - t.text "body" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "containers", :id => false, :force => true do |t| - t.integer "id", :null => false - t.string "name", :null => false - t.integer "project_id", :null => false - t.integer "owner_id", :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "delayed_jobs", :id => false, :force => true do |t| - t.integer "id", :null => false - t.integer "priority" - t.integer "attempts" - t.text "handler" - t.text "last_error" - t.datetime "run_at" - t.datetime "locked_at" - t.datetime "failed_at" - t.string "locked_by" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["priority", "run_at"], :name => "delayed_jobs_priority" - end - - create_table "downloads", :id => false, :force => true do |t| - t.integer "id", :null => false - t.string "name", :null => false - t.string "version" - t.string "distro" - t.string "platform" - t.integer "counter" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "event_logs", :id => false, :force => true do |t| - t.integer "id", :null => false - t.integer "user_id" - t.string "user_name" - t.integer "object_id" - t.string "object_type" - t.string "object_name" - t.string "ip" - t.string "kind" - t.string "protocol" - t.string "controller" - t.string "action" - t.text "message" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "groups", :id => false, :force => true do |t| - t.integer "id", :null => false - t.string "name" - t.integer "owner_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "uname" - t.integer "own_projects_count", :null => false - end - - create_table "issues", :id => false, :force => true do |t| - t.integer "id", :null => false - t.integer "serial_id" - t.integer "project_id" - t.integer "user_id" - t.string "title" - t.text "body" - t.string "status" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["project_id", "serial_id"], :name => "index_issues_on_project_id_and_serial_id", :unique => true - end - - create_table "platforms", :id => false, :force => true do |t| - t.integer "id", :null => false - t.string "description" - t.string "name" - t.integer "parent_platform_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "released", :limit => 2 - t.integer "owner_id" - t.string "owner_type" - t.string "visibility" - t.string "platform_type" - t.string "distrib_type" - end - - create_table "private_users", :id => false, :force => true do |t| - t.integer "id", :null => false - t.integer "platform_id" - t.string "login" - t.string "password" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "user_id" - end - - create_table "product_build_lists", :id => false, :force => true do |t| - t.integer "id", :null => false - t.integer "product_id" - t.integer "status", :null => false - t.datetime "notified_at" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["product_id"], :name => "index_product_build_lists_on_product_id" - end - - create_table "products", :id => false, :force => true do |t| - t.integer "id", :null => false - t.string "name", :null => false - t.integer "platform_id", :null => false - t.integer "build_status", :null => false - t.string "build_path" - t.datetime "created_at" - t.datetime "updated_at" - t.text "build_script" - t.text "counter" - t.text "ks" - t.text "menu" - t.string "tar_file_name" - t.string "tar_content_type" - t.integer "tar_file_size" - t.datetime "tar_updated_at" - t.integer "is_template", :limit => 2 - t.integer "system_wide", :limit => 2 - t.text "cron_tab" - t.integer "use_cron", :limit => 2 - end - - create_table "project_imports", :id => false, :force => true do |t| - t.integer "id", :null => false - t.integer "project_id" - t.string "name" - t.string "version" - t.datetime "file_mtime" - t.datetime "created_at" - t.datetime "updated_at" - t.index ["name"], :name => "index_project_imports_on_name", :unique => true - t.index ["project_id"], :name => "index_project_imports_on_project_id" - end - - create_table "project_to_repositories", :id => false, :force => true do |t| - t.integer "id", :null => false - t.integer "project_id" - t.integer "repository_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "projects", :id => false, :force => true do |t| - t.integer "id", :null => false - t.string "name" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "owner_id" - t.string "owner_type" - t.string "visibility" - t.integer "category_id" - t.text "description" - t.string "ancestry" - t.integer "has_wiki", :limit => 2 - t.integer "has_issues", :limit => 2 - t.integer "srpm_file_size" - t.string "srpm_file_name" - t.string "srpm_content_type" - t.datetime "srpm_updated_at" - t.index ["category_id"], :name => "index_projects_on_category_id" - t.index ["name", "owner_id", "owner_type"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true - end - - create_table "relations", :id => false, :force => true do |t| - t.integer "id", :null => false - t.integer "object_id" - t.string "object_type" - t.integer "target_id" - t.string "target_type" - t.datetime "created_at" - t.datetime "updated_at" - t.string "role" - end - - create_table "repositories", :id => false, :force => true do |t| - t.integer "id", :null => false - t.string "description", :null => false - t.integer "platform_id", :null => false - t.datetime "created_at" - t.datetime "updated_at" - t.string "name", :null => false - t.integer "owner_id" - t.string "owner_type" - end - - create_table "role_lines", :id => false, :force => true do |t| - t.integer "id", :null => false - t.integer "role_id" - t.integer "relation_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "roles", :id => false, :force => true do |t| - t.integer "id", :null => false - t.string "name" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "rpms", :id => false, :force => true do |t| - t.integer "id", :null => false - t.string "name", :null => false - t.integer "arch_id", :null => false - t.integer "project_id", :null => false - t.datetime "created_at" - t.datetime "updated_at" - t.index ["project_id"], :name => "index_rpms_on_project_id" - t.index ["project_id", "arch_id"], :name => "index_rpms_on_project_id_and_arch_id" - end - - create_table "settings_notifiers", :id => false, :force => true do |t| - t.integer "id", :null => false - t.integer "user_id", :null => false - t.integer "can_notify", :limit => 2 - t.integer "new_comment", :limit => 2 - t.integer "new_comment_reply", :limit => 2 - t.integer "new_issue", :limit => 2 - t.integer "issue_assign", :limit => 2 - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "subscribes", :id => false, :force => true do |t| - t.integer "id", :null => false - t.integer "subscribeable_id" - t.string "subscribeable_type" - t.integer "user_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "users", :id => false, :force => true do |t| - t.integer "id", :null => false - t.string "name" - t.string "email", :null => false - t.string "encrypted_password", :limit => 128, :null => false - t.string "password_salt", :null => false - t.string "reset_password_token" - t.string "remember_token" - t.datetime "remember_created_at" - t.datetime "created_at" - t.datetime "updated_at" - t.text "ssh_key" - t.string "uname" - t.string "role" - t.integer "own_projects_count", :null => false - t.string "language" - t.index ["email"], :name => "index_users_on_email", :unique => true - t.index ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true - t.index ["uname"], :name => "index_users_on_uname", :unique => true - end - -end diff --git a/spec/controllers/wiki_controller_spec.rb b/spec/controllers/wiki_controller_spec.rb index 50fc9fe5b..c2297dc15 100644 --- a/spec/controllers/wiki_controller_spec.rb +++ b/spec/controllers/wiki_controller_spec.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- require 'spec_helper' describe WikiController do diff --git a/spec/helpers/wiki_helper_spec.rb b/spec/helpers/wiki_helper_spec.rb index 349ca45f7..014e60bf5 100644 --- a/spec/helpers/wiki_helper_spec.rb +++ b/spec/helpers/wiki_helper_spec.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- require 'spec_helper' # Specs in this file have access to a helper object that includes