r18n-rails 0.4.9 → 0.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.rspec +1 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +123 -0
- data/Rakefile +45 -0
- data/r18n-rails.gemspec +39 -0
- data/spec/app/app/controllers/application_controller.rb +0 -1
- data/spec/app/app/controllers/test_controller.rb +2 -0
- data/spec/app/app/helpers/application_helper.rb +0 -1
- data/spec/app/config.ru +4 -0
- data/spec/app/config/application.rb +19 -0
- data/spec/app/config/boot.rb +4 -108
- data/spec/app/config/environment.rb +4 -10
- data/spec/app/config/environments/development.rb +10 -16
- data/spec/app/config/environments/production.rb +9 -28
- data/spec/app/config/environments/test.rb +10 -28
- data/spec/app/config/initializers/secret_token.rb +1 -0
- data/spec/app/config/initializers/session_store.rb +1 -15
- data/spec/app/config/routes.rb +5 -3
- data/spec/app/db/schema.rb +20 -0
- data/spec/app/script/rails +6 -0
- data/spec/rails_spec.rb +3 -4
- data/spec/spec_helper.rb +6 -3
- metadata +146 -50
- data/spec/app/db/test.sqlite3 +0 -0
- data/spec/app/log/test.log +0 -11202
- data/spec/app/script/server +0 -3
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--format documentation --colour
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
r18n-rails (0.4.10)
|
5
|
+
r18n-rails-api (= 0.4.10)
|
6
|
+
|
7
|
+
PATH
|
8
|
+
remote: ../r18n-core/
|
9
|
+
specs:
|
10
|
+
r18n-core (0.4.10)
|
11
|
+
|
12
|
+
PATH
|
13
|
+
remote: ../r18n-rails-api/
|
14
|
+
specs:
|
15
|
+
r18n-rails-api (0.4.10)
|
16
|
+
i18n
|
17
|
+
r18n-core (= 0.4.10)
|
18
|
+
|
19
|
+
GEM
|
20
|
+
remote: http://rubygems.org/
|
21
|
+
specs:
|
22
|
+
abstract (1.0.0)
|
23
|
+
actionmailer (3.0.7)
|
24
|
+
actionpack (= 3.0.7)
|
25
|
+
mail (~> 2.2.15)
|
26
|
+
actionpack (3.0.7)
|
27
|
+
activemodel (= 3.0.7)
|
28
|
+
activesupport (= 3.0.7)
|
29
|
+
builder (~> 2.1.2)
|
30
|
+
erubis (~> 2.6.6)
|
31
|
+
i18n (~> 0.5.0)
|
32
|
+
rack (~> 1.2.1)
|
33
|
+
rack-mount (~> 0.6.14)
|
34
|
+
rack-test (~> 0.5.7)
|
35
|
+
tzinfo (~> 0.3.23)
|
36
|
+
activemodel (3.0.7)
|
37
|
+
activesupport (= 3.0.7)
|
38
|
+
builder (~> 2.1.2)
|
39
|
+
i18n (~> 0.5.0)
|
40
|
+
activerecord (3.0.7)
|
41
|
+
activemodel (= 3.0.7)
|
42
|
+
activesupport (= 3.0.7)
|
43
|
+
arel (~> 2.0.2)
|
44
|
+
tzinfo (~> 0.3.23)
|
45
|
+
activeresource (3.0.7)
|
46
|
+
activemodel (= 3.0.7)
|
47
|
+
activesupport (= 3.0.7)
|
48
|
+
activesupport (3.0.7)
|
49
|
+
arel (2.0.9)
|
50
|
+
builder (2.1.2)
|
51
|
+
diff-lcs (1.1.2)
|
52
|
+
erubis (2.6.6)
|
53
|
+
abstract (>= 1.0.0)
|
54
|
+
haml (2.2.24)
|
55
|
+
hanna (0.1.12)
|
56
|
+
haml (~> 2.2.8)
|
57
|
+
rake (~> 0.8.2)
|
58
|
+
rdoc (~> 2.3.0)
|
59
|
+
i18n (0.5.0)
|
60
|
+
mail (2.2.19)
|
61
|
+
activesupport (>= 2.3.6)
|
62
|
+
i18n (>= 0.4.0)
|
63
|
+
mime-types (~> 1.16)
|
64
|
+
treetop (~> 1.4.8)
|
65
|
+
mime-types (1.16)
|
66
|
+
polyglot (0.3.1)
|
67
|
+
psych (1.2.0)
|
68
|
+
rack (1.2.2)
|
69
|
+
rack-mount (0.6.14)
|
70
|
+
rack (>= 1.0.0)
|
71
|
+
rack-test (0.5.7)
|
72
|
+
rack (>= 1.0)
|
73
|
+
rails (3.0.7)
|
74
|
+
actionmailer (= 3.0.7)
|
75
|
+
actionpack (= 3.0.7)
|
76
|
+
activerecord (= 3.0.7)
|
77
|
+
activeresource (= 3.0.7)
|
78
|
+
activesupport (= 3.0.7)
|
79
|
+
bundler (~> 1.0)
|
80
|
+
railties (= 3.0.7)
|
81
|
+
railties (3.0.7)
|
82
|
+
actionpack (= 3.0.7)
|
83
|
+
activesupport (= 3.0.7)
|
84
|
+
rake (>= 0.8.7)
|
85
|
+
thor (~> 0.14.4)
|
86
|
+
rake (0.8.7)
|
87
|
+
rcov (0.9.9)
|
88
|
+
rdoc (2.3.0)
|
89
|
+
rspec (2.5.0)
|
90
|
+
rspec-core (~> 2.5.0)
|
91
|
+
rspec-expectations (~> 2.5.0)
|
92
|
+
rspec-mocks (~> 2.5.0)
|
93
|
+
rspec-core (2.5.1)
|
94
|
+
rspec-expectations (2.5.0)
|
95
|
+
diff-lcs (~> 1.1.2)
|
96
|
+
rspec-mocks (2.5.0)
|
97
|
+
rspec-rails (2.5.0)
|
98
|
+
actionpack (~> 3.0)
|
99
|
+
activesupport (~> 3.0)
|
100
|
+
railties (~> 3.0)
|
101
|
+
rspec (~> 2.5.0)
|
102
|
+
sqlite3 (1.3.3)
|
103
|
+
thor (0.14.6)
|
104
|
+
treetop (1.4.9)
|
105
|
+
polyglot (>= 0.3.1)
|
106
|
+
tzinfo (0.3.27)
|
107
|
+
|
108
|
+
PLATFORMS
|
109
|
+
ruby
|
110
|
+
|
111
|
+
DEPENDENCIES
|
112
|
+
bundler (>= 1.0.10)
|
113
|
+
hanna
|
114
|
+
psych
|
115
|
+
r18n-core!
|
116
|
+
r18n-rails!
|
117
|
+
r18n-rails-api!
|
118
|
+
rails (>= 3)
|
119
|
+
rake (>= 0, != 0.9.0)
|
120
|
+
rcov
|
121
|
+
rspec (>= 2)
|
122
|
+
rspec-rails (>= 2)
|
123
|
+
sqlite3
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'rubygems'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'bundler'
|
6
|
+
require 'bundler/setup'
|
7
|
+
Bundler::GemHelper.install_tasks
|
8
|
+
rescue LoadError
|
9
|
+
puts "Bundler not available. Install it with: gem install bundler"
|
10
|
+
end
|
11
|
+
|
12
|
+
begin
|
13
|
+
require 'hanna/rdoctask'
|
14
|
+
rescue LoadError
|
15
|
+
require 'rake/rdoctask'
|
16
|
+
end
|
17
|
+
|
18
|
+
PKG_NAME = 'r18n-rails'
|
19
|
+
require '../r18n-core/lib/r18n-core/version'
|
20
|
+
|
21
|
+
require 'rspec/core/rake_task'
|
22
|
+
|
23
|
+
RSpec::Core::RakeTask.new
|
24
|
+
|
25
|
+
RSpec::Core::RakeTask.new('rcov') do |t|
|
26
|
+
t.rcov = true
|
27
|
+
t.ruby_opts = '-w'
|
28
|
+
t.rcov_opts = ['--text-summary', '--charset UTF-8', '-x gem']
|
29
|
+
end
|
30
|
+
|
31
|
+
Rake::RDocTask.new do |rdoc|
|
32
|
+
rdoc.main = 'README.rdoc'
|
33
|
+
rdoc.rdoc_files.include('README.rdoc', 'LICENSE', 'lib/**/*.rb')
|
34
|
+
rdoc.title = 'R18n for Rails Documentation'
|
35
|
+
rdoc.rdoc_dir = 'doc'
|
36
|
+
rdoc.options << '-c utf-8'
|
37
|
+
rdoc.options << '--all'
|
38
|
+
end
|
39
|
+
|
40
|
+
task :clobber_package do
|
41
|
+
rm_r 'pkg' rescue nil
|
42
|
+
end
|
43
|
+
task :clobber => [:clobber_package]
|
44
|
+
|
45
|
+
task :default => :spec
|
data/r18n-rails.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require '../r18n-core/lib/r18n-core/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.platform = Gem::Platform::RUBY
|
5
|
+
s.name = 'r18n-rails'
|
6
|
+
s.version = R18n::VERSION.dup
|
7
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
8
|
+
s.summary = 'R18n for Rails'
|
9
|
+
s.description = <<-EOF
|
10
|
+
Out-of-box R18n support for Ruby on Rails.
|
11
|
+
It is just a wrapper for R18n Rails API and R18n core libraries.
|
12
|
+
R18n has nice Ruby-style syntax, filters, flexible locales, custom loaders,
|
13
|
+
translation support for any classes, time and number localization, several
|
14
|
+
user language support, agnostic core package with out-of-box support for
|
15
|
+
Rails, Sinatra, Merb and desktop applications.
|
16
|
+
EOF
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
s.extra_rdoc_files = ['README.rdoc', 'LICENSE']
|
21
|
+
s.require_path = 'lib'
|
22
|
+
s.has_rdoc = true
|
23
|
+
|
24
|
+
s.author = 'Andrey "A.I." Sitnik'
|
25
|
+
s.email = 'andrey@sitnik.ru'
|
26
|
+
s.homepage = 'http://r18n.rubyforge.org/'
|
27
|
+
s.rubyforge_project = 'r18n-rails'
|
28
|
+
|
29
|
+
s.add_dependency 'r18n-rails-api', ["= #{R18n::VERSION}"]
|
30
|
+
|
31
|
+
s.add_development_dependency "bundler", [">= 1.0.10"]
|
32
|
+
s.add_development_dependency "hanna", [">= 0"]
|
33
|
+
s.add_development_dependency "rake", [">= 0", "!= 0.9.0"]
|
34
|
+
s.add_development_dependency "rails", [">= 3"]
|
35
|
+
s.add_development_dependency "rspec", [">= 2"]
|
36
|
+
s.add_development_dependency "rspec-rails", [">= 2"]
|
37
|
+
s.add_development_dependency "rcov", [">= 0"]
|
38
|
+
end
|
39
|
+
|
data/spec/app/config.ru
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require "active_record/railtie"
|
4
|
+
require "action_controller/railtie"
|
5
|
+
require "action_mailer/railtie"
|
6
|
+
require "active_resource/railtie"
|
7
|
+
require "rails/test_unit/railtie"
|
8
|
+
|
9
|
+
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
10
|
+
|
11
|
+
module App
|
12
|
+
class Application < Rails::Application
|
13
|
+
config.time_zone = 'UTC'
|
14
|
+
config.i18n.default_locale = :ru
|
15
|
+
config.action_view.javascript_expansions[:defaults] = []
|
16
|
+
config.encoding = "utf-8"
|
17
|
+
config.filter_parameters += [:password]
|
18
|
+
end
|
19
|
+
end
|
data/spec/app/config/boot.rb
CHANGED
@@ -1,110 +1,6 @@
|
|
1
|
-
|
2
|
-
# Configure your app in config/environment.rb and config/environments/*.rb
|
1
|
+
require 'rubygems'
|
3
2
|
|
4
|
-
|
3
|
+
# Set up gems listed in the Gemfile.
|
4
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
5
5
|
|
6
|
-
|
7
|
-
class << self
|
8
|
-
def boot!
|
9
|
-
unless booted?
|
10
|
-
preinitialize
|
11
|
-
pick_boot.run
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def booted?
|
16
|
-
defined? Rails::Initializer
|
17
|
-
end
|
18
|
-
|
19
|
-
def pick_boot
|
20
|
-
(vendor_rails? ? VendorBoot : GemBoot).new
|
21
|
-
end
|
22
|
-
|
23
|
-
def vendor_rails?
|
24
|
-
File.exist?("#{RAILS_ROOT}/vendor/rails")
|
25
|
-
end
|
26
|
-
|
27
|
-
def preinitialize
|
28
|
-
load(preinitializer_path) if File.exist?(preinitializer_path)
|
29
|
-
end
|
30
|
-
|
31
|
-
def preinitializer_path
|
32
|
-
"#{RAILS_ROOT}/config/preinitializer.rb"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
class Boot
|
37
|
-
def run
|
38
|
-
load_initializer
|
39
|
-
Rails::Initializer.run(:set_load_path)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
class VendorBoot < Boot
|
44
|
-
def load_initializer
|
45
|
-
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
46
|
-
Rails::Initializer.run(:install_gem_spec_stubs)
|
47
|
-
Rails::GemDependency.add_frozen_gem_path
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
class GemBoot < Boot
|
52
|
-
def load_initializer
|
53
|
-
self.class.load_rubygems
|
54
|
-
load_rails_gem
|
55
|
-
require 'initializer'
|
56
|
-
end
|
57
|
-
|
58
|
-
def load_rails_gem
|
59
|
-
if version = self.class.gem_version
|
60
|
-
gem 'rails', version
|
61
|
-
else
|
62
|
-
gem 'rails'
|
63
|
-
end
|
64
|
-
rescue Gem::LoadError => load_error
|
65
|
-
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
66
|
-
exit 1
|
67
|
-
end
|
68
|
-
|
69
|
-
class << self
|
70
|
-
def rubygems_version
|
71
|
-
Gem::RubyGemsVersion rescue nil
|
72
|
-
end
|
73
|
-
|
74
|
-
def gem_version
|
75
|
-
if defined? RAILS_GEM_VERSION
|
76
|
-
RAILS_GEM_VERSION
|
77
|
-
elsif ENV.include?('RAILS_GEM_VERSION')
|
78
|
-
ENV['RAILS_GEM_VERSION']
|
79
|
-
else
|
80
|
-
parse_gem_version(read_environment_rb)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def load_rubygems
|
85
|
-
min_version = '1.3.2'
|
86
|
-
require 'rubygems'
|
87
|
-
unless rubygems_version >= min_version
|
88
|
-
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
89
|
-
exit 1
|
90
|
-
end
|
91
|
-
|
92
|
-
rescue LoadError
|
93
|
-
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
94
|
-
exit 1
|
95
|
-
end
|
96
|
-
|
97
|
-
def parse_gem_version(text)
|
98
|
-
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
|
99
|
-
end
|
100
|
-
|
101
|
-
private
|
102
|
-
def read_environment_rb
|
103
|
-
File.read("#{RAILS_ROOT}/config/environment.rb")
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
# All that for this:
|
110
|
-
Rails.boot!
|
6
|
+
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
@@ -1,11 +1,5 @@
|
|
1
|
-
|
1
|
+
# Load the rails application
|
2
|
+
require File.expand_path('../application', __FILE__)
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
Rails::Initializer.run do |config|
|
6
|
-
config.time_zone = 'UTC'
|
7
|
-
|
8
|
-
config.gem 'r18n-rails', :lib => Rails.root + '../../lib/r18n-rails'
|
9
|
-
|
10
|
-
config.i18n.default_locale = :ru
|
11
|
-
end
|
4
|
+
# Initialize the rails application
|
5
|
+
App::Application.initialize!
|
@@ -1,17 +1,11 @@
|
|
1
|
-
|
1
|
+
App::Application.configure do
|
2
|
+
config.cache_classes = false
|
3
|
+
config.whiny_nils = true
|
4
|
+
config.consider_all_requests_local = true
|
5
|
+
config.action_view.debug_rjs = true
|
6
|
+
config.action_controller.perform_caching = false
|
7
|
+
config.action_mailer.raise_delivery_errors = false
|
8
|
+
config.active_support.deprecation = :log
|
9
|
+
config.action_dispatch.best_standards_support = :builtin
|
10
|
+
end
|
2
11
|
|
3
|
-
# In the development environment your application's code is reloaded on
|
4
|
-
# every request. This slows down response time but is perfect for development
|
5
|
-
# since you don't have to restart the webserver when you make code changes.
|
6
|
-
config.cache_classes = false
|
7
|
-
|
8
|
-
# Log error messages when you accidentally call methods on nil.
|
9
|
-
config.whiny_nils = true
|
10
|
-
|
11
|
-
# Show full error reports and disable caching
|
12
|
-
config.action_controller.consider_all_requests_local = true
|
13
|
-
config.action_view.debug_rjs = true
|
14
|
-
config.action_controller.perform_caching = false
|
15
|
-
|
16
|
-
# Don't care if the mailer can't send
|
17
|
-
config.action_mailer.raise_delivery_errors = false
|
@@ -1,28 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
config.
|
6
|
-
|
7
|
-
|
8
|
-
config.
|
9
|
-
|
10
|
-
config.action_view.cache_template_loading = true
|
11
|
-
|
12
|
-
# See everything in the log (default is :info)
|
13
|
-
# config.log_level = :debug
|
14
|
-
|
15
|
-
# Use a different logger for distributed setups
|
16
|
-
# config.logger = SyslogLogger.new
|
17
|
-
|
18
|
-
# Use a different cache store in production
|
19
|
-
# config.cache_store = :mem_cache_store
|
20
|
-
|
21
|
-
# Enable serving of images, stylesheets, and javascripts from an asset server
|
22
|
-
# config.action_controller.asset_host = "http://assets.example.com"
|
23
|
-
|
24
|
-
# Disable delivery errors, bad email addresses will be ignored
|
25
|
-
# config.action_mailer.raise_delivery_errors = false
|
26
|
-
|
27
|
-
# Enable threaded mode
|
28
|
-
# config.threadsafe!
|
1
|
+
App::Application.configure do
|
2
|
+
config.cache_classes = true
|
3
|
+
config.consider_all_requests_local = false
|
4
|
+
config.action_controller.perform_caching = true
|
5
|
+
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
6
|
+
config.serve_static_assets = false
|
7
|
+
config.i18n.fallbacks = true
|
8
|
+
config.active_support.deprecation = :notify
|
9
|
+
end
|