e9s 2.1.4 → 2.2.0

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/CHANGELOG CHANGED
@@ -1,5 +1,12 @@
1
1
  = E9s CHANGELOG
2
2
 
3
+ == Version 2.2.0 (November 8, 2010)
4
+
5
+ * Made E9s Rails 2 and 3 compatible (woot!)
6
+ * Using Rich-CMS v2.1.1 and higher
7
+ * Using Rich-i18n v1.3.1 and higher
8
+ * Using Rich-pluralization v1.0.6 and higher
9
+
3
10
  == Version 2.1.4 (October 20, 2010)
4
11
 
5
12
  * Using Rich-CMS v2.0.7 and higher
data/README.textile CHANGED
@@ -35,33 +35,44 @@ h3. Inflections
35
35
 
36
36
  h2. Installation
37
37
 
38
- Install the E9s gem:
38
+ h3. Using E9s as gem in Rails 3
39
+
40
+ Add E9s in @Gemfile@ as a gem dependency:
41
+
42
+ <pre>
43
+ gem "e9s"
44
+ </pre>
45
+
46
+ Run the following in your console to install with Bundler:
39
47
 
40
48
  <pre>
41
- sudo gem install e9s
49
+ bundle install
42
50
  </pre>
43
51
 
44
- Add e9s in environment.rb as a gem dependency:
52
+ h3. Using E9s as gem in Rails 2
53
+
54
+ Add E9s in @environment.rb@ as a gem dependency:
45
55
 
46
56
  <pre>
47
57
  config.gem "e9s"
48
58
  </pre>
49
59
 
50
- h3. Testing E9s out-of-the-box
60
+ Run the following in your console:
51
61
 
52
- Run the Rails console:
62
+ <pre>
63
+ sudo rake gems:install
64
+ </pre>
65
+
66
+ h3. Using E9s as plugin in Rails 3
53
67
 
54
68
  <pre>
55
- ./script/console
69
+ rails plugin install git://github.com/archan937/e9s.git
56
70
  </pre>
57
71
 
58
- Start translating in Dutch:
72
+ h3. Using E9s as plugin in Rails 2
59
73
 
60
74
  <pre>
61
- >> I18n.locale = :nl
62
- => :nl
63
- >> "MORE HOUSES".t
64
- => "MEER HUIZEN"
75
+ script/plugin install git://github.com/archan937/e9s.git
65
76
  </pre>
66
77
 
67
78
  h2. Use the provided Rails generator
@@ -74,18 +85,26 @@ In order to manage translations and/or CMS content. You need the following entit
74
85
 
75
86
  Fortunately, E9s is provided with a Rails generator with which you can generate all the entities.
76
87
 
77
- h3. In your console
88
+ h4. In Rails 3
78
89
 
79
- Run the following command:
90
+ Run the following in your console:
80
91
 
81
92
  <pre>
82
- script/generate enrichments
93
+ rails g enrichments -m
83
94
  </pre>
84
95
 
85
96
  *Note*: The generator has the @-m@ or @--migrate@ option which runs @rake db:migrate@ after creating the files.
86
97
 
87
98
  Actually, this generator calls the generators of "Rich-CMS":http://github.com/archan937/rich_cms and "Rich-i18n":http://github.com/archan937/rich_i18n. For more information, please check the README files.
88
99
 
100
+ h4. In Rails 2
101
+
102
+ Run the following in your console:
103
+
104
+ <pre>
105
+ script/generate enrichments
106
+ </pre>
107
+
89
108
  h2. Start specifying translations
90
109
 
91
110
  h3. Populating config/locales
@@ -101,7 +120,7 @@ As E9s automatically singularizes or pluralizes the translation (depending on th
101
120
  <pre>
102
121
  ---
103
122
  nl:
104
-
123
+
105
124
  word:
106
125
  "yes": ja
107
126
  "no": nee
@@ -121,9 +140,9 @@ E9s provides you to specify pluralization rules for different locales. You have
121
140
  *Note*: specified in @config/locales/nl.yml@
122
141
 
123
142
  <pre>
124
- ---
125
- nl:
126
-
143
+ ---
144
+ nl:
145
+
127
146
  e9s:
128
147
  singular:
129
148
  - rule: en$
@@ -132,33 +151,33 @@ nl:
132
151
  plural:
133
152
  - rule: ee$
134
153
  replacement: eeën
135
-
154
+
136
155
  - rule: heid$
137
156
  replacement: heden
138
-
157
+
139
158
  - rule: (c|m|n|t)us$
140
159
  replacement: \1i
141
-
160
+
142
161
  - rule: | abc, acme, acne, (a|ë|i|o|u|y)$
143
162
  replacement: \1's
144
163
  exceptions: (ai|eau|ei|li|lieu|ooi|ou|shampoo|spray|vlo)$
145
-
164
+
146
165
  - rule: (blad|kind)$
147
166
  replacement: \1eren
148
167
  exceptions: (aanrecht|advertentie)blad
149
-
168
+
150
169
  - rule: (e|em|el|er|erd|aar|aard|um|eur|foon|oor|ier|en|ie|eau|show|festival|é)$
151
170
  replacement: \1s
152
171
 
153
172
  - rule: | (a|e|o|u)\1([^aeiou])$
154
173
  replacement: \1\2en
155
-
156
- - rule: | (aï|alia)(s),
174
+
175
+ - rule: | (aï|alia)(s),
157
176
  ([^aeiou][aeiou])([^aeiou])$
158
177
  replacement: \1\2\2en
159
- exceptions: dal, pad, slot, vat, weg,
178
+ exceptions: dal, pad, slot, vat, weg,
160
179
  (blad|dag|dak|engel|gat|weg)$
161
-
180
+
162
181
  - rule: f$
163
182
  replacement: ven
164
183
 
@@ -167,10 +186,10 @@ nl:
167
186
 
168
187
  - rule: $
169
188
  replacement: en
170
-
189
+
171
190
  irregular:
172
191
  gelid: gelederen
173
-
192
+
174
193
  uncountable:
175
194
  - geld
176
195
  - informatie
@@ -188,32 +207,32 @@ You can translate @labels@ and @seatholders@ (placeholders :D) within Formtastic
188
207
  <pre>
189
208
  ---
190
209
  nl:
191
-
210
+
192
211
  word:
193
212
  password: wachtwoord
194
-
213
+
195
214
  label:
196
215
  user_name: gebruikersnaam
197
216
  content: bericht
198
-
217
+
199
218
  Question:
200
219
  content: jouw vraag
201
-
220
+
202
221
  Answer:
203
222
  content: jouw antwoord
204
-
223
+
205
224
  (search_form)
206
225
  criteria: uw zoekcriteria
207
-
226
+
208
227
  seatholder:
209
228
  email_address: uw.naam@een.website.nl
210
-
229
+
211
230
  Question:
212
231
  content: Hoeveel uren zitten in een dag?
213
-
232
+
214
233
  Answer:
215
234
  content: 24 uur
216
-
235
+
217
236
  (search_form)
218
237
  criteria: '&Voorbeeld'
219
238
  </pre>
@@ -345,6 +364,14 @@ We have also provided you a helper method to render Rich-CMS content tags:
345
364
  ...
346
365
  </pre>
347
366
 
367
+ You can also render CMS content as HTML. When editing CMS content in Rich-CMS, a WYSIWYG editor will be displayed. Just add @:as => :html@.
368
+
369
+ <pre>
370
+ ...
371
+ <%= rich_cms_tag ".cms_content", "application.index.welcome", :as => :html %>
372
+ ...
373
+ </pre>
374
+
348
375
  For further documentation, please check the "Rich-CMS README":http://github.com/archan937/rich_cms file.
349
376
 
350
377
  h3. Render translations
@@ -361,7 +388,7 @@ The E9s module Rich-i18n has its own conventions which are simpler. A few exampl
361
388
  ...
362
389
  </pre>
363
390
 
364
- You can also render translations as HTML. When editing translations in Rich-CMS, you will be provided with a WYSIWYG editor. Simply specify @:as => :html@.
391
+ You can also render translations as HTML. When editing translations in Rich-CMS, a WYSIWYG editor will be displayed. Just add @:as => :html@.
365
392
 
366
393
  <pre>
367
394
  ...
@@ -397,7 +424,7 @@ Rich-pluralization<br>
397
424
 
398
425
  h2. ToDo's
399
426
 
400
- * Make E9s compatible with Rails 3
427
+ None
401
428
 
402
429
  h2. Enrichments
403
430
 
data/Rakefile CHANGED
@@ -12,8 +12,8 @@ begin
12
12
  gemspec.homepage = "http://codehero.es/rails_gems_plugins/e9s"
13
13
  gemspec.author = "Paul Engel"
14
14
 
15
- gemspec.add_dependency "rich_cms" , ">= 2.0.7"
16
- gemspec.add_dependency "rich_i18n" , ">= 1.2.3"
15
+ gemspec.add_dependency "rich_cms" , ">= 2.1.1"
16
+ gemspec.add_dependency "rich_i18n" , ">= 1.3.1"
17
17
  gemspec.add_dependency "rich_pluralization", ">= 1.0.6"
18
18
  end
19
19
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.4
1
+ 2.2.0
data/e9s.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{e9s}
8
- s.version = "2.1.4"
8
+ s.version = "2.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Paul Engel"]
12
- s.date = %q{2010-10-20}
12
+ s.date = %q{2010-11-08}
13
13
  s.description = %q{E9s was created due to the need of simply implementing I18n within a Rails application. This simplifies internationalization of your Rails application making a Rails developers life much easier. E9s is divided into modules (as gem and plugin): Rich-CMS (http://github.com/archan937/rich_cms) , Rich-i18n (http://github.com/archan937/rich_i18n) and Rich-pluralization (http://github.com/archan937/rich_pluralization).}
14
14
  s.email = %q{paul.engel@holder.nl}
15
15
  s.extra_rdoc_files = [
@@ -29,10 +29,10 @@ Gem::Specification.new do |s|
29
29
  "lib/e9s/actionpack.rb",
30
30
  "lib/e9s/actionpack/action_view/base.rb",
31
31
  "lib/e9s/engine.rb",
32
+ "lib/generators/enrichments/enrichments_generator.rb",
32
33
  "rails/init.rb",
33
34
  "rails_generators/enrichments/enrichments_generator.rb",
34
35
  "tasks/e9s_tasks.rake",
35
- "test/e9s_test.rb",
36
36
  "test/test_helper.rb",
37
37
  "uninstall.rb"
38
38
  ]
@@ -42,8 +42,7 @@ Gem::Specification.new do |s|
42
42
  s.rubygems_version = %q{1.3.7}
43
43
  s.summary = %q{Enrichments (e9s) for a pluggable CMS, internationalization (i18n) and localized pluralization}
44
44
  s.test_files = [
45
- "test/e9s_test.rb",
46
- "test/test_helper.rb"
45
+ "test/test_helper.rb"
47
46
  ]
48
47
 
49
48
  if s.respond_to? :specification_version then
@@ -51,17 +50,17 @@ Gem::Specification.new do |s|
51
50
  s.specification_version = 3
52
51
 
53
52
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
54
- s.add_runtime_dependency(%q<rich_cms>, [">= 2.0.7"])
55
- s.add_runtime_dependency(%q<rich_i18n>, [">= 1.2.3"])
53
+ s.add_runtime_dependency(%q<rich_cms>, [">= 2.1.1"])
54
+ s.add_runtime_dependency(%q<rich_i18n>, [">= 1.3.1"])
56
55
  s.add_runtime_dependency(%q<rich_pluralization>, [">= 1.0.6"])
57
56
  else
58
- s.add_dependency(%q<rich_cms>, [">= 2.0.7"])
59
- s.add_dependency(%q<rich_i18n>, [">= 1.2.3"])
57
+ s.add_dependency(%q<rich_cms>, [">= 2.1.1"])
58
+ s.add_dependency(%q<rich_i18n>, [">= 1.3.1"])
60
59
  s.add_dependency(%q<rich_pluralization>, [">= 1.0.6"])
61
60
  end
62
61
  else
63
- s.add_dependency(%q<rich_cms>, [">= 2.0.7"])
64
- s.add_dependency(%q<rich_i18n>, [">= 1.2.3"])
62
+ s.add_dependency(%q<rich_cms>, [">= 2.1.1"])
63
+ s.add_dependency(%q<rich_i18n>, [">= 1.3.1"])
65
64
  s.add_dependency(%q<rich_pluralization>, [">= 1.0.6"])
66
65
  end
67
66
  end
@@ -7,7 +7,7 @@ module ActionView
7
7
  if respond_to?(method = "rich_#{mod}")
8
8
  send(method)
9
9
  end
10
- end.compact.join("\n")
10
+ end.compact.join("\n").html_safe
11
11
  end
12
12
 
13
13
  end
data/lib/e9s/engine.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  module E9s
3
3
  module Engine
4
4
  extend self
5
-
5
+
6
6
  def method_missing(method, *args)
7
7
  MODULES.detect do |mod|
8
8
  m = "rich/#{mod}/engine".camelize.constantize
@@ -14,6 +14,6 @@ module E9s
14
14
 
15
15
  end
16
16
  end
17
-
17
+
18
18
  end
19
19
  end
data/lib/e9s.rb CHANGED
@@ -3,9 +3,9 @@ require "e9s/actionpack"
3
3
 
4
4
  module E9s
5
5
  extend self
6
-
6
+
7
7
  MODULES = %w(cms i18n pluralization)
8
-
8
+
9
9
  def require_modules
10
10
  MODULES.each do |mod|
11
11
  require "rich_#{mod}"
@@ -14,7 +14,7 @@ module E9s
14
14
  # Re-raise as RuntimeError because Mongrel would swallow LoadError.
15
15
  raise e.to_s
16
16
  end
17
-
17
+
18
18
  end
19
19
 
20
20
  E9s.require_modules
@@ -0,0 +1,22 @@
1
+ class EnrichmentsGenerator < Rails::Generators::Base
2
+
3
+ desc "Creates entities used by Enrichments (e9s)"
4
+ class_option :user_model , :type => :string , :default => "User" , :aliases => "-u" , :desc => "The name of the Authlogic user model."
5
+ class_option :content_model , :type => :string , :default => "CmsContent" , :aliases => "-c" , :desc => "The name of the CMS content model."
6
+ class_option :translation_model, :type => :string , :default => "Translation", :aliases => "-t" , :desc => "The name of the I18n translation model."
7
+ class_option :migrate , :type => :boolean, :default => false , :aliases => "-m" , :desc => "Run 'rake db:migrate' after generating model and migration"
8
+
9
+ def generate_rich_cms_files
10
+ generate "rich:authlogic_user", options[:user_model]
11
+ generate "rich:cms_content", options[:content_model]
12
+ end
13
+
14
+ def generate_rich_i18n_files
15
+ generate "rich:translation", options[:translation_model]
16
+ end
17
+
18
+ def migrate
19
+ rake "db:migrate" if options[:migrate]
20
+ end
21
+
22
+ end
@@ -11,33 +11,13 @@ class EnrichmentsGenerator < Rails::Generator::Base
11
11
  # do something
12
12
  end
13
13
  end
14
-
14
+
15
15
  def after_generate
16
16
  system "script/generate rich_authlogic_user #{options[:user] }" unless options[:user] && options[:user] .empty?
17
17
  system "script/generate rich_cms_content #{options[:content] }" unless options[:content] && options[:content] .empty?
18
18
  system "script/generate rich_i18n_translation #{options[:translation]}" unless options[:translation] && options[:translation].empty?
19
-
20
- system "rake db:migrate" if options[:migrate]
21
- end
22
-
23
- def model_file_name
24
- @name.underscore
25
- end
26
-
27
- def model_class_name
28
- @name.classify
29
- end
30
-
31
- def table_name
32
- model_file_name.gsub("/", "_").pluralize
33
- end
34
-
35
- def migration_file_name
36
- "create_#{table_name}"
37
- end
38
19
 
39
- def migration_class_name
40
- migration_file_name.camelize
20
+ system "rake db:migrate" if options[:migrate]
41
21
  end
42
22
 
43
23
  protected
@@ -50,7 +30,7 @@ protected
50
30
  opt.on("-t", "--translation", "The name of the I18n translation model which is Translation at default.") { |v| options[:translation] = v == true ? "" : v }
51
31
  opt.on("-m", "--migrate" , "Run 'rake db:migrate' after generating model and migration." ) { options[:migrate] = true }
52
32
  end
53
-
33
+
54
34
  def banner
55
35
  <<-EOS
56
36
  Creates entities used by Enrichments (e9s).
data/test/test_helper.rb CHANGED
@@ -1,3 +1,6 @@
1
1
  require "rubygems"
2
+ require "test/unit"
2
3
  require "active_support"
3
- require "active_support/test_case"
4
+
5
+ require File.join(File.dirname(__FILE__), "..", "lib", "e9s")
6
+ include E9s
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: e9s
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
- - 1
9
- - 4
10
- version: 2.1.4
8
+ - 2
9
+ - 0
10
+ version: 2.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Paul Engel
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-20 00:00:00 +02:00
18
+ date: 2010-11-08 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -26,12 +26,12 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- hash: 1
29
+ hash: 9
30
30
  segments:
31
31
  - 2
32
- - 0
33
- - 7
34
- version: 2.0.7
32
+ - 1
33
+ - 1
34
+ version: 2.1.1
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
@@ -45,9 +45,9 @@ dependencies:
45
45
  hash: 25
46
46
  segments:
47
47
  - 1
48
- - 2
49
48
  - 3
50
- version: 1.2.3
49
+ - 1
50
+ version: 1.3.1
51
51
  type: :runtime
52
52
  version_requirements: *id002
53
53
  - !ruby/object:Gem::Dependency
@@ -88,10 +88,10 @@ files:
88
88
  - lib/e9s/actionpack.rb
89
89
  - lib/e9s/actionpack/action_view/base.rb
90
90
  - lib/e9s/engine.rb
91
+ - lib/generators/enrichments/enrichments_generator.rb
91
92
  - rails/init.rb
92
93
  - rails_generators/enrichments/enrichments_generator.rb
93
94
  - tasks/e9s_tasks.rake
94
- - test/e9s_test.rb
95
95
  - test/test_helper.rb
96
96
  - uninstall.rb
97
97
  has_rdoc: true
@@ -129,5 +129,4 @@ signing_key:
129
129
  specification_version: 3
130
130
  summary: Enrichments (e9s) for a pluggable CMS, internationalization (i18n) and localized pluralization
131
131
  test_files:
132
- - test/e9s_test.rb
133
132
  - test/test_helper.rb
data/test/e9s_test.rb DELETED
@@ -1,8 +0,0 @@
1
- require "test_helper"
2
-
3
- class E9sTest < ActiveSupport::TestCase
4
- # Replace this with your real tests.
5
- test "the truth" do
6
- assert true
7
- end
8
- end