bcms_twitter_module 1.1.3

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.
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
@@ -0,0 +1,28 @@
1
+ # Browser CMS twitter timeline Module
2
+
3
+ Twitter timeline module for BrowserCMS gives you a portlet to display a users Twitter timeline. It will cache the timeline and you can also change the amount of tweets that are pulled.
4
+
5
+ ## Getting Started
6
+
7
+ ### Installation
8
+ Have a look here to see how BrowserCMS modules installs in BrowserCMS (http://guides.browsercms.org/installing_modules.html)
9
+
10
+ gem install bcms_twitter_module
11
+
12
+ ### Configuration changes
13
+
14
+ Edit config/environment.rb
15
+
16
+ config.gem "browsercms"
17
+ config.gem "bcms_contact_us_module"
18
+
19
+ Run this
20
+
21
+ script/generate browser_cms
22
+ rake db:migrate
23
+
24
+ ## License
25
+ Twitter Timeline is released under a LGPL license, and is copyright 1998-2011 Freddy Andersen, Zerolimits Technology. The complete copyright can be found in COPYRIGHT.txt, and copy of the license can be found in LICENSE.txt.
26
+
27
+ ## Support
28
+ If you have problems with this module add a new issue under the issues tab on github
@@ -0,0 +1,10 @@
1
+ # Filters added to this controller apply to all controllers in the application.
2
+ # Likewise, all the methods added will be available for all controllers.
3
+
4
+ class ApplicationController < ActionController::Base
5
+ helper :all # include all helpers, all the time
6
+ protect_from_forgery # See ActionController::RequestForgeryProtection for details
7
+
8
+ # Scrub sensitive parameters from your log
9
+ # filter_parameter_logging :password
10
+ end
@@ -0,0 +1,3 @@
1
+ # Methods added to this helper will be available to all templates in the application.
2
+ module ApplicationHelper
3
+ end
@@ -0,0 +1,41 @@
1
+ require 'timeout'
2
+ require 'twitter'
3
+
4
+ class Timeline < ActiveRecord::Base
5
+ TIMEOUT = 10
6
+ TTL = 30.minutes
7
+
8
+ validates_presence_of :username
9
+
10
+ def get_timeline(tweet_amount=1)
11
+
12
+ # Remove the cached timeline if its expired
13
+ if self.expires_at.nil? || self.expires_at < Time.now.utc
14
+ Rails.cache.delete('Timeline.Tweets')
15
+ end
16
+
17
+ # Make sure to invalidate the cache if the amount chanages
18
+ Rails.cache.fetch('Timeline.Tweets' + tweet_amount.to_s) { get_timeline_from_twitter(tweet_amount) }
19
+
20
+ end
21
+
22
+ private
23
+
24
+ def get_timeline_from_twitter(tweet_amount=1)
25
+
26
+ begin
27
+
28
+ # New expires time for this timeline
29
+ update_attribute(:expires_at, Time.now.utc + TTL)
30
+
31
+ Timeout.timeout(TIMEOUT) {
32
+ content = Twitter.user_timeline(self.username)[0..(tweet_amount.to_i - 1)]
33
+ }
34
+
35
+ rescue SocketError, Timeout::Error, Twitter::General => exception
36
+ logger.error("Loading timeline for user #{self.username} failed with the following error #{exception.inspect}")
37
+ end
38
+
39
+ end
40
+
41
+ end
@@ -0,0 +1,5 @@
1
+ ##
2
+ # All methods from this helper will be available in the render.html.erb for TwitterUserTimelinePortlet
3
+ module TwitterUserTimelinePortletHelper
4
+
5
+ end
@@ -0,0 +1,14 @@
1
+ class TwitterUserTimelinePortlet < Portlet
2
+
3
+ # Mark this as 'true' to allow the portlet's template to be editable via the CMS admin UI.
4
+ enable_template_editor true
5
+
6
+ def render
7
+ raise ArgumentError, "No Twitter Username was given" if self.username.blank?
8
+
9
+ @items = Timeline.find_or_create_by_username(self.username).get_timeline(@portlet.limit)
10
+
11
+ instance_eval(self.code) unless self.code.blank?
12
+ end
13
+
14
+ end
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
5
+ <title><%= page_title %></title>
6
+ <%= yield :html_head %>
7
+ </head>
8
+ <body>
9
+ <%= cms_toolbar %>
10
+ <%= container :main %>
11
+ </body>
12
+ </html>
@@ -0,0 +1,10 @@
1
+ <%= f.cms_text_field :name, :instructions => 'Add a useful name like "Twitter timeline: username"' %>
2
+ <%= f.cms_text_field :username, :instructions => 'This is your Twitter username' %>
3
+ <%= f.cms_drop_down :limit,
4
+ [
5
+ ['Unlimited','0'],['1','1'],['2','2'],['3','3'],['4','4'],['5','5'],['6','6'],['7','7'],['8','8'],['9','9'],
6
+ ['10','10'],['11','11'],['12','12'],['13','13'],['14','14'],['15','15'],['16','16'],['17','17'],['18','18'],['19','19'],
7
+ ['20','20']
8
+ ], :instructions => 'The timeline is available in the @items variable.'
9
+ %>
10
+ <%= f.cms_template_editor :template %>
@@ -0,0 +1,20 @@
1
+ <div class="timeline-<%= @portlet.id %>">
2
+
3
+ <h2>@<%= h @items.first.user.screen_name %></h2>
4
+
5
+ <h4>Location: <%= h @items.first.user.location %></h4>
6
+ <h4>Description: <%= h @items.first.user.description %></h4>
7
+
8
+ <p>
9
+ <%= image_tag @items.first.user.profile_image_url %>
10
+ </p>
11
+
12
+ <ul>
13
+ <% @items.each do |item| %>
14
+
15
+ <li><%= item.text %> <small><%= time_ago_in_words(item.created_at) %></small></li>
16
+
17
+ <% end %>
18
+ </ul>
19
+
20
+ </div>
@@ -0,0 +1,274 @@
1
+ class Browsercms300 < ActiveRecord::Migration
2
+ def self.up
3
+ create_table "users", :force => true do |t|
4
+ t.column :login, :string, :limit => 40
5
+ t.column :first_name, :string, :limit => 40
6
+ t.column :last_name, :string, :limit => 40
7
+ t.column :email, :string, :limit => 40
8
+ t.column :crypted_password, :string, :limit => 40
9
+ t.column :salt, :string, :limit => 40
10
+ t.column :created_at, :datetime
11
+ t.column :updated_at, :datetime
12
+ t.column :expires_at, :datetime
13
+ t.column :remember_token, :string, :limit => 40
14
+ t.column :remember_token_expires_at, :datetime
15
+ end
16
+ add_index :users, :login, :unique => true
17
+
18
+ create_versioned_table :dynamic_views do |t|
19
+ t.string :type
20
+ t.string :name
21
+ t.string :format
22
+ t.string :handler
23
+ t.text :body
24
+ t.timestamps
25
+ end
26
+
27
+ create_versioned_table :pages do |t|
28
+ t.string :name
29
+ t.string :title
30
+ t.string :path
31
+ t.string :template_file_name
32
+ t.text :description
33
+ t.text :keywords
34
+ t.string :language
35
+ t.boolean :cacheable, :default => false
36
+ t.boolean :hidden, :default => false
37
+ end
38
+
39
+ create_table :content_type_groups do |t|
40
+ t.string :name
41
+ t.timestamps
42
+ end
43
+ ContentTypeGroup.create!(:name => "Core")
44
+
45
+ create_table :content_types do |t|
46
+ t.string :name
47
+ t.belongs_to :content_type_group
48
+ t.integer :priority, :default => 2
49
+ t.timestamps
50
+ end
51
+
52
+ create_table :category_types do |t|
53
+ t.string :name
54
+ t.timestamps
55
+ end
56
+ ContentType.create!(:name => "CategoryType", :group_name => "Categorization")
57
+
58
+ create_table :categories do |t|
59
+ t.belongs_to :category_type
60
+ t.belongs_to :parent
61
+ t.string :name
62
+ t.timestamps
63
+ end
64
+ ContentType.create!(:name => "Category", :group_name => "Categorization")
65
+
66
+ create_table :connectors do |t|
67
+ t.integer :page_id
68
+ t.integer :page_version
69
+ t.integer :connectable_id
70
+ t.string :connectable_type
71
+ t.integer :connectable_version
72
+ t.string :container
73
+ t.integer :position
74
+ t.timestamps
75
+ end
76
+
77
+ create_versioned_table :html_blocks do |t|
78
+ t.string :name
79
+ t.string :content, :limit => 64.kilobytes + 1
80
+ end
81
+ ContentType.create!(:name => "HtmlBlock", :group_name => "Core", :priority => 1)
82
+
83
+ create_table :sections do |t|
84
+ t.string :name
85
+ t.string :path
86
+ t.boolean :root, :default => false
87
+ t.boolean :hidden, :default => false
88
+ t.timestamps
89
+ end
90
+
91
+ create_table :portlets do |t|
92
+ t.string :type
93
+ t.string :name
94
+ t.boolean :archived, :default => false
95
+ t.boolean :deleted, :default => false
96
+ t.integer :created_by_id, :updated_by_id
97
+ t.timestamps
98
+ end
99
+ create_table :portlet_attributes do |t|
100
+ t.integer :portlet_id
101
+ t.string :name
102
+ t.text :value
103
+ end
104
+ ContentType.create!(:name => "Portlet", :group_name => "Core", :priority => 1)
105
+
106
+ create_table :redirects do |t|
107
+ t.string :from_path
108
+ t.string :to_path
109
+ t.timestamps
110
+ end
111
+
112
+ create_versioned_table :attachments do |t|
113
+ t.string :file_path
114
+ t.string :file_location
115
+ t.string :file_extension
116
+ t.string :file_type
117
+ t.integer :file_size
118
+ t.timestamps
119
+ end
120
+
121
+ create_versioned_table :file_blocks do |t|
122
+ t.string :type
123
+ t.string :name
124
+ t.integer :attachment_id
125
+ t.integer :attachment_version
126
+ end
127
+ ContentType.create!(:name => "FileBlock", :group_name => "Core")
128
+ ContentType.create!(:name => "ImageBlock", :group_name => "Core")
129
+
130
+ create_table :group_types do |t|
131
+ t.string :name
132
+ t.boolean :guest, :default => false
133
+ t.boolean :cms_access, :default => false
134
+ t.timestamps
135
+ end
136
+ create_table :groups do |t|
137
+ t.string :name
138
+ t.string :code
139
+ t.integer :group_type_id
140
+ t.timestamps
141
+ end
142
+ create_table :user_group_memberships do |t|
143
+ t.integer :user_id
144
+ t.integer :group_id
145
+ end
146
+
147
+ create_table :permissions do |t|
148
+ t.string :name
149
+ t.string :full_name
150
+ t.string :description
151
+ t.string :for_module
152
+ t.timestamps
153
+ end
154
+ create_table :group_permissions do |t|
155
+ t.integer :group_id
156
+ t.integer :permission_id
157
+ end
158
+ create_table :group_type_permissions do |t|
159
+ t.integer :group_type_id
160
+ t.integer :permission_id
161
+ end
162
+ create_table :group_sections do |t|
163
+ t.integer :group_id
164
+ t.integer :section_id
165
+ end
166
+
167
+ create_table :sites do |t|
168
+ t.string :name
169
+ t.string :domain
170
+ t.boolean :the_default
171
+ t.timestamps
172
+ end
173
+
174
+ create_table :section_nodes do |t|
175
+ t.integer :section_id
176
+ t.string :node_type
177
+ t.integer :node_id
178
+ t.integer :position
179
+ t.timestamps
180
+ end
181
+
182
+ create_versioned_table :links do |t|
183
+ t.string :name
184
+ t.string :url
185
+ t.boolean :new_window, :default => false
186
+ t.timestamps
187
+ end
188
+
189
+ create_table :tags do |t|
190
+ t.string :name
191
+ t.timestamps
192
+ end
193
+ ContentType.create!(:name => "Tag", :group_name => "Categorization")
194
+
195
+ create_table :taggings do |t|
196
+ t.integer :tag_id
197
+ t.integer :taggable_id
198
+ t.string :taggable_type
199
+ t.integer :taggable_version
200
+ t.timestamps
201
+ end
202
+
203
+ create_table :email_messages do |t|
204
+ t.string :sender
205
+ t.text :recipients
206
+ t.text :subject
207
+ t.text :cc
208
+ t.text :bcc
209
+ t.text :body
210
+ t.string :content_type
211
+ t.datetime :delivered_at
212
+ t.timestamps
213
+ end
214
+
215
+ create_table :tasks do |t|
216
+ t.integer :assigned_by_id
217
+ t.integer :assigned_to_id
218
+ t.integer :page_id
219
+ t.text :comment
220
+ t.date :due_date
221
+ t.datetime :completed_at
222
+ t.timestamps
223
+ end
224
+
225
+ create_table :page_routes do |t|
226
+ t.string :name
227
+ t.string :pattern
228
+ t.belongs_to :page
229
+ t.text :code
230
+ t.timestamps
231
+ end
232
+ create_table :page_route_options do |t|
233
+ t.belongs_to :page_route
234
+ t.string :type
235
+ t.string :name
236
+ t.string :value
237
+ t.timestamps
238
+ end
239
+ end
240
+
241
+ def self.down
242
+ drop_table :page_route_options
243
+ drop_table :page_routes
244
+ drop_table :tasks
245
+ drop_table :email_messages
246
+ drop_table :taggings
247
+ drop_table :tags
248
+ drop_versioned_table :links
249
+ drop_table :section_nodes
250
+ drop_table :sites
251
+ drop_table :group_sections
252
+ drop_table :group_type_permissions
253
+ drop_table :group_permissions
254
+ drop_table :permissions
255
+ drop_table :user_group_memberships
256
+ drop_table :groups
257
+ drop_table :group_types
258
+ drop_versioned_table :file_blocks
259
+ drop_table :attachments
260
+ drop_table :redirects
261
+ drop_table :portlet_attributes
262
+ drop_table :portlets
263
+ drop_table :sections
264
+ drop_versioned_table :html_blocks
265
+ drop_table :connectors
266
+ drop_table :categories
267
+ drop_table :category_types
268
+ drop_table :content_types
269
+ drop_table :content_type_groups
270
+ drop_versioned_table :pages
271
+ drop_versioned_table :dynamic_views
272
+ drop_table "users"
273
+ end
274
+ end
@@ -0,0 +1,63 @@
1
+ class LoadSeedData < ActiveRecord::Migration
2
+ extend Cms::DataLoader
3
+ def self.up
4
+ if %w[development test dev local].include?(Rails.env)
5
+ pwd = "cmsadmin"
6
+ else
7
+ pwd = (0..8).inject(""){|s,i| s << (('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a).rand}
8
+ end
9
+ User.current = create_user(:cmsadmin, :login => "cmsadmin", :first_name => "CMS", :last_name => "Administrator", :email => "cmsadmin@example.com", :password => pwd, :password_confirmation => pwd)
10
+
11
+ create_permission(:administrate, :name => "administrate", :full_name => "Administer CMS" , :description => "Allows users to administer the CMS, including adding users and groups.")
12
+ create_permission(:edit_content, :name => "edit_content", :full_name => "Edit Content" , :description => "Allows users to Add, Edit and Delete both Pages and Blocks. Can Save (but not Publish) and Assign them as well.")
13
+ create_permission(:publish_content, :name => "publish_content", :full_name => "Publish Content" , :description => "Allows users to Save and Publish, Hide and Archive both Pages and Blocks.")
14
+
15
+ create_group_type(:guest_group_type, :name => "Guest", :guest => true)
16
+ create_group_type(:registered_public_user, :name => "Registered Public User")
17
+ create_group_type(:cms_user, :name => "CMS User", :cms_access => true)
18
+ group_types(:cms_user).permissions<<permissions(:edit_content)
19
+ group_types(:cms_user).permissions<<permissions(:publish_content)
20
+
21
+ create_group(:guest, :name => 'Guest', :code => 'guest', :group_type => group_types(:guest_group_type))
22
+ create_group(:content_admin, :name => 'Cms Administrators', :code => 'cms-admin', :group_type => group_types(:cms_user))
23
+ create_group(:content_editor, :name => 'Content Editors', :code => 'content-editor', :group_type => group_types(:cms_user))
24
+ users(:cmsadmin).groups << groups(:content_admin)
25
+ users(:cmsadmin).groups << groups(:content_editor)
26
+
27
+ groups(:content_admin).permissions<<permissions(:administrate)
28
+ groups(:content_editor).permissions<<permissions(:edit_content)
29
+ groups(:content_editor).permissions<<permissions(:publish_content)
30
+
31
+ create_site(:default, :name => "Default", :domain => "example.com")
32
+ create_section(:root, :name => "My Site", :path => "/", :root => true)
33
+ create_section(:system, :name => "system", :parent => sections(:root), :path => "/system", :hidden => true)
34
+
35
+ Group.all.each{|g| g.sections = Section.all }
36
+
37
+ create_page(:home, :name => "Home", :path => "/", :section => sections(:root), :template_file_name => "default.html.erb", :cacheable => true)
38
+ create_page(:not_found, :name => "Page Not Found", :path => "/system/not_found", :section => sections(:system), :template_file_name => "default.html.erb", :publish_on_save => true, :hidden => true, :cacheable => true)
39
+ create_page(:access_denied, :name => "Access Denied", :path => "/system/access_denied", :section => sections(:system), :template_file_name => "default.html.erb", :publish_on_save => true, :hidden => true, :cacheable => true)
40
+ create_page(:server_error, :name => "Server Error", :path => "/system/server_error", :section => sections(:system), :template_file_name => "default.html.erb", :publish_on_save => true, :hidden => true, :cacheable => true)
41
+
42
+ create_html_block(:page_not_found, :name => "Page Not Found", :content => "<p>The page you tried to access does not exist on this server.</p>", :publish_on_save => true)
43
+ pages(:not_found).create_connector(html_blocks(:page_not_found), "main")
44
+ pages(:not_found).publish!
45
+
46
+ create_html_block(:access_denied, :name => "Access Denied", :content => "<p>You have tried to reach a resource or page which you do not have permission to view.</p>", :publish_on_save => true)
47
+ pages(:access_denied).create_connector(html_blocks(:access_denied), "main")
48
+ pages(:access_denied).publish!
49
+
50
+ create_html_block(:server_error, :name => "Server Error", :content => "<p>The server encountered an unexpected condition that prevented it from fulfilling the request.</p>", :publish_on_save => true)
51
+ pages(:server_error).create_connector(html_blocks(:server_error), "main")
52
+ pages(:server_error).publish!
53
+ pages(:home).publish!
54
+
55
+ puts "*************************************************"
56
+ puts "* YOUR CMS username/password is: cmsadmin/#{pwd}"
57
+ puts "*************************************************"
58
+
59
+ end
60
+
61
+ def self.down
62
+ end
63
+ end
@@ -0,0 +1,9 @@
1
+ class Browsercms305 < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :users, :reset_token, :string
4
+ end
5
+
6
+ def self.down
7
+ remove_column :users, :reset_token
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ class CreateTimelines < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :timelines do |t|
4
+ t.string :username
5
+ t.datetime :expires_at
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+
11
+ def self.down
12
+ drop_table :timelines
13
+ end
14
+ end
@@ -0,0 +1 @@
1
+ require 'bcms_twitter_module/routes'
@@ -0,0 +1,7 @@
1
+ module Cms::Routes
2
+ def routes_for_bcms_twitter_module
3
+ namespace(:cms) do |cms|
4
+ #cms.content_blocks :twitter_modules
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ gem_root = File.expand_path(File.join(File.dirname(__FILE__), ".."))
2
+ Cms.add_to_rails_paths gem_root
3
+ Cms.add_generator_paths gem_root, "db/migrate/[0-9]*_*.rb"
4
+ Cms.add_generator_paths gem_root, "public/bcms/twitter_module/**/*"
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+ require 'performance_test_help'
3
+
4
+ # Profiling results for each test method are written to tmp/performance.
5
+ class BrowsingTest < ActionController::PerformanceTest
6
+ def test_homepage
7
+ get '/'
8
+ end
9
+ end
@@ -0,0 +1,38 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
3
+ require 'test_help'
4
+
5
+ class ActiveSupport::TestCase
6
+ # Transactional fixtures accelerate your tests by wrapping each test method
7
+ # in a transaction that's rolled back on completion. This ensures that the
8
+ # test database remains unchanged so your fixtures don't have to be reloaded
9
+ # between every test method. Fewer database queries means faster tests.
10
+ #
11
+ # Read Mike Clark's excellent walkthrough at
12
+ # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
13
+ #
14
+ # Every Active Record database supports transactions except MyISAM tables
15
+ # in MySQL. Turn off transactional fixtures in this case; however, if you
16
+ # don't care one way or the other, switching from MyISAM to InnoDB tables
17
+ # is recommended.
18
+ #
19
+ # The only drawback to using transactional fixtures is when you actually
20
+ # need to test transactions. Since your test is bracketed by a transaction,
21
+ # any transactions started in your code will be automatically rolled back.
22
+ self.use_transactional_fixtures = true
23
+
24
+ # Instantiated fixtures are slow, but give you @david where otherwise you
25
+ # would need people(:david). If you don't want to migrate your existing
26
+ # test cases which use the @david style and don't mind the speed hit (each
27
+ # instantiated fixtures translates to a database query per test method),
28
+ # then set this back to true.
29
+ self.use_instantiated_fixtures = false
30
+
31
+ # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
32
+ #
33
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
34
+ # -- they do not yet inherit this setting
35
+ fixtures :all
36
+
37
+ # Add more helper methods to be used by all tests here...
38
+ end
@@ -0,0 +1,9 @@
1
+ require File.join(File.dirname(__FILE__), '/../../test_helper')
2
+
3
+ class TwitterUserTimelineTest < ActiveSupport::TestCase
4
+
5
+ test "Should be able to create new instance of a portlet" do
6
+ assert TwitterUserTimelinePortlet.create!(:name => "New Portlet")
7
+ end
8
+
9
+ end
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class TimelineTest < ActiveSupport::TestCase
4
+ # Replace this with your real tests.
5
+ test "the truth" do
6
+ assert true
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bcms_twitter_module
3
+ version: !ruby/object:Gem::Version
4
+ hash: 21
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 1
9
+ - 3
10
+ version: 1.1.3
11
+ platform: ruby
12
+ authors:
13
+ - Freddy Andersen
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-01-14 00:00:00 -08:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: twitter
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 19
30
+ segments:
31
+ - 1
32
+ - 1
33
+ - 0
34
+ version: 1.1.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: A BrowserCMS module which fetches Twitter timelines
38
+ email: freddy@zerolimitstech.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - LICENSE.txt
45
+ - README.markdown
46
+ files:
47
+ - app/controllers/application_controller.rb
48
+ - app/helpers/application_helper.rb
49
+ - app/models/timeline.rb
50
+ - app/portlets/helpers/twitter_user_timeline_portlet_helper.rb
51
+ - app/portlets/twitter_user_timeline_portlet.rb
52
+ - app/views/layouts/templates/default.html.erb
53
+ - app/views/portlets/twitter_user_timeline/_form.html.erb
54
+ - app/views/portlets/twitter_user_timeline/render.html.erb
55
+ - db/migrate/20080815014337_browsercms_3_0_0.rb
56
+ - db/migrate/20081114172307_load_seed_data.rb
57
+ - db/migrate/20091109175123_browsercms_3_0_5.rb
58
+ - db/migrate/20101029045339_create_timelines.rb
59
+ - lib/bcms_twitter_module.rb
60
+ - lib/bcms_twitter_module/routes.rb
61
+ - rails/init.rb
62
+ - LICENSE.txt
63
+ - README.markdown
64
+ - test/performance/browsing_test.rb
65
+ - test/test_helper.rb
66
+ - test/unit/portlets/twitter_user_timeline_portlet_test.rb
67
+ - test/unit/timeline_test.rb
68
+ has_rdoc: true
69
+ homepage: http://github.com/heimdull/bcms_twitter_module
70
+ licenses: []
71
+
72
+ post_install_message:
73
+ rdoc_options: []
74
+
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ hash: 3
83
+ segments:
84
+ - 0
85
+ version: "0"
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ hash: 3
92
+ segments:
93
+ - 0
94
+ version: "0"
95
+ requirements: []
96
+
97
+ rubyforge_project:
98
+ rubygems_version: 1.4.1
99
+ signing_key:
100
+ specification_version: 3
101
+ summary: Twitter in BrowserCMS
102
+ test_files:
103
+ - test/performance/browsing_test.rb
104
+ - test/test_helper.rb
105
+ - test/unit/portlets/twitter_user_timeline_portlet_test.rb
106
+ - test/unit/timeline_test.rb