contentful-scheduler 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4cc702a2147e9c4e058dc6d127ebcb881b3f333f
4
+ data.tar.gz: 572bbe565827d7ecc00245adc776e1217ab8b4dd
5
+ SHA512:
6
+ metadata.gz: 51f8f0fe78824e9d431b63600daa168681b7b577cfd128d9db55d1df29783f487f85455a054a9e0e4122f76ea1f5c5f9633cbfbfafb057ad174108907c868b7a
7
+ data.tar.gz: 09ab916ac339b3ac5b9627d7c63cec79ed14d690d0b59fd7c6ca3b7702d69e47094b2aa7b210a70e05d79a437dfac1fdc6b988b7ac5342a3b8dfb35feacb7494
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .DS_Store
11
+ dump.rdb
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.10.6
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in contentful-scheduler.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,5 @@
1
+ guard :rspec, cmd: 'rspec --format documentation --color' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { "spec" }
5
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Contentful GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,181 @@
1
+ # Contentful Scheduler
2
+
3
+ Scheduling Server for Contentful entries.
4
+
5
+ ## Contentful
6
+ [Contentful](http://www.contentful.com) is a content management platform for web applications,
7
+ mobile apps and connected devices. It allows you to create, edit & manage content in the cloud
8
+ and publish it anywhere via powerful API. Contentful offers tools for managing editorial
9
+ teams and enabling cooperation between organizations.
10
+
11
+ ## What does `contentful-scheduler` do?
12
+ The aim of `contentful-scheduler` is to have developers setting up their Contentful
13
+ entries for scheduled publishing.
14
+
15
+ ## How does it work
16
+ `contentful-scheduler` provides a web endpoint to receive webhook calls from Contentful,
17
+ every time the endpoint recieves a call it looks for the value of the field defined in the configuration,
18
+ if the value is a time in the future it will schedule the entry for publishing at the specified time.
19
+ A background worker based on the popular `resque` gem will then proceed to actually make the publish call
20
+ against the Content Management API at the due time. For this the Entries you wish to publish require a
21
+ customizable Date field, which we advice to call `publishDate`, this field can be configured inside your
22
+ `Rakefile` and is specific per-space.
23
+
24
+ You can add multiple spaces to your configuration, making it useful if you have a milti-space setup.
25
+
26
+ ## Requirements
27
+
28
+ * [Redis](http://redis.io/)
29
+
30
+ ## Installation
31
+
32
+ Add this line to your application's Gemfile:
33
+
34
+ ```ruby
35
+ gem 'contentful-scheduler'
36
+ ```
37
+
38
+ And then execute:
39
+
40
+ $ bundle
41
+
42
+ Or install it yourself as:
43
+
44
+ $ gem install contentful-scheduler
45
+
46
+ ## Usage
47
+
48
+ The best way to use Scheduler is as a stand-alone application that wraps Scheduler and Resque on an execution pipe using [Foreman](http://ddollar.github.io/foreman/).
49
+
50
+ You can get the template for this setup in the [`/example`](./example) directory.
51
+
52
+ If you want to roll out your own, you need to follow the next steps:
53
+
54
+ * Create a new folder
55
+ * Create a `Gemfile` with the following:
56
+
57
+ ```ruby
58
+ source 'https://rubygems.org'
59
+
60
+ gem 'contentful-scheduler', '~> 0.1'
61
+ gem 'contentful-management', '~> 1.0'
62
+ gem 'resque', '~> 1.0'
63
+ gem 'resque-scheduler', '~> 4.0'
64
+ gem 'rake'
65
+ ```
66
+
67
+ * Create a `Procfile` with the following:
68
+
69
+ ```
70
+ web: env bundle exec rake contentful:scheduler
71
+ monitor: env bundle exec rackup
72
+ resque: env bundle exec rake resque:work
73
+ resque_scheduler: env bundle exec rake resque:scheduler
74
+ ```
75
+
76
+ * Create a `Rakefile` with the following:
77
+
78
+ ```ruby
79
+ require 'contentful/scheduler'
80
+
81
+ $stdout.sync = true
82
+
83
+ config = {
84
+ logger: Logger.new(STDOUT), # Defaults to NullLogger
85
+ port: 32123, # Defaults to 32123
86
+ endpoint: '/scheduler', # Defaults to /scheduler
87
+ redis: {
88
+ host: 'YOUR_REDIS_HOST',
89
+ port: 'YOUR_REDIS_PORT',
90
+ password: 'YOUR_REDIS_PASSWORD'
91
+ },
92
+ spaces: {
93
+ 'YOUR_SPACE_ID' => {
94
+ publish_field: 'publishDate', # It specifies the field ID for your Publish Date in your Content Type
95
+ management_token: 'YOUR_TOKEN'
96
+ }
97
+ },
98
+ }
99
+
100
+ namespace :contentful do
101
+ task :setup do
102
+ Contentful::Scheduler.config = config
103
+ end
104
+
105
+ task :scheduler => :setup do
106
+ Contentful::Scheduler.start
107
+ end
108
+ end
109
+
110
+ require 'resque/tasks'
111
+ require 'resque/scheduler/tasks'
112
+
113
+ namespace :resque do
114
+ task :setup => 'contentful:setup' do
115
+ ENV['QUEUE'] = '*'
116
+ end
117
+
118
+ task :setup_schedule => :setup do
119
+ require 'resque-scheduler'
120
+ end
121
+
122
+ task :scheduler => :setup_schedule
123
+ end
124
+ ```
125
+
126
+ * Create a `config.ru` with the following for the Resque monitoring server:
127
+
128
+ ```ruby
129
+ require 'resque'
130
+ require 'resque/server'
131
+ require 'resque/scheduler/server'
132
+
133
+ config = {
134
+ host: 'YOUR_REDIS_HOST',
135
+ port: 'YOUR_REDIS_PORT',
136
+ password: 'YOUR_REDIS_PASSWORD'
137
+ }
138
+ Resque.redis = config
139
+
140
+ run Rack::URLMap.new \
141
+ "/" => Resque::Server.new
142
+ ```
143
+
144
+ * Run the Application:
145
+
146
+ ```bash
147
+ $ foreman start
148
+ ```
149
+
150
+ * Configure the webhook in Contentful:
151
+
152
+ Under the space settings menu choose webhook and add a new webhook pointing to `http://YOUR_SERVER:32123/scheduler`.
153
+
154
+ Keep in mind that if you modify the defaults, the URL should be changed to the values specified in the configuration.
155
+
156
+ ## Running in Heroku
157
+
158
+ Heroku offers various Redis plugins, select the one of your liking, add the credentials into your configuration, and proceed to
159
+ `git heroku push master`.
160
+
161
+ This will get your application set up and running. It will require 4 dynos, so a free plan isn't enough for it to run.
162
+
163
+ To run the `monitor` process, you'll require to run it from a different application pointing to the same Redis instance.
164
+
165
+ Make sure to change the `Procfile`'s `web` process to the following:
166
+
167
+ ```
168
+ web: PORT=$PORT bundle exec env rake contentful:scheduler
169
+ ```
170
+
171
+ That will allow Heroku to set it's own Port according to their policy.
172
+
173
+ The URL for the webhook then will be on port 80, so you should change it to: `http://YOUR_APPLICATION/scheduler`.
174
+
175
+ ## Contributing
176
+
177
+ Bug reports and pull requests are welcome on GitHub at https://github.com/contentful/contentful-scheduler.rb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
178
+
179
+ ## License
180
+
181
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ require 'contentful/scheduler/tasks'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task :default => :spec
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'contentful/scheduler/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "contentful-scheduler"
8
+ spec.version = Contentful::Scheduler::VERSION
9
+ spec.authors = ["Contentful GmbH (David Litvak Bruno0"]
10
+ spec.email = ["david.litvak@contentful.com"]
11
+
12
+ spec.summary = %q{Customizable Scheduler for Contentful Entries.}
13
+ spec.description = %q{Customizable Scheduler for Contentful Entries.}
14
+ spec.homepage = "https://www.contentful.com"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_runtime_dependency "contentful-webhook-listener", "~> 0.2"
23
+ spec.add_runtime_dependency "contentful-management", "~> 1.0"
24
+ spec.add_runtime_dependency "resque", "~> 1.0"
25
+ spec.add_runtime_dependency "resque-scheduler", "~> 4.0"
26
+ spec.add_runtime_dependency "redis", "~> 3.0"
27
+
28
+ spec.add_development_dependency "bundler", "~> 1.10"
29
+ spec.add_development_dependency "rake", "~> 10.0"
30
+ spec.add_development_dependency "rspec"
31
+ spec.add_development_dependency "guard"
32
+ spec.add_development_dependency "guard-rspec"
33
+ end
data/example/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'contentful-scheduler', '~> 0.1'
4
+ gem 'contentful-management', '~> 1.0'
5
+ gem 'resque', '~> 1.0'
6
+ gem 'resque-scheduler', '~> 4.0'
7
+ gem 'rake'
data/example/Procfile ADDED
@@ -0,0 +1,4 @@
1
+ web: env bundle exec rake contentful:scheduler
2
+ monitor: env bundle exec rackup
3
+ resque: env bundle exec rake resque:work
4
+ resque_scheduler: env bundle exec rake resque:scheduler
data/example/Rakefile ADDED
@@ -0,0 +1,46 @@
1
+ require 'contentful/scheduler'
2
+ require 'logger' # Optional
3
+
4
+ $stdout.sync = true
5
+
6
+ config = {
7
+ logger: Logger.new(STDOUT), # Defaults to NullLogger
8
+ port: 32123, # Defaults to 32123
9
+ endpoint: '/scheduler', # Defaults to /scheduler
10
+ redis: {
11
+ host: 'YOUR_REDIS_HOST',
12
+ port: 'YOUR_REDIS_PORT',
13
+ password: 'YOUR_REDIS_PASSWORD'
14
+ },
15
+ spaces: {
16
+ 'YOUR_SPACE_ID' => {
17
+ publish_field: 'publishDate', # It specifies the field ID for your Publish Date in your Content Type
18
+ management_token: 'YOUR_TOKEN'
19
+ }
20
+ }
21
+ }
22
+
23
+ namespace :contentful do
24
+ task :setup do
25
+ Contentful::Scheduler.config = config
26
+ end
27
+
28
+ task :scheduler => :setup do
29
+ Contentful::Scheduler.start
30
+ end
31
+ end
32
+
33
+ require 'resque/tasks'
34
+ require 'resque/scheduler/tasks'
35
+
36
+ namespace :resque do
37
+ task :setup => 'contentful:setup' do
38
+ ENV['QUEUE'] = '*'
39
+ end
40
+
41
+ task :setup_schedule => :setup do
42
+ require 'resque-scheduler'
43
+ end
44
+
45
+ task :scheduler => :setup_schedule
46
+ end
data/example/config.ru ADDED
@@ -0,0 +1,13 @@
1
+ require 'resque'
2
+ require 'resque/server'
3
+ require 'resque/scheduler/server'
4
+
5
+ config = {
6
+ host: 'YOUR_REDIS_HOST',
7
+ port: 'YOUR_REDIS_PORT',
8
+ password: 'YOUR_REDIS_PASSWORD'
9
+ }
10
+ Resque.redis = config
11
+
12
+ run Rack::URLMap.new \
13
+ "/" => Resque::Server.new
@@ -0,0 +1,30 @@
1
+ require 'contentful/webhook/listener'
2
+ require_relative 'queue'
3
+
4
+ module Contentful
5
+ module Scheduler
6
+ class Controller < ::Contentful::Webhook::Listener::Controllers::WebhookAware
7
+ def create
8
+ return unless webhook.entry?
9
+
10
+ logger.info "Queueing - Space: #{webhook.space_id} - Entry: #{webhook.id}"
11
+
12
+ Queue.instance(logger).update_or_create(webhook)
13
+ end
14
+ alias_method :save, :create
15
+ alias_method :auto_save, :create
16
+ alias_method :unarchive, :create
17
+
18
+ def delete
19
+ return unless webhook.entry?
20
+
21
+ logger.info "Unqueueing - Space: #{webhook.space_id} - Entry: #{webhook.id}"
22
+
23
+ Queue.instance(logger).remove(webhook)
24
+ end
25
+ alias_method :unpublish, :delete
26
+ alias_method :archive, :delete
27
+ alias_method :publish, :delete
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,106 @@
1
+ require_relative "tasks"
2
+ require 'contentful/webhook/listener'
3
+
4
+ module Contentful
5
+ module Scheduler
6
+ class Queue
7
+ @@instance = nil
8
+
9
+ attr_reader :config, :logger
10
+
11
+ def self.instance(logger = ::Contentful::Webhook::Listener::Support::NullLogger.new)
12
+ @@instance ||= new(logger)
13
+ end
14
+
15
+ def update_or_create(webhook)
16
+ return unless publishable?(webhook)
17
+ remove(webhook) if in_queue?(webhook)
18
+ return if already_published?(webhook)
19
+
20
+ success = Resque.enqueue_at(
21
+ publish_date(webhook).to_time.utc,
22
+ ::Contentful::Scheduler::Tasks::Publish,
23
+ webhook.space_id,
24
+ webhook.id,
25
+ ::Contentful::Scheduler.config[:spaces][webhook.space_id][:management_token]
26
+ )
27
+
28
+ if success
29
+ logger.info "Webhook {id: #{webhook.id}, space_id: #{webhook.space_id}} successfully added to queue"
30
+ else
31
+ logger.warn "Webhook {id: #{webhook.id}, space_id: #{webhook.space_id}} couldn't be added to queue"
32
+ end
33
+ end
34
+
35
+ def remove(webhook)
36
+ return unless publishable?(webhook)
37
+ return unless in_queue?(webhook)
38
+
39
+ success = Resque.remove_delayed(
40
+ ::Contentful::Scheduler::Tasks::Publish,
41
+ webhook.space_id,
42
+ webhook.id,
43
+ ::Contentful::Scheduler.config[:management_token]
44
+ )
45
+
46
+ if success
47
+ logger.info "Webhook {id: #{webhook.id}, space_id: #{webhook.space_id}} successfully removed from queue"
48
+ else
49
+ logger.warn "Webhook {id: #{webhook.id}, space_id: #{webhook.space_id}} couldn't be removed from queue"
50
+ end
51
+ end
52
+
53
+ def publishable?(webhook)
54
+ return false unless spaces.key?(webhook.space_id)
55
+
56
+ if webhook_publish_field?(webhook)
57
+ return !webhook_publish_field(webhook).nil?
58
+ end
59
+
60
+ false
61
+ end
62
+
63
+ def already_published?(webhook)
64
+ return true if publish_date(webhook) < DateTime.now
65
+ return false unless webhook.sys.key?('publishedAt')
66
+
67
+ if !webhook.sys['publishedAt'].nil?
68
+ return DateTime.strptime(webhook.sys['publishedAt']).to_time.utc < DateTime.now.to_time.utc
69
+ end
70
+
71
+ false
72
+ end
73
+
74
+ def in_queue?(webhook)
75
+ Resque.peek(::Contentful::Scheduler::Tasks::Publish, 0, -1).any? do |job|
76
+ job['args'][0] == webhook.space_id && job['args'][1] == webhook.id
77
+ end
78
+ end
79
+
80
+ def publish_date(webhook)
81
+ date_field = webhook_publish_field(webhook)
82
+ date_field = date_field[date_field.keys[0]] if date_field.is_a? Hash
83
+ DateTime.strptime(date_field)
84
+ end
85
+
86
+ def spaces
87
+ config[:spaces]
88
+ end
89
+
90
+ def webhook_publish_field?(webhook)
91
+ webhook.fields.key?(spaces.fetch(webhook.space_id, {})[:publish_field])
92
+ end
93
+
94
+ def webhook_publish_field(webhook)
95
+ webhook.fields[spaces[webhook.space_id][:publish_field]]
96
+ end
97
+
98
+ private
99
+
100
+ def initialize(logger)
101
+ @config = ::Contentful::Scheduler.config
102
+ @logger = logger
103
+ end
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,16 @@
1
+ require 'contentful/management'
2
+
3
+ module Contentful
4
+ module Scheduler
5
+ module Tasks
6
+ class Publish
7
+ @queue = :publish
8
+
9
+ def self.perform(space_id, entry_id, token)
10
+ client = ::Contentful::Management::Client.new(token, raise_errors: true)
11
+ client.entries.find(space_id, entry_id).publish
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1 @@
1
+ require_relative 'tasks/publish'
@@ -0,0 +1,5 @@
1
+ module Contentful
2
+ module Scheduler
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,57 @@
1
+ require 'resque'
2
+ require 'redis'
3
+ require 'logger'
4
+ require 'contentful/webhook/listener'
5
+
6
+ require_relative 'scheduler/controller'
7
+ require_relative 'scheduler/version'
8
+
9
+ module Contentful
10
+ module Scheduler
11
+ DEFAULT_PORT = 32123
12
+ DEFAULT_ENDPOINT = '/scheduler'
13
+ DEFAULT_LOGGER = ::Contentful::Webhook::Listener::Support::NullLogger.new
14
+
15
+ @@config = nil
16
+
17
+ def self.config=(config)
18
+ fail ':redis configuration missing' unless config.key?(:redis)
19
+ fail ':spaces configuration missing' unless config.key?(:spaces)
20
+ config[:spaces].each do |space, data|
21
+ fail ":management_token missing for space: #{space}" unless data.key?(:management_token)
22
+ end
23
+
24
+ config[:port] = (ENV.key?('PORT') ? ENV['PORT'].to_i : DEFAULT_PORT) unless config.key?(:port)
25
+ config[:logger] = DEFAULT_LOGGER unless config.key?(:logger)
26
+ config[:endpoint] = DEFAULT_ENDPOINT unless config.key?(:endpoint)
27
+
28
+ ::Resque.redis = config[:redis].dup
29
+ @@config ||= config
30
+ end
31
+
32
+ def self.config
33
+ @@config
34
+ end
35
+
36
+ def self.start(config = {})
37
+ fail "Scheduler not configured" if self.config.nil? && !block_given?
38
+
39
+ if block_given?
40
+ yield(config) if block_given?
41
+ self.config = config
42
+ end
43
+
44
+ ::Contentful::Webhook::Listener::Server.start do |config|
45
+ config[:port] = self.config[:port]
46
+ config[:logger] = self.config[:logger]
47
+ config[:endpoints] = [
48
+ {
49
+ endpoint: self.config[:endpoint],
50
+ controller: ::Contentful::Scheduler::Controller,
51
+ timeout: 0
52
+ }
53
+ ]
54
+ end.join
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ describe Contentful::Scheduler::Controller do
4
+ let(:server) { MockServer.new }
5
+ let(:logger) { Contentful::Webhook::Listener::Support::NullLogger.new }
6
+ let(:timeout) { 10 }
7
+ let(:headers) { {'X-Contentful-Topic' => '', 'X-Contentful-Webhook-Name' => 'SomeName'} }
8
+ let(:body) { {sys: { id: 'foo', space: { sys: { id: 'space_foo' } } }, fields: {} } }
9
+ let(:queue) { ::Contentful::Scheduler::Queue.instance }
10
+ subject { described_class.new server, logger, timeout }
11
+
12
+ describe 'events' do
13
+ [:create, :save, :auto_save, :unarchive].each do |event|
14
+ it "creates or updates webhook metadata in publish queue on #{event}" do
15
+ expect(queue).to receive(:update_or_create)
16
+
17
+ headers['X-Contentful-Topic'] = "ContentfulManagement.Entry.#{event}"
18
+ request = RequestDummy.new(headers, body)
19
+ subject.respond(request, MockResponse.new).join
20
+ end
21
+ end
22
+
23
+ [:delete, :unpublish, :archive, :publish].each do |event|
24
+ it "deletes webhook metadata in publish queue on #{event}" do
25
+ expect(queue).to receive(:remove)
26
+
27
+ headers['X-Contentful-Topic'] = "ContentfulManagement.Entry.#{event}"
28
+ request = RequestDummy.new(headers, body)
29
+ subject.respond(request, MockResponse.new).join
30
+ end
31
+ end
32
+
33
+ [:create, :save, :unarchive, :delete, :unpublish, :archive, :publish].each do |event|
34
+ ['Asset', 'ContentType'].each do |kind|
35
+ it "ignores #{kind} on #{event}" do
36
+ expect(queue).not_to receive(:remove)
37
+ expect(queue).not_to receive(:update_or_create)
38
+
39
+ headers['X-Contentful-Topic'] = "ContentfulManagement.#{kind}.#{event}"
40
+ request = RequestDummy.new(headers, body)
41
+ subject.respond(request, MockResponse.new).join
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,245 @@
1
+ require 'spec_helper'
2
+
3
+ class WebhookDouble
4
+ attr_reader :id, :space_id, :sys, :fields
5
+ def initialize(id, space_id, sys = {}, fields = {})
6
+ @id = id
7
+ @space_id = space_id
8
+ @sys = sys
9
+ @fields = fields
10
+ end
11
+ end
12
+
13
+ describe Contentful::Scheduler::Queue do
14
+ let(:config) {
15
+ {
16
+ logger: ::Contentful::Scheduler::DEFAULT_LOGGER,
17
+ endpoint: ::Contentful::Scheduler::DEFAULT_ENDPOINT,
18
+ port: ::Contentful::Scheduler::DEFAULT_PORT,
19
+ redis: {
20
+ host: 'localhost',
21
+ port: 12341,
22
+ password: 'foobar'
23
+ },
24
+ spaces: {
25
+ 'foo' => {
26
+ publish_field: 'my_field',
27
+ management_token: 'foo'
28
+ }
29
+ }
30
+ }
31
+ }
32
+
33
+ subject { described_class.instance }
34
+
35
+ before :each do
36
+ allow(Resque).to receive(:redis=)
37
+ described_class.class_variable_set(:@@instance, nil)
38
+ ::Contentful::Scheduler.config = config
39
+ end
40
+
41
+ describe 'singleton' do
42
+ it 'creates an instance if not initialized' do
43
+ queue = described_class.instance
44
+ expect(queue).to be_a described_class
45
+ end
46
+
47
+ it 'reuses same instance' do
48
+ queue = described_class.instance
49
+
50
+ expect(queue).to eq described_class.instance
51
+ end
52
+ end
53
+
54
+ describe 'attributes' do
55
+ it '.config' do
56
+ expect(subject.config).to eq config
57
+ end
58
+ end
59
+
60
+ describe 'instance methods' do
61
+ it '#spaces' do
62
+ expect(subject.spaces).to eq config[:spaces]
63
+ end
64
+
65
+ it '#webhook_publish_field?' do
66
+ expect(subject.webhook_publish_field?(
67
+ WebhookDouble.new('bar', 'foo', {}, {'my_field' => 'something'})
68
+ )).to be_truthy
69
+
70
+ expect(subject.webhook_publish_field?(
71
+ WebhookDouble.new('bar', 'foo', {}, {'not_my_field' => 'something'})
72
+ )).to be_falsey
73
+
74
+ expect(subject.webhook_publish_field?(
75
+ WebhookDouble.new('bar', 'not_foo', {}, {'not_my_field' => 'something'})
76
+ )).to be_falsey
77
+ end
78
+
79
+ it '#webhook_publish_field' do
80
+ expect(subject.webhook_publish_field(
81
+ WebhookDouble.new('bar', 'foo', {}, {'my_field' => 'something'})
82
+ )).to eq 'something'
83
+ end
84
+
85
+ it '#publish_date' do
86
+ expect(subject.publish_date(
87
+ WebhookDouble.new('bar', 'foo', {}, {'my_field' => '2011-04-04T22:00:00+00:00'})
88
+ )).to eq DateTime.new(2011, 4, 4, 22, 0, 0)
89
+ end
90
+
91
+ describe '#already_published?' do
92
+ it 'true if webhook publish_date is in past' do
93
+ expect(subject.already_published?(
94
+ WebhookDouble.new('bar', 'foo', {}, {'my_field' => '2011-04-04T22:00:00+00:00'})
95
+ )).to be_truthy
96
+ end
97
+
98
+ it 'true if sys.publishedAt is in past' do
99
+ expect(subject.already_published?(
100
+ WebhookDouble.new('bar', 'foo', {'publishedAt' => '2011-04-04T22:00:00+00:00'}, {'my_field' => '2099-04-04T22:00:00+00:00'})
101
+ )).to be_truthy
102
+ end
103
+
104
+ it 'false if sys.publishedAt is not present' do
105
+ expect(subject.already_published?(
106
+ WebhookDouble.new('bar', 'foo', {}, {'my_field' => '2099-04-04T22:00:00+00:00'})
107
+ )).to be_falsey
108
+ end
109
+
110
+ it 'false if sys.publishedAt is present but nil' do
111
+ expect(subject.already_published?(
112
+ WebhookDouble.new('bar', 'foo', {'publishedAt' => nil}, {'my_field' => '2099-04-04T22:00:00+00:00'})
113
+ )).to be_falsey
114
+ end
115
+ end
116
+
117
+ describe '#publishable?' do
118
+ it 'false if webhook space not present in config' do
119
+ expect(subject.publishable?(
120
+ WebhookDouble.new('bar', 'not_foo')
121
+ )).to be_falsey
122
+ end
123
+
124
+ it 'false if publish_field is not found' do
125
+ expect(subject.publishable?(
126
+ WebhookDouble.new('bar', 'foo')
127
+ )).to be_falsey
128
+ end
129
+
130
+ it 'false if publish_field is nil' do
131
+ expect(subject.publishable?(
132
+ WebhookDouble.new('bar', 'foo', {}, {'my_field' => nil})
133
+ )).to be_falsey
134
+ end
135
+
136
+ it 'true if publish_field is populated' do
137
+ expect(subject.publishable?(
138
+ WebhookDouble.new('bar', 'foo', {}, {'my_field' => '2011-04-04T22:00:00+00:00'})
139
+ )).to be_truthy
140
+ end
141
+ end
142
+
143
+ describe '#in_queue?' do
144
+ it 'false if not in queue' do
145
+ allow(Resque).to receive(:peek) { [] }
146
+ expect(subject.in_queue?(
147
+ WebhookDouble.new('bar', 'foo')
148
+ )).to be_falsey
149
+ end
150
+
151
+ it 'true if in queue' do
152
+ allow(Resque).to receive(:peek) { [{'args' => ['foo', 'bar']}] }
153
+ expect(subject.in_queue?(
154
+ WebhookDouble.new('bar', 'foo')
155
+ )).to be_truthy
156
+ end
157
+ end
158
+
159
+ describe '#update_or_create' do
160
+ it 'does nothing if webhook is unpublishable' do
161
+ expect(Resque).not_to receive(:enqueue_at)
162
+
163
+ subject.update_or_create(WebhookDouble.new('bar', 'not_foo'))
164
+ end
165
+
166
+ describe 'webhook is new' do
167
+ it 'queues' do
168
+ mock_redis = Object.new
169
+ allow(mock_redis).to receive(:client) { mock_redis }
170
+ allow(mock_redis).to receive(:id) { 'foo' }
171
+ allow(Resque).to receive(:peek) { [] }
172
+ allow(Resque).to receive(:redis) { mock_redis }
173
+
174
+ expect(Resque).to receive(:enqueue_at).with(
175
+ DateTime.strptime('2099-04-04T22:00:00+00:00').to_time.utc,
176
+ ::Contentful::Scheduler::Tasks::Publish,
177
+ 'foo',
178
+ 'bar',
179
+ 'foo'
180
+ ) { true }
181
+
182
+ subject.update_or_create(WebhookDouble.new('bar', 'foo', {}, {'my_field' => '2099-04-04T22:00:00+00:00'}))
183
+ end
184
+
185
+ it 'does nothing if already published' do
186
+ allow(Resque).to receive(:peek) { [] }
187
+ expect(Resque).not_to receive(:enqueue_at)
188
+
189
+ subject.update_or_create(WebhookDouble.new('bar', 'foo', {}, {'my_field' => '2011-04-04T22:00:00+00:00'}))
190
+ end
191
+ end
192
+
193
+ describe 'webhook already in queue' do
194
+ it 'calls remove then queues again' do
195
+ mock_redis = Object.new
196
+ allow(mock_redis).to receive(:client) { mock_redis }
197
+ allow(mock_redis).to receive(:id) { 'foo' }
198
+ allow(Resque).to receive(:redis) { mock_redis }
199
+
200
+ allow(Resque).to receive(:peek) { [{'args' => ['foo', 'bar']}] }
201
+ expect(Resque).to receive(:enqueue_at).with(
202
+ DateTime.strptime('2099-04-04T22:00:00+00:00').to_time.utc,
203
+ ::Contentful::Scheduler::Tasks::Publish,
204
+ 'foo',
205
+ 'bar',
206
+ 'foo'
207
+ ) { true }
208
+ expect(subject).to receive(:remove)
209
+
210
+ subject.update_or_create(WebhookDouble.new('bar', 'foo', {}, {'my_field' => '2099-04-04T22:00:00+00:00'}))
211
+ end
212
+
213
+ it 'removes old call if already published' do
214
+ allow(Resque).to receive(:peek) { [{'args' => ['foo', 'bar']}] }
215
+ expect(Resque).not_to receive(:enqueue_at)
216
+ expect(subject).to receive(:remove)
217
+
218
+ subject.update_or_create(WebhookDouble.new('bar', 'foo', {}, {'my_field' => '2011-04-04T22:00:00+00:00'}))
219
+ end
220
+ end
221
+ end
222
+
223
+ describe '#remove' do
224
+ it 'does nothing if webhook is unpublishable' do
225
+ expect(Resque).not_to receive(:remove_delayed)
226
+
227
+ subject.remove(WebhookDouble.new('bar', 'foo'))
228
+ end
229
+
230
+ it 'does nothing if webhook not in queue' do
231
+ allow(Resque).to receive(:peek) { [] }
232
+ expect(Resque).not_to receive(:remove_delayed)
233
+
234
+ subject.remove(WebhookDouble.new('bar', 'foo', {}, {'my_field' => '2011-04-04T22:00:00+00:00'}))
235
+ end
236
+
237
+ it 'removes if in queue' do
238
+ allow(Resque).to receive(:peek) { [{'args' => ['foo', 'bar']}] }
239
+ expect(Resque).to receive(:remove_delayed)
240
+
241
+ subject.remove(WebhookDouble.new('bar', 'foo', {}, {'my_field' => '2011-04-04T22:00:00+00:00'}))
242
+ end
243
+ end
244
+ end
245
+ end
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ class MockEntry
4
+ def publish
5
+ end
6
+ end
7
+
8
+ class MockClient
9
+ def entries
10
+ end
11
+ end
12
+
13
+ class MockEntries
14
+ def find
15
+ end
16
+ end
17
+
18
+ describe Contentful::Scheduler::Tasks::Publish do
19
+ let(:mock_client) { MockClient.new }
20
+ let(:mock_entries) { MockEntries.new }
21
+ let(:mock_entry) { MockEntry.new }
22
+
23
+ before :each do
24
+ ::Contentful::Scheduler.class_variable_set(:@@config, {management_token: 'foobar'})
25
+ end
26
+
27
+ describe 'class methods' do
28
+ it '::perform' do
29
+ expect(::Contentful::Management::Client).to receive(:new) { mock_client }
30
+ expect(mock_client).to receive(:entries) { mock_entries }
31
+ expect(mock_entries).to receive(:find).with('foo', 'bar') { mock_entry }
32
+ expect(mock_entry).to receive(:publish)
33
+
34
+ described_class.perform('foo', 'bar', ::Contentful::Scheduler.config[:management_token])
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,141 @@
1
+ require 'spec_helper'
2
+
3
+ class DummyServer
4
+ def join; end
5
+ end
6
+
7
+ class DummyLogger
8
+ end
9
+
10
+ describe Contentful::Scheduler do
11
+ let(:config) {
12
+ {
13
+ redis: {
14
+ host: 'localhost',
15
+ port: 12341,
16
+ password: 'foobar'
17
+ },
18
+ spaces: {},
19
+ management_token: 'foo'
20
+ }
21
+ }
22
+
23
+ before :each do
24
+ described_class.class_variable_set(:@@config, nil)
25
+ end
26
+
27
+ describe 'static methods' do
28
+ describe '::config=' do
29
+ describe 'failures' do
30
+ it 'fails if :redis is not configured' do
31
+ expect { described_class.config = {} }.to raise_error ":redis configuration missing"
32
+ end
33
+
34
+ it 'fails if :spaces are not configured' do
35
+ expect { described_class.config = {redis: nil} }.to raise_error ":spaces configuration missing"
36
+ end
37
+
38
+ it 'fails if :management_token is not configured' do
39
+ expect { described_class.config = {redis: nil, spaces: {example_space: {}}} }.to raise_error ":management_token missing for space: example_space"
40
+ end
41
+ end
42
+
43
+ describe 'success' do
44
+ it 'sets a resque redis config' do
45
+ expect(Resque).to receive(:redis=).with(config[:redis])
46
+
47
+ described_class.config = config
48
+ end
49
+
50
+ it 'sets global config' do
51
+ described_class.config = config
52
+
53
+ expect(described_class.config).to eq config
54
+ end
55
+ end
56
+ end
57
+
58
+ describe '::config' do
59
+ it 'fetches the config' do
60
+ expect(described_class.config).to eq nil
61
+
62
+ allow(Resque).to receive(:redis=)
63
+
64
+ described_class.config = config
65
+
66
+ expect(described_class.config).to eq config
67
+ end
68
+
69
+ it ':port defaults to 32123' do
70
+ described_class.config = config
71
+
72
+ expect(described_class.config[:port]).to eq 32123
73
+ end
74
+
75
+ it ':port to ENV["PORT"] if available and :port not set' do
76
+ ENV['PORT'] = '8000'
77
+
78
+ described_class.config = config
79
+
80
+ expect(described_class.config[:port]).to eq 8000
81
+
82
+ ENV['PORT'] = nil
83
+ end
84
+
85
+ it ':port can be set' do
86
+ described_class.config = {port: 10101}.merge(config)
87
+
88
+ expect(described_class.config[:port]).to eq 10101
89
+ end
90
+
91
+ it ':logger can be set' do
92
+ described_class.config = {logger: DummyLogger.new}.merge(config)
93
+
94
+ expect(described_class.config[:logger]).to be_a DummyLogger
95
+ end
96
+
97
+ it ':logger defaults to NullLogger' do
98
+ described_class.config = config
99
+
100
+ expect(described_class.config[:logger]).to be_a ::Contentful::Webhook::Listener::Support::NullLogger
101
+ end
102
+
103
+ it ':endpoint can be set' do
104
+ described_class.config = {endpoint: '/foobar'}.merge(config)
105
+
106
+ expect(described_class.config[:endpoint]).to eq '/foobar'
107
+ end
108
+
109
+ it ':endpoint defaults to "/scheduler"' do
110
+ described_class.config = config
111
+
112
+ expect(described_class.config[:endpoint]).to eq '/scheduler'
113
+ end
114
+ end
115
+
116
+ describe '::start' do
117
+ it 'fails when not configured' do
118
+ expect { described_class.start }.to raise_error "Scheduler not configured"
119
+ end
120
+
121
+ it 'runs when config set' do
122
+ allow(Resque).to receive(:redis=)
123
+ expect(::Contentful::Webhook::Listener::Server).to receive(:start) { DummyServer.new }
124
+
125
+ described_class.config = config
126
+ described_class.start
127
+ end
128
+
129
+ it 'can be configured by a block' do
130
+ allow(Resque).to receive(:redis=)
131
+ expect(::Contentful::Webhook::Listener::Server).to receive(:start) { DummyServer.new }
132
+
133
+ described_class.start do |config|
134
+ config[:redis] = {}
135
+ config[:spaces] = {}
136
+ config[:management_token] = ''
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,50 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'contentful/scheduler'
3
+ require 'contentful/webhook/listener'
4
+ require 'json'
5
+
6
+ class MockServer
7
+ def [](key)
8
+ nil
9
+ end
10
+ end
11
+
12
+ class MockRequest
13
+ end
14
+
15
+ class MockResponse
16
+ attr_accessor :status, :body
17
+ end
18
+
19
+ class RequestDummy
20
+ attr_reader :headers, :body
21
+
22
+ def initialize(headers, body)
23
+ @headers = headers || {}
24
+ @body = JSON.dump(body)
25
+ end
26
+
27
+ def [](key)
28
+ headers[key]
29
+ end
30
+
31
+ def each
32
+ headers.each do |h, v|
33
+ yield(h, v)
34
+ end
35
+ end
36
+ end
37
+
38
+ class Contentful::Webhook::Listener::Controllers::Wait
39
+ @@sleeping = false
40
+
41
+ def sleep(time)
42
+ @@sleeping = true
43
+ end
44
+
45
+ def self.sleeping
46
+ value = @@sleeping
47
+ @@sleeping = false
48
+ value
49
+ end
50
+ end
metadata ADDED
@@ -0,0 +1,215 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: contentful-scheduler
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Contentful GmbH (David Litvak Bruno0
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-04-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: contentful-webhook-listener
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: contentful-management
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: resque
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: resque-scheduler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '4.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '4.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: redis
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.10'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.10'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '10.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '10.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: guard-rspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description: Customizable Scheduler for Contentful Entries.
154
+ email:
155
+ - david.litvak@contentful.com
156
+ executables: []
157
+ extensions: []
158
+ extra_rdoc_files: []
159
+ files:
160
+ - ".gitignore"
161
+ - ".rspec"
162
+ - ".travis.yml"
163
+ - CODE_OF_CONDUCT.md
164
+ - Gemfile
165
+ - Guardfile
166
+ - LICENSE.txt
167
+ - README.md
168
+ - Rakefile
169
+ - contentful-scheduler.gemspec
170
+ - example/Gemfile
171
+ - example/Procfile
172
+ - example/Rakefile
173
+ - example/config.ru
174
+ - lib/contentful/scheduler.rb
175
+ - lib/contentful/scheduler/controller.rb
176
+ - lib/contentful/scheduler/queue.rb
177
+ - lib/contentful/scheduler/tasks.rb
178
+ - lib/contentful/scheduler/tasks/publish.rb
179
+ - lib/contentful/scheduler/version.rb
180
+ - spec/contentful/scheduler/controller_spec.rb
181
+ - spec/contentful/scheduler/queue_spec.rb
182
+ - spec/contentful/scheduler/tasks/publish_spec.rb
183
+ - spec/contentful/scheduler_spec.rb
184
+ - spec/spec_helper.rb
185
+ homepage: https://www.contentful.com
186
+ licenses:
187
+ - MIT
188
+ metadata: {}
189
+ post_install_message:
190
+ rdoc_options: []
191
+ require_paths:
192
+ - lib
193
+ required_ruby_version: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - ">="
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ required_rubygems_version: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ version: '0'
203
+ requirements: []
204
+ rubyforge_project:
205
+ rubygems_version: 2.5.0
206
+ signing_key:
207
+ specification_version: 4
208
+ summary: Customizable Scheduler for Contentful Entries.
209
+ test_files:
210
+ - spec/contentful/scheduler/controller_spec.rb
211
+ - spec/contentful/scheduler/queue_spec.rb
212
+ - spec/contentful/scheduler/tasks/publish_spec.rb
213
+ - spec/contentful/scheduler_spec.rb
214
+ - spec/spec_helper.rb
215
+ has_rdoc: