Skip to content
Browse files

Trabajando en el build con Ruby 1.9

Sólo me falta por resolver este problema (que por otro lado tiene muy
mala pinta):

ruby-1.9.2-head > /caña/
 => /caña/
ruby-1.9.2-head > /caña\//
 => /ca\u00F1a\//

Cuando la expresión regular tiene un slash (convenientemente escapado) la expresión regular deja de machearme eñes, tildes y demás. :(
  • Loading branch information...
1 parent e2971fd commit 8d8b263d5cd49648fcb1621f56faf2a239803943 @nando committed Jan 28, 2011
View
2 .rvmrc
@@ -0,0 +1,2 @@
+rvm use ruby-1.9.2-head
+rvm gemset use rails2
View
8 Rakefile
@@ -61,3 +61,11 @@ if ENV['BUILDING_NEWGEM']
]
end
end
+
+# Build env with ruby 1.9 / rails 2.3
+# -----------------------------------
+# gem install rails --version '< 3'
+# gem install rspec-rails --version '< 2'
+# gem install rubigen sqlite3 webrat capybara cucumber-rails database_cleaner
+# gem install test-unit --version '< 2'
+# gem install ruby-debug19 -- --with-ruby-include=/home/nando/.rvm/src/ruby-1.9.2-head/
View
36 features/step_definitions/en_US.rb
@@ -23,42 +23,6 @@
/^sprinklers?$/i => Sprinkler,
/^lettuces?$/i => Lettuce
}
-
-#config.field_mappings = {
-# /^[Ááa]reas?$/i => :area,
-# /^color(es)?$/i => :color,
-# /^latitud(es)?$/i => :latitude,
-# /^longitud(es)?/i => :length,
-# /^pesos?/i => :weight,
-# /^di[áa]metros?/i => :diameter,
-# /^matas?$/i => :plants,
-# /^variedad(es)?$/i => :variety,
-# /^campos? de texto/i => :text_field,
-# /^[áa]reas? de texto/i => :textarea,
-# /^tipos? de cultivos?/i => :orchard_type,
-# /^nacionalidad/i => :nationality,
-# /^fichero adjunto/i => :file_field,
-# /^casilla seleccionada/i => :selected_check,
-# /^casilla sin seleccionar/i => :unselected_check,
-# /^Orchard::longitud(es)?$/ => :longitude,
-# /^cultivad[oa]$/ => :cultivated,
-# /^caudal(es)?$/i => :flow,
-# /^unidad(es)? caudal(es)?$/i => :flow_units,
-# /^estaci[oó]n(es)?$/i => :season,
-# /^huerto de nacimiento$/i => :orchard_of_birth,
-# /^hora de comenzar a regar$/i => :start_watering,
-# /^hora de terminar de regar$/i => :stop_watering,
-# /^precio$/i => :price
-#}
-#
-#config.relation_model_mappings = {
-# /^orchard_of_birth$/i => Orchard
-#}
-#
-#config.url_mappings.merge!(
-# /^la página de registro/i => '/welcome/signup'
-#)
-#
end
Before do
View
4 features/step_definitions/rails_generators_steps.rb
@@ -42,13 +42,13 @@
Then /^I should see '([^\']*)'$/ do |text|
actual_output = File.read(@stdout)
- actual_output.should contain(text)
+ actual_output.should =~ /#{Regexp.escape(text)}/
end
Then /^I should see '([^\']*)' in (.+)$/ do |text, path|
in_project_folder do
content = File.read(path)
- content.should contain(text)
+ content.should =~ /#{Regexp.escape(text)}/
end
end
View
2 features/support/app/app/controllers/flowers_controller.rb
@@ -86,7 +86,7 @@ def destroy
private
def session_required
if session[:id].nil?
- flash[:alert] = "Debes iniciar sesión para mandar flores"
+ flash[:alert] = "Please, login first"
redirect_to new_session_path
end
end
View
2 features/support/app/app/controllers/orchards_controller.rb
@@ -18,7 +18,7 @@ def new
def create
@orchard = Orchard.new(params[:orchard])
if @orchard.save
- flash[:notice] = 'Huerto creado con éxito.'
+ flash[:notice] = 'The orchard was successfully created.'
redirect_to @orchard
else
render :action => "new"
View
4 features/support/app/config/environment.rb
@@ -5,11 +5,12 @@
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
-RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
+#RAILS_GEM_VERSION = '2.3.10' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
+
Rails::Initializer.run do |config|
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
@@ -74,4 +75,3 @@
# Please note that observers generated using script/generate observer need to have an _observer suffix
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
end
-
View
14 features/support/app/config/initializers/transliterate.rb
@@ -0,0 +1,14 @@
+# http://stackoverflow.com/questions/2135247/ruby-1-9-doesnt-support-unicode-normalization-yet
+module ActiveSupport
+ module Inflector
+ # Calling String#parameterize prints a warning under Ruby 1.9,
+ # even if the data in the string doesn't need transliterating.
+ if Rails.version =~ /^2\.3/
+ undef_method :transliterate
+ def transliterate(string)
+ string.dup
+ end
+ end
+ end
+end
+
View
42 features/support/app/config/locales/es.yml
@@ -56,43 +56,43 @@ es:
half_a_minute: "medio minuto"
less_than_x_seconds:
one: "menos de 1 segundo"
- other: "menos de {{count}} segundos"
+ other: "menos de %{count} segundos"
x_seconds:
one: "1 segundo"
- other: "{{count}} segundos"
+ other: "%{count} segundos"
less_than_x_minutes:
one: "menos de 1 minuto"
- other: "menos de {{count}} minutos"
+ other: "menos de %{count} minutos"
x_minutes:
one: "1 minuto"
- other: "{{count}} minutos"
+ other: "%{count} minutos"
about_x_hours:
one: "alrededor de 1 hora"
- other: "alrededor de {{count}} horas"
+ other: "alrededor de %{count} horas"
x_days:
one: "1 día"
- other: "{{count}} días"
+ other: "%{count} días"
about_x_months:
one: "alrededor de 1 mes"
- other: "alrededor de {{count}} meses"
+ other: "alrededor de %{count} meses"
x_months:
one: "1 mes"
- other: "{{count}} meses"
+ other: "%{count} meses"
about_x_years:
one: "alrededor de 1 año"
- other: "alrededor de {{count}} años"
+ other: "alrededor de %{count} años"
over_x_years:
one: "más de 1 año"
- other: "más de {{count}} años"
+ other: "más de %{count} años"
activerecord:
models:
orchard: 'Huerto'
errors:
template:
header:
- one: "no se pudo guardar este {{model}} porque se encontró 1 error"
- other: "no se pudo guardar este {{model}} porque se encontraron {{count}} errores"
+ one: "no se pudo guardar este %{model} porque se encontró 1 error"
+ other: "no se pudo guardar este %{model} porque se encontraron %{count} errores"
# The variable :count is also available
body: "Se encontraron problemas con los siguientes campos:"
# The values :model, :attribute and :value are always available for interpolation
@@ -105,16 +105,16 @@ es:
accepted: "debe ser aceptado"
empty: "no puede estar vacío"
blank: "no puede estar en blanco"
- too_long: "es demasiado largo ({{count}} caracteres máximo)"
- too_short: "es demasiado corto ({{count}} caracteres mínimo)"
- wrong_length: "no tiene la longitud correcta ({{count}} caracteres exactos)"
+ too_long: "es demasiado largo (%{count} caracteres máximo)"
+ too_short: "es demasiado corto (%{count} caracteres mínimo)"
+ wrong_length: "no tiene la longitud correcta (%{count} caracteres exactos)"
taken: "ya está en uso"
not_a_number: "no es un número"
- greater_than: "debe ser mayor que {{count}}"
- greater_than_or_equal_to: "debe ser mayor que o igual a {{count}}"
- equal_to: "debe ser igual a {{count}}"
- less_than: "debe ser menor que {{count}}"
- less_than_or_equal_to: "debe ser menor que o igual a {{count}}"
+ greater_than: "debe ser mayor que %{count}"
+ greater_than_or_equal_to: "debe ser mayor que o igual a %{count}"
+ equal_to: "debe ser igual a %{count}"
+ less_than: "debe ser menor que %{count}"
+ less_than_or_equal_to: "debe ser menor que o igual a %{count}"
odd: "debe ser impar"
even: "debe ser par"
@@ -159,7 +159,7 @@ es:
welcome:
title: 'Portada de Mundo Pepino'
cookie_fortune: 'Galleta de la Fortuna'
- interpolated: 'Mensaje con {{name}}'
+ interpolated: 'Mensaje con %{name}'
colors:
green: "Verde"
vegetables: "Hortalizas"

0 comments on commit 8d8b263

Please sign in to comment.
Something went wrong with that request. Please try again.