rich_cms 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,10 @@
1
1
  = Rich-CMS CHANGELOG
2
2
 
3
+ == Version 2.0.3 (September 30, 2010)
4
+
5
+ * Added rails generators 'rich_authlogic_user' and 'rich_cms_content'
6
+ * Finetuned the jQuery function $.keys()
7
+
3
8
  == Version 2.0.2 (September 9, 2010)
4
9
 
5
10
  * Corrected the Rich::Cms::Engine.to_content_tag implementation when using combined keys
@@ -31,7 +31,46 @@ Install the Rich-CMS plugin:
31
31
  ./script/plugin install git://github.com/archan937/rich_cms.git
32
32
  </pre>
33
33
 
34
- h2. Usage
34
+ h2. Use the provided Rails generators
35
+
36
+ Rich-CMS requires two entities:
37
+
38
+ * An (Authlogic authenticated) user model
39
+ * An ActiveRecord model used for CMS content storage
40
+
41
+ Fortunately, Rich-CMS is provided with two Rails generators with which you can generate both entities.
42
+
43
+ h3. Authlogic user
44
+
45
+ Run the following in your console:
46
+
47
+ <pre>
48
+ script/generate rich_authlogic_user
49
+ </pre>
50
+
51
+ *Note*: At default, it will create both the User and UserSesson classes and CreateUsers migration. You can alter the class names with the following:
52
+
53
+ <pre>
54
+ script/generate rich_authlogic_user CodeHeroes::User
55
+ </pre>
56
+
57
+ h3. CMS content
58
+
59
+ Run the following in your console:
60
+
61
+ <pre>
62
+ script/generate rich_cms_content
63
+ </pre>
64
+
65
+ *Note*: At default, it will create the CmsContent model and CreateCmsContents migration. You can alter the class name with the following:
66
+
67
+ <pre>
68
+ script/generate rich_cms_content CmsItem
69
+ </pre>
70
+
71
+ In case you have used the Rails generators, you can skip the *Create required entities manually* section and go straight to *Render Rich-CMS in your layout*.
72
+
73
+ h2. Create required entities manually
35
74
 
36
75
  h3. Specify the authentication mechanism
37
76
 
@@ -163,9 +202,10 @@ SeatHolder<br>
163
202
 
164
203
  h2. ToDo's
165
204
 
205
+ * Add feature with which textilized content is editable
166
206
  * Complete README.textile (provide documentation about optional features)
167
- * Integrate Rich-CMS in the E9s demo application ("http://github.com/archan937/e9s-demo":http://github.com/archan937/e9s-demo)
168
207
  * Provide compatibility with other authentication mechanisms other than AuthLogic
208
+ * Add cache feature which uses the standard Rails cache (rich_cms_tag ".cms_content", "test_content", :cache => true)
169
209
 
170
210
  h2. E9s
171
211
 
data/Rakefile CHANGED
@@ -12,6 +12,7 @@ begin
12
12
  gemspec.homepage = "http://github.com/archan937/rich_cms"
13
13
  gemspec.author = "Paul Engel"
14
14
 
15
+ gemspec.add_dependency "authlogic"
15
16
  gemspec.add_dependency "jzip", ">= 1.0.10"
16
17
  gemspec.add_dependency "haml", ">= 3"
17
18
  gemspec.add_dependency "formtastic", "0.9.7"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.2
1
+ 2.0.3
@@ -3,7 +3,9 @@ $.extend({
3
3
  keys: function(object) {
4
4
  var result = [];
5
5
  for (var key in object) {
6
- result.push(key);
6
+ if (object.hasOwnProperty(key)) {
7
+ result.push(key);
8
+ }
7
9
  }
8
10
  return result;
9
11
  },
@@ -0,0 +1,61 @@
1
+ class RichAuthlogicUserGenerator < Rails::Generator::Base
2
+ def initialize(runtime_args, runtime_options = {})
3
+ super
4
+ @name = @args.first || "user"
5
+ end
6
+
7
+ def manifest
8
+ record do |m|
9
+ m.directory "app/models"
10
+ m.template "model.rb", "app/models/#{model_file_name}.rb"
11
+ m.template "session.rb", "app/models/#{model_file_name}_session.rb"
12
+ m.template "config.rb", "config/initializers/enrichments.rb", {:collision => :skip}
13
+ m.migration_template "migration.rb", "db/migrate", :migration_file_name => migration_file_name
14
+ end
15
+ end
16
+
17
+ def after_generate
18
+ File.open(destination_path("config/initializers/enrichments.rb"), "a+") do |file|
19
+ file << "\nRich::Cms::Engine.authenticate(:authlogic, {:class_name => \"#{model_class_name}\", :identifier => :email})"
20
+ end
21
+
22
+ system "rake db:migrate" if options[:migrate]
23
+ end
24
+
25
+ def model_file_name
26
+ @name.underscore
27
+ end
28
+
29
+ def model_class_name
30
+ @name.classify
31
+ end
32
+
33
+ def table_name
34
+ model_file_name.gsub("/", "_").pluralize
35
+ end
36
+
37
+ def migration_file_name
38
+ "create_#{table_name}"
39
+ end
40
+
41
+ def migration_class_name
42
+ migration_file_name.camelize
43
+ end
44
+
45
+ protected
46
+
47
+ def add_options!(opt)
48
+ opt.separator ""
49
+ opt.separator "Options:"
50
+ opt.on("-m", "--migrate", "Run 'rake db:migrate' after generating model and migration.") { options[:migrate] = true }
51
+ end
52
+
53
+ def banner
54
+ <<-EOS
55
+ Creates Authlogic model and migration and also registers authenticated model to Rich-CMS.
56
+
57
+ USAGE: #{$0} #{spec.name} [model_name]
58
+ EOS
59
+ end
60
+
61
+ end
@@ -0,0 +1,25 @@
1
+ class <%= migration_class_name %> < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :<%= table_name %> do |t|
4
+ t.string :name
5
+ t.string :email
6
+ t.string :crypted_password
7
+ t.string :password_salt
8
+ t.datetime :created_at
9
+ t.string :persistence_token , :default => "", :null => false
10
+ t.string :single_access_token, :default => "", :null => false
11
+ t.string :perishable_token , :default => "", :null => false
12
+ t.integer :login_count
13
+ t.datetime :last_request_at
14
+ t.datetime :current_login_at
15
+ t.datetime :last_login_at
16
+ t.timestamps
17
+ end
18
+
19
+ add_index :<%= table_name %>, :email
20
+ end
21
+
22
+ def self.down
23
+ drop_table :<%= table_name %>
24
+ end
25
+ end
@@ -0,0 +1,8 @@
1
+ class <%= model_class_name %> < ActiveRecord::Base
2
+
3
+ acts_as_authentic do |c|
4
+ c.login_field = :email
5
+ c.crypted_password_field = :crypted_password
6
+ end
7
+
8
+ end
@@ -0,0 +1,7 @@
1
+ class <%= model_class_name %>Session < Authlogic::Session::Base
2
+
3
+ authenticate_with <%= model_class_name %>
4
+ generalize_credentials_error_messages true
5
+ params_key "user_credentials"
6
+
7
+ end
@@ -0,0 +1,60 @@
1
+ class RichCmsContentGenerator < Rails::Generator::Base
2
+ def initialize(runtime_args, runtime_options = {})
3
+ super
4
+ @name = @args.first || "cms_content"
5
+ end
6
+
7
+ def manifest
8
+ record do |m|
9
+ m.directory "app/models"
10
+ m.template "model.rb", "app/models/#{model_file_name}.rb"
11
+ m.template "config.rb", "config/initializers/enrichments.rb", {:collision => :skip}
12
+ m.migration_template "migration.rb", "db/migrate", :migration_file_name => migration_file_name
13
+ end
14
+ end
15
+
16
+ def after_generate
17
+ File.open(destination_path("config/initializers/enrichments.rb"), "a+") do |file|
18
+ file << "\nRich::Cms::Engine.register(\".#{model_file_name}\", {:class_name => \"#{model_class_name}\"})"
19
+ end
20
+
21
+ system "rake db:migrate" if options[:migrate]
22
+ end
23
+
24
+ def model_file_name
25
+ @name.underscore
26
+ end
27
+
28
+ def model_class_name
29
+ @name.classify
30
+ end
31
+
32
+ def table_name
33
+ model_file_name.gsub("/", "_").pluralize
34
+ end
35
+
36
+ def migration_file_name
37
+ "create_#{table_name}"
38
+ end
39
+
40
+ def migration_class_name
41
+ migration_file_name.camelize
42
+ end
43
+
44
+ protected
45
+
46
+ def add_options!(opt)
47
+ opt.separator ""
48
+ opt.separator "Options:"
49
+ opt.on("-m", "--migrate", "Run 'rake db:migrate' after generating model and migration.") { options[:migrate] = true }
50
+ end
51
+
52
+ def banner
53
+ <<-EOS
54
+ Creates Rich-CMS content model and migration and also registers content to Rich-CMS.
55
+
56
+ USAGE: #{$0} #{spec.name} [model_name]
57
+ EOS
58
+ end
59
+
60
+ end
@@ -0,0 +1,15 @@
1
+ class <%= migration_class_name %> < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :<%= table_name %> do |t|
4
+ t.string :key
5
+ t.text :value
6
+ t.timestamps
7
+ end
8
+
9
+ add_index :<%= table_name %>, :key
10
+ end
11
+
12
+ def self.down
13
+ drop_table :<%= table_name %>
14
+ end
15
+ end
@@ -0,0 +1,2 @@
1
+ class <%= model_class_name %> < ActiveRecord::Base
2
+ end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rich_cms}
8
- s.version = "2.0.2"
8
+ s.version = "2.0.3"
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-09-09}
12
+ s.date = %q{2010-09-30}
13
13
  s.description = %q{Rich-CMS is a module of E9s (http://github.com/archan937/e9s) which provides a frontend for your CMS content. You can use this gem to manage CMS content or translations (in an internationalized application). The installation and setup process is very easily done. You will have to register content at the Rich-CMS engine and also you will have to specify the authentication mechanism. Both are one-liners.}
14
14
  s.email = %q{paul.engel@holder.nl}
15
15
  s.extra_rdoc_files = [
@@ -74,6 +74,15 @@ Gem::Specification.new do |s|
74
74
  "lib/rich/cms/engine.rb",
75
75
  "lib/rich_cms.rb",
76
76
  "rails/init.rb",
77
+ "rails_generators/rich_authlogic_user/rich_authlogic_user_generator.rb",
78
+ "rails_generators/rich_authlogic_user/templates/config.rb",
79
+ "rails_generators/rich_authlogic_user/templates/migration.rb",
80
+ "rails_generators/rich_authlogic_user/templates/model.rb",
81
+ "rails_generators/rich_authlogic_user/templates/session.rb",
82
+ "rails_generators/rich_cms_content/rich_cms_content_generator.rb",
83
+ "rails_generators/rich_cms_content/templates/config.rb",
84
+ "rails_generators/rich_cms_content/templates/migration.rb",
85
+ "rails_generators/rich_cms_content/templates/model.rb",
77
86
  "rich_cms.gemspec",
78
87
  "tasks/rich_cms_tasks.rake",
79
88
  "test/engine_test.rb",
@@ -95,15 +104,18 @@ Gem::Specification.new do |s|
95
104
  s.specification_version = 3
96
105
 
97
106
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
107
+ s.add_runtime_dependency(%q<authlogic>, [">= 0"])
98
108
  s.add_runtime_dependency(%q<jzip>, [">= 1.0.10"])
99
109
  s.add_runtime_dependency(%q<haml>, [">= 3"])
100
110
  s.add_runtime_dependency(%q<formtastic>, ["= 0.9.7"])
101
111
  else
112
+ s.add_dependency(%q<authlogic>, [">= 0"])
102
113
  s.add_dependency(%q<jzip>, [">= 1.0.10"])
103
114
  s.add_dependency(%q<haml>, [">= 3"])
104
115
  s.add_dependency(%q<formtastic>, ["= 0.9.7"])
105
116
  end
106
117
  else
118
+ s.add_dependency(%q<authlogic>, [">= 0"])
107
119
  s.add_dependency(%q<jzip>, [">= 1.0.10"])
108
120
  s.add_dependency(%q<haml>, [">= 3"])
109
121
  s.add_dependency(%q<formtastic>, ["= 0.9.7"])
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rich_cms
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 2
10
- version: 2.0.2
9
+ - 3
10
+ version: 2.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Paul Engel
@@ -15,13 +15,27 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-09 00:00:00 +02:00
18
+ date: 2010-09-30 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: jzip
22
+ name: authlogic
23
23
  prerelease: false
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: jzip
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
25
39
  none: false
26
40
  requirements:
27
41
  - - ">="
@@ -33,11 +47,11 @@ dependencies:
33
47
  - 10
34
48
  version: 1.0.10
35
49
  type: :runtime
36
- version_requirements: *id001
50
+ version_requirements: *id002
37
51
  - !ruby/object:Gem::Dependency
38
52
  name: haml
39
53
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
54
+ requirement: &id003 !ruby/object:Gem::Requirement
41
55
  none: false
42
56
  requirements:
43
57
  - - ">="
@@ -47,11 +61,11 @@ dependencies:
47
61
  - 3
48
62
  version: "3"
49
63
  type: :runtime
50
- version_requirements: *id002
64
+ version_requirements: *id003
51
65
  - !ruby/object:Gem::Dependency
52
66
  name: formtastic
53
67
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
68
+ requirement: &id004 !ruby/object:Gem::Requirement
55
69
  none: false
56
70
  requirements:
57
71
  - - "="
@@ -63,7 +77,7 @@ dependencies:
63
77
  - 7
64
78
  version: 0.9.7
65
79
  type: :runtime
66
- version_requirements: *id003
80
+ version_requirements: *id004
67
81
  description: Rich-CMS is a module of E9s (http://github.com/archan937/e9s) which provides a frontend for your CMS content. You can use this gem to manage CMS content or translations (in an internationalized application). The installation and setup process is very easily done. You will have to register content at the Rich-CMS engine and also you will have to specify the authentication mechanism. Both are one-liners.
68
82
  email: paul.engel@holder.nl
69
83
  executables: []
@@ -131,6 +145,15 @@ files:
131
145
  - lib/rich/cms/engine.rb
132
146
  - lib/rich_cms.rb
133
147
  - rails/init.rb
148
+ - rails_generators/rich_authlogic_user/rich_authlogic_user_generator.rb
149
+ - rails_generators/rich_authlogic_user/templates/config.rb
150
+ - rails_generators/rich_authlogic_user/templates/migration.rb
151
+ - rails_generators/rich_authlogic_user/templates/model.rb
152
+ - rails_generators/rich_authlogic_user/templates/session.rb
153
+ - rails_generators/rich_cms_content/rich_cms_content_generator.rb
154
+ - rails_generators/rich_cms_content/templates/config.rb
155
+ - rails_generators/rich_cms_content/templates/migration.rb
156
+ - rails_generators/rich_cms_content/templates/model.rb
134
157
  - rich_cms.gemspec
135
158
  - tasks/rich_cms_tasks.rake
136
159
  - test/engine_test.rb