Permalink
Browse files

* Rails 2.2.2 -> 2.3.2.

  • Loading branch information...
1 parent 5816489 commit 1a86e83ae654aed0c0e3dcc7c6c374412746d1a0 @kou committed Mar 18, 2009
@@ -43,7 +43,7 @@ def create
respond_to do |format|
if @image.save
flash[:notice] = t('Image was successfully uploaded.')
- format.html { redirect_to(formatted_image_path(@image, :html)) }
+ format.html { redirect_to(image_path(@image, :format => :html)) }
format.xml { render :xml => @image, :status => :created, :location => @image }
else
format.html do
@@ -1,13 +1,20 @@
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
+ def extjs_path(source)
+ compute_public_path(source, "extjs")
+ end
+
+ def tiny_mce_path(source)
+ compute_public_path(source, "tiny_mce")
+ end
+
def extjs_include_tag
tags = [
"resources/css/ext-all.css",
"adapter/prototype/ext-prototype-adapter.js",
"ext-all-debug.js",
].collect do |source|
- tag = ExtjsAssetTagHelper::ExtjsTag.new(@template, @controller, source)
- path = tag.public_path
+ path = extjs_path(source)
case path.sub(/\?.*\z/, '')
when /\.css\z/
stylesheet_link_tag(path)
@@ -22,10 +29,7 @@ def extjs_include_tag
end
def tiny_mce_include_tag
- tag = TinyMceAssetTagHelper::TinyMceTag.new(@template, @controller,
- "tiny_mce_src.js")
- path = tag.public_path
- javascript_include_tag(path)
+ javascript_include_tag(tiny_mce_path("tiny_mce_src.js"))
end
def icon_tag(language)
@@ -78,7 +78,7 @@ Ext.onReady(function() {
// content_css : "css/content.css",
// Drop lists for link/image/media/template dialogs
- external_link_list_url : #{formatted_links_content_path(@content, "js").to_json},
+ external_link_list_url : #{links_content_path(@content, :format => "js").to_json},
image_upload_url: #{images_url.to_json},
@@ -17,8 +17,8 @@
<% @images.each do |image| -%>
<li>
<div class="image-thumbnail">
- <%= link_to_function(image_tag(formatted_thumbnail_image_path(image, :png)),
- "select_image(#{formatted_image_path(image, :png).to_json})") %>
+ <%= link_to_function(image_tag(thumbnail_image_path(image, :format => :png)),
+ "select_image(#{image_path(image, :format => :png).to_json})") %>
</div>
<p>
<%= link_to(t("Destroy"), image,
@@ -1,8 +1,8 @@
<h1><%=h @image.filename %></h1>
<p>
- <%= link_to_function(image_tag(formatted_image_path(@image, :png)),
- "select_image(#{formatted_image_path(@image, :png).to_json})") %>
+ <%= link_to_function(image_tag(image_path(@image, :format => :png)),
+ "select_image(#{image_path(@image, :format => :png).to_json})") %>
</p>
<p>(<%= @image.width %>x<%= @image.height %>)</p>
View
@@ -0,0 +1,7 @@
+# Rack Dispatcher
+
+# Require your environment file to bootstrap Rails
+require ::File.dirname(__FILE__) + '/config/environment'
+
+# Dispatch the request
+run ActionController::Dispatcher.new
View
@@ -44,6 +44,7 @@ class VendorBoot < Boot
def load_initializer
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
Rails::Initializer.run(:install_gem_spec_stubs)
+ Rails::GemDependency.add_frozen_gem_path
end
end
View
@@ -5,7 +5,7 @@
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
-RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION
+RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
@@ -27,7 +27,7 @@
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
# config.gem "sqlite3-ruby", :lib => "sqlite3"
# config.gem "aws-s3", :lib => "aws/s3"
- config.gem "locale_rails"
+ # config.gem "locale_rails"
# Only load the plugins named here, in the order given. By default, all plugins
# in vendor/plugins are loaded in alphabetical order.
@@ -54,6 +54,8 @@
'*', 'rails', 'locale', '*.{rb,yml}')]
config.i18n.load_path = default_locales + config.i18n.load_path
+ config.i18n.default_locale = "ja"
+
locale = ENV["M17N_CMS_LOCALE"]
config.i18n.default_locale = locale if locale
@@ -1,3 +1,3 @@
-I18n.supported_locales = ["ja"]
-I18n.default_locale = "ja"
-Locale.default = "ja"
+# I18n.supported_locales = ["ja"]
+# I18n.default_locale = "ja"
+# Locale.default = "ja"
@@ -1,23 +1,3 @@
module ExtjsAssetTagHelper
EXTJS_DIR = "#{ActionView::Helpers::AssetTagHelper::ASSETS_DIR}/extjs"
-
- module ExtjsAsset
- DIRECTORY = 'extjs'.freeze
-
- def public_directory
- EXJS_DIR
- end
-
- def directory
- DIRECTORY
- end
-
- def extension
- nil
- end
- end
-
- class ExtjsTag < ActionView::Helpers::AssetTag
- include ExtjsAsset
- end
end
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
+
require 'English'
require 'action_controller/test_process'
@@ -61,14 +62,11 @@ def copy_stylesheets
def prepare_objects
DocumentsController.helper(StaticHelper)
DocumentsController.layout("static_documents")
- ActionView::Helpers::AssetTagHelper::AssetTag.module_eval do
- include StaticHelper::AssetPath
- end
end
def generate_document(action)
controller = DocumentsController.new
- request = ActionController::TestRequest.new("lang" => I18n.locale.to_s)
+ request = ActionController::TestRequest.new
request.action = action
response = ActionController::TestResponse.new
controller.process(request, response)
@@ -140,24 +138,10 @@ def documents
end.compact
end
- module AssetPath
- class << self
- def included(base)
- base.class_eval do
- alias_method_chain :compute_public_path, :static
- end
- end
- end
-
- PROTOCOL_REGEXP = ActionView::Helpers::AssetTagHelper::AssetTag::ProtocolRegexp
- def compute_public_path_with_static(source)
- source += ".#{extension}" if missing_extension?(source)
- if PROTOCOL_REGEXP =~ source
- source
- else
- "#{directory}/#{source}"
- end
- end
+ def compute_public_path(source, dir, ext=nil, include_host=true)
+ path = super
+ path = path[1..-1] if path[0] == ?/ and source[0] != ?/
+ path
end
end
end
View
@@ -86,16 +86,13 @@ def copy_stylesheets
def prepare_objects
ContentsController.helper(StaticHelper)
- ActionView::Helpers::AssetTagHelper::AssetTag.module_eval do
- include StaticHelper::AssetPath
- end
end
def generate_content(content)
controller = ContentsController.new
- request = ActionController::TestRequest.new("id" => content.id,
- "lang" => I18n.locale.to_s)
+ request = ActionController::TestRequest.new
request.action = "static"
+ request.path_parameters["id"] = content.id
response = ActionController::TestResponse.new
controller.process(request, response)
@@ -161,24 +158,10 @@ def normalize_a_href(prefix, value)
end
end
- module AssetPath
- class << self
- def included(base)
- base.class_eval do
- alias_method_chain :compute_public_path, :static
- end
- end
- end
-
- PROTOCOL_REGEXP = ActionView::Helpers::AssetTagHelper::AssetTag::ProtocolRegexp
- def compute_public_path_with_static(source)
- source += ".#{extension}" if missing_extension?(source)
- if PROTOCOL_REGEXP =~ source
- source
- else
- "#{directory}/#{source}"
- end
- end
+ def compute_public_path(source, dir, ext=nil, include_host=true)
+ path = super
+ path = path[1..-1] if path[0] == ?/ and source[0] != ?/
+ path
end
end
end
@@ -1,23 +1,3 @@
module TinyMceAssetTagHelper
TINY_MCE_DIR = "#{ActionView::Helpers::AssetTagHelper::ASSETS_DIR}/tiny_mce"
-
- module TinyMceAsset
- DIRECTORY = 'tiny_mce'.freeze
-
- def public_directory
- TINY_MCE_DIR
- end
-
- def directory
- DIRECTORY
- end
-
- def extension
- nil
- end
- end
-
- class TinyMceTag < ActionView::Helpers::AssetTag
- include TinyMceAsset
- end
end
View
@@ -1,4 +1,4 @@
-#!/usr/bin/ruby1.8
+#!/usr/bin/env ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
View
@@ -1,4 +1,4 @@
-#!/usr/bin/ruby1.8
+#!/usr/bin/env ruby
#
# You may specify the path to the FastCGI crash log (a log of unhandled
# exceptions which forced the FastCGI instance to exit, great for debugging)
View
@@ -1,4 +1,4 @@
-#!/usr/bin/ruby1.8
+#!/usr/bin/env ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
@@ -17,8 +17,7 @@ def test_should_create_image
post :create, :image => {:image_file => png("rails.png")}
end
- assert_redirected_to(formatted_image_path(assigns(:image),
- :format => "html"))
+ assert_redirected_to(image_path(assigns(:image), :format => "html"))
end
test "should show image" do
@@ -36,7 +35,7 @@ def test_should_create_image
private
def png(file)
- path = File.join(Test::Unit::TestCase.fixture_path, 'images', file)
+ path = File.join(ActiveSupport::TestCase.fixture_path, 'images', file)
ActionController::TestUploadedFile.new(path, 'image/png', :binary)
end
end
View
@@ -16,7 +16,7 @@
config.mode = :rails
end
-class Test::Unit::TestCase
+class ActiveSupport::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the
# test database remains unchanged so your fixtures don't have to be reloaded
View
@@ -43,12 +43,12 @@ def test_name_validation
page = assert_valid_name(" new_page ")
assert_equal("new_page", page.name)
- assert_not_valid_name(["名前 を入力してください"], "")
- assert_not_valid_name(["名前 が重複しています"], pages(:introduction).name)
- assert_not_valid_name(["名前 にスペースが入っています"], "new page")
- assert_not_valid_name(["名前 に記号が入っています"], "page?")
- assert_not_valid_name(["名前 に記号が入っています"], "/")
- assert_not_valid_name(["名前 に日本語が入っています"], "ページ")
+ assert_not_valid_name(["名前を入力してください"], "")
+ assert_not_valid_name(["名前が重複しています"], pages(:introduction).name)
+ assert_not_valid_name(["名前にスペースが入っています"], "new page")
+ assert_not_valid_name(["名前に記号が入っています"], "page?")
+ assert_not_valid_name(["名前に記号が入っています"], "/")
+ assert_not_valid_name(["名前に日本語が入っています"], "ページ")
end
private
View
@@ -24,13 +24,13 @@ def test_ftp_host_validation
"ftp.example.com")
assert_equal("ftp.example.com", site.ftp_host)
- assert_not_valid_attribute(["FTPホスト にスペースが入っています"],
+ assert_not_valid_attribute(["FTPホストにスペースが入っています"],
:ftp_host,
"example com")
- assert_not_valid_attribute(["FTPホスト に記号が入っています"],
+ assert_not_valid_attribute(["FTPホストに記号が入っています"],
:ftp_host,
"example.com?")
- assert_not_valid_attribute(["FTPホスト に日本語が入っています"],
+ assert_not_valid_attribute(["FTPホストに日本語が入っています"],
:ftp_host,
"あいうえお")
end
@@ -50,13 +50,13 @@ def test_ftp_path_validation
site = assert_valid_attribute(:ftp_path, "/zenkaku")
assert_equal("/zenkaku", site.ftp_path)
- assert_not_valid_attribute(["FTPパス にスペースが入っています"],
+ assert_not_valid_attribute(["FTPパスにスペースが入っています"],
:ftp_path,
"/have space")
- assert_not_valid_attribute(["FTPパス に記号が入っています"],
+ assert_not_valid_attribute(["FTPパスに記号が入っています"],
:ftp_path,
"/path?")
- assert_not_valid_attribute(["FTPパス に日本語が入っています"],
+ assert_not_valid_attribute(["FTPパスに日本語が入っています"],
:ftp_path,
"/パス")
end
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
+
require 'test_helper'
+require 'static_generator'
class StaticGeneratorTest < ActiveSupport::TestCase
include Webrat::Matchers

0 comments on commit 1a86e83

Please sign in to comment.