pagelime-rails 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6a600b851478397833e645e4a5861d381fe1e02
4
- data.tar.gz: 26992234cd2cd7b30471b1f3cadec3a9267e90b8
3
+ metadata.gz: 89efb96d666bc2018fa4afb670fb9a3280cbfb76
4
+ data.tar.gz: 44b9b84b7e0f39348865dbe6438a5fd356f718e4
5
5
  SHA512:
6
- metadata.gz: 1ad60030c4d9c480bc1ce274464336b9613c455339b4c0b76849a2a82cf2cdb82a586574a3c30449bf26251a5b5a1abad8f7c0587872b433268b85cf0b4fb1e2
7
- data.tar.gz: ebd6d0d5138e8b5fc23892572a2c964c4ebb5061e7e41703ac1907e084caecc125ce475bb4665686e9b16c3b3124d4ed5951afb043adaa370fba4c1ff171501a
6
+ metadata.gz: 93874dc43eb8964a0f5f8389555c28ffc22717d9c7e925b7c0dda9a8a5ca525056e1f369c7911cab2d12b702bbd151f48fca618ce5e05796bf9981e9775e6c53
7
+ data.tar.gz: bb1dc6ab448bacbf48b70721009190900621e9639a8d352b2de1d8fb4bda32eb4e7f91025a87257ce256d77cbc7980f2b5935b7ead96b9572b4b02dfae1c04aa
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source "http://rubygems.org"
2
2
  # Add dependencies required to use your gem here.
3
3
  # Example:
4
4
 
5
- gem 'pagelime-rack', '>= 0.2.0'
5
+ gem 'pagelime-rack', '>= 0.3.0'
6
6
 
7
7
  # Add dependencies to develop your gem here.
8
8
  # Include everything needed to run rake, tests, features, etc.
@@ -99,4 +99,18 @@ Optionally: If you don't want to have your entire controller CMS editable for so
99
99
  </div>
100
100
  <% end %>
101
101
 
102
+ ### Step 5: Edit your pages!
103
+
104
+ #### For Heroku users
105
+
106
+ If you're using the Pagelime Heroku add-on, go to the Heroku admin for your app and under the "Resources" tab you will see the Pagelime add-on listed.
107
+ Click on the add-on name and you will be redirected to the Pagelime CMS editor.
108
+ From there you can edit any page in your Rails app!
109
+
110
+ #### For Pagelime.com users
111
+
112
+ If you have a standalone Pagelime account, simply go to [pagelime.com](http://pagelime.com) and edit your site as usual (see Step 2).
113
+
114
+
115
+
102
116
  Copyright (c) 2013 Pagelime LLC, released under the MIT license
data/Rakefile CHANGED
@@ -1,8 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'yaml'
4
- YAML::ENGINE.yamler= 'syck'
5
-
6
3
  require 'rubygems'
7
4
  require 'bundler'
8
5
  begin
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.3.0
@@ -5,91 +5,9 @@ class PagelimeReceiverController < ApplicationController
5
5
  end
6
6
 
7
7
  def after_publish_callback
8
-
9
- Pagelime.client.clear params[:path]
10
- Pagelime.client.clear_shared
8
+ Pagelime.cache.clear_page params[:path]
9
+ Pagelime.cache.clear_shared
11
10
 
12
- # don't do the prefetch below, as the page isn't done publishing (mySQL transaction hasn't completed) at the point when this gets called
13
- =begin
14
- begin
15
- new_content = fetch_cms_xml(params[:path]);
16
- rescue
17
- end
18
- =end
19
-
20
11
  render :inline => "cache cleared", :status => 200
21
-
22
12
  end
23
-
24
- def after_publish_callback_old
25
-
26
- # the page_id will come from the request
27
- page_id = params[:page_id]
28
-
29
- # TODO: use the API to get content
30
- uri = URI.parse("http://qa.cms.pagelime.com/API/Account/SOAP/Page.asmx/Get")
31
- http = Net::HTTP.new(uri.host, uri.port)
32
- # http.use_ssl = true
33
- http.open_timeout = 2
34
- http.read_timeout = 7
35
- # http.set_debug_output $stderr
36
- data = {:apiKey => "0fa155c4-9c42-4df6-856a-5cff6e2ff631", :pageId => page_id}.to_json
37
- response = http.post(uri.path,data,{"content-type"=>"application/json; charset=utf-8","accept"=>"application/json, text/javascript, */*"})
38
-
39
- page_json = JSON.parse(response.body)
40
- page_json = page_json["d"]
41
-
42
- # try to find existing page
43
- page = PagelimePage.find_by_page_id(page_id)
44
- if (page)
45
- # delete existing content
46
- page.editable_areas.destroy
47
- page.meta_data.destroy
48
- else
49
- # if no page is found, create a new one
50
- page = PagelimePage.new
51
- end
52
-
53
- # set the page data
54
- page.page_id = page_id
55
- page.path = page_json[:Path]
56
- page.title = page_json[:Title]
57
- page.date_published = DateTime.now
58
-
59
- # save the page
60
- page.save
61
-
62
- # for each piece of content
63
- for page_content_json in page_json["EditableRegions"]
64
-
65
- # create the content data
66
- page_content = PagelimeContent.new
67
- page_content.client_id = page_content_json[:ClientID]
68
- page_content.page = page
69
- page_content.html = page_content_json[:Html]
70
-
71
- # save content
72
- page_content.save
73
-
74
- end
75
-
76
- # for each piece of meta data
77
- for metadata_json in page_json["MetaDataJSON"]
78
-
79
- # create the content data
80
- page_metadata = PagelimeMetaData.new
81
- page_metadata.name = metadata_json[0]
82
- page_metadata.content = metadata_json[1]
83
- page_metadata.page = page
84
-
85
- # save content
86
- page_metadata.save
87
-
88
- end
89
-
90
- # respond with an OK status or CREATED status
91
- render :status => 200
92
-
93
- end
94
-
95
13
  end
@@ -3,7 +3,7 @@ module PagelimeHelper
3
3
  def cms_content(&block)
4
4
  # the block contents loaded into a variable
5
5
  input_content = capture(&block)
6
- html = ::Pagelime.processor.process_fragment(input_content, request.path)
6
+ html = ::Pagelime.process_region(input_content, request.path)
7
7
  # output the final content
8
8
  concat(html)
9
9
  # raw capture(&block) + "<div>hello world</div>"
@@ -1,7 +1,6 @@
1
1
  require 'pagelime-rack'
2
2
  require 'pagelime'
3
3
  require 'pagelime/rails'
4
- require 'pagelime/s3_rails_cache'
5
4
 
6
5
  Pagelime.logger.debug "PAGELIME CMS RAILS PLUGIN: pagelime-rails gem loaded"
7
6
 
@@ -35,8 +35,9 @@ module Pagelime
35
35
 
36
36
  def configure_pagelime!
37
37
  ::Pagelime.configure do |config|
38
- config.client_class = ::Pagelime::S3RailsCache
39
- config.logger = ::Rails.logger
38
+ config.logger = ::Rails.logger
39
+ config.cache = ::Rails.cache
40
+ config.cache_fetch_options = { :expires_in => 1.year }
40
41
  end
41
42
  end
42
43
  end
@@ -12,7 +12,7 @@ module Pagelime
12
12
  ::Rails.logger.debug "PAGELIME CMS RAILS PLUGIN: Processing response body in controller"
13
13
 
14
14
  # parse response body, cache, and use result as response body
15
- response.body = Pagelime.processor.process_document(response.body, request.path)
15
+ response.body = Pagelime.process_page(response.body, request.path)
16
16
  end
17
17
  end
18
18
 
@@ -5,19 +5,22 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "pagelime-rails"
8
- s.version = "0.2.2"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Emil Anticevic", "Joel Van Horn"]
12
- s.date = "2013-09-05"
12
+ s.date = "2013-09-11"
13
13
  s.description = ""
14
14
  s.email = "emil@pagelime.com"
15
+ s.extra_rdoc_files = [
16
+ "README.md"
17
+ ]
15
18
  s.files = [
16
19
  "Gemfile",
17
20
  "Heroku.md",
18
21
  "MIT-LICENSE",
22
+ "README.md",
19
23
  "Rakefile",
20
- "Readme.md",
21
24
  "VERSION",
22
25
  "app/controllers/pagelime_receiver_controller.rb",
23
26
  "app/helpers/pagelime_helper.rb",
@@ -29,7 +32,6 @@ Gem::Specification.new do |s|
29
32
  "lib/pagelime/rails/controller_extensions.rb",
30
33
  "lib/pagelime/rails/engine.rb",
31
34
  "lib/pagelime/rails/routing_extensions.rb",
32
- "lib/pagelime/s3_rails_cache.rb",
33
35
  "lib/tasks/pagelime.rake",
34
36
  "pagelime-rails.gemspec",
35
37
  "rails/init.rb",
@@ -47,16 +49,16 @@ Gem::Specification.new do |s|
47
49
  s.specification_version = 4
48
50
 
49
51
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
50
- s.add_runtime_dependency(%q<pagelime-rack>, [">= 0.2.0"])
52
+ s.add_runtime_dependency(%q<pagelime-rack>, [">= 0.3.0"])
51
53
  s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
52
54
  s.add_development_dependency(%q<jeweler>, [">= 1.6.4"])
53
55
  else
54
- s.add_dependency(%q<pagelime-rack>, [">= 0.2.0"])
56
+ s.add_dependency(%q<pagelime-rack>, [">= 0.3.0"])
55
57
  s.add_dependency(%q<bundler>, [">= 1.0.0"])
56
58
  s.add_dependency(%q<jeweler>, [">= 1.6.4"])
57
59
  end
58
60
  else
59
- s.add_dependency(%q<pagelime-rack>, [">= 0.2.0"])
61
+ s.add_dependency(%q<pagelime-rack>, [">= 0.3.0"])
60
62
  s.add_dependency(%q<bundler>, [">= 1.0.0"])
61
63
  s.add_dependency(%q<jeweler>, [">= 1.6.4"])
62
64
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagelime-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Anticevic
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-05 00:00:00.000000000 Z
12
+ date: 2013-09-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pagelime-rack
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - '>='
19
19
  - !ruby/object:Gem::Version
20
- version: 0.2.0
20
+ version: 0.3.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '>='
26
26
  - !ruby/object:Gem::Version
27
- version: 0.2.0
27
+ version: 0.3.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: bundler
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -57,13 +57,14 @@ description: ''
57
57
  email: emil@pagelime.com
58
58
  executables: []
59
59
  extensions: []
60
- extra_rdoc_files: []
60
+ extra_rdoc_files:
61
+ - README.md
61
62
  files:
62
63
  - Gemfile
63
64
  - Heroku.md
64
65
  - MIT-LICENSE
66
+ - README.md
65
67
  - Rakefile
66
- - Readme.md
67
68
  - VERSION
68
69
  - app/controllers/pagelime_receiver_controller.rb
69
70
  - app/helpers/pagelime_helper.rb
@@ -75,7 +76,6 @@ files:
75
76
  - lib/pagelime/rails/controller_extensions.rb
76
77
  - lib/pagelime/rails/engine.rb
77
78
  - lib/pagelime/rails/routing_extensions.rb
78
- - lib/pagelime/s3_rails_cache.rb
79
79
  - lib/tasks/pagelime.rake
80
80
  - pagelime-rails.gemspec
81
81
  - rails/init.rb
@@ -1,53 +0,0 @@
1
- module Pagelime
2
- class S3RailsCache < S3Client
3
- module ClassMethods
4
- def generate_cache_key(page_path, format = default_format)
5
- "pagelime:cms:#{format}:page:#{Base64.encode64(page_path)}"
6
- end
7
-
8
- def shared_cache_key(format = default_format)
9
- "pagelime:cms:#{format}:shared"
10
- end
11
- end
12
-
13
- extend ClassMethods
14
-
15
- def fetch(page_path, format = self.class.default_format)
16
- cache_key = self.class.generate_cache_key(page_path, format)
17
-
18
- value = ::Rails.cache.fetch(cache_key, :expires_in => 1.year) do
19
- Pagelime.logger.debug "PAGELIME CMS RAILS PLUGIN: NO '#{page_path}' CACHE... loading #{format}"
20
- super
21
- end
22
-
23
- Pagelime.logger.debug "PAGELIME CMS RAILS PLUGIN: fetch (#{page_path}) value: #{value.inspect}"
24
-
25
- value
26
- end
27
-
28
- def fetch_shared(format = self.class.default_format)
29
- cache_key = self.class.shared_cache_key(format)
30
-
31
- value = ::Rails.cache.fetch(cache_key, :expires_in => 1.year) do
32
- Pagelime.logger.debug "PAGELIME CMS RAILS PLUGIN: NO SHARED CACHE... loading #{format}"
33
- super
34
- end
35
-
36
- Pagelime.logger.debug "PAGELIME CMS RAILS PLUGIN: fetch_shared value: #{value.inspect}"
37
-
38
- value
39
- end
40
-
41
- def clear(page_path, format = self.class.default_format)
42
- cache_key = self.class.generate_cache_key(page_path, format)
43
-
44
- ::Rails.cache.delete cache_key
45
- end
46
-
47
- def clear_shared(format = self.class.default_format)
48
- cache_key = self.class.shared_cache_key(format)
49
-
50
- ::Rails.cache.delete cache_key
51
- end
52
- end
53
- end