jekyll-cloudcannon-schedule 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6d8d800c1a586c057aca826bd0510aaabeb737b5f23037b1fd5c126c0a626f17
4
+ data.tar.gz: 7c671f080557ceaca914f91a893d5ca71eb69179aae81c75ea6e9b82fdeba47a
5
+ SHA512:
6
+ metadata.gz: 6ab145cb25bab86d16ee82ff0a9405a0377e8dc48f11da04989a243ec6a69cf22d715965e57840876870b7903df840753f915ab1df031b2dc4002973147e001b
7
+ data.tar.gz: 65445530f326763d44f99b11c1a97bda560f316135efceee06d5a4d72bcdadea66e1f366fe516bc66a4d32f712200ea032423177cae00cf1a6f490e9d55a4444
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ Gemfile.lock
3
+ spec/dest
4
+ .bundle
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
@@ -0,0 +1,11 @@
1
+ inherit_gem:
2
+ jekyll: .rubocop.yml
3
+
4
+ AllCops:
5
+ TargetRubyVersion: 2.1
6
+ Include:
7
+ - lib/*.rb
8
+
9
+ Exclude:
10
+ - script/**/*
11
+ - spec/**/*
@@ -0,0 +1 @@
1
+ 2.5.0
@@ -0,0 +1,38 @@
1
+ sudo: false
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.2
6
+ - 2.3
7
+ - 2.4
8
+ - 2.5
9
+ matrix:
10
+ include:
11
+ # GitHub Pages
12
+ - rvm: 2.4.0
13
+ env:
14
+ - JEKYLL_VERSION=3.6.2
15
+ - GITHUB_PAGES=1 # Only set on one build in matrix
16
+ env:
17
+ matrix:
18
+ - JEKYLL_VERSION=3.6
19
+ branches:
20
+ only:
21
+ - master
22
+ - /^v\d+\.\d+\.\d+/
23
+ git:
24
+ depth: 1000
25
+ before_install:
26
+ - gem update --system
27
+ install:
28
+ - travis_retry script/bootstrap
29
+ script: script/cibuild
30
+ deploy:
31
+ provider: rubygems
32
+ api_key:
33
+ secure: O8fGRnM6OJCqC2BlVE1BqYfq5aR19ulpiHhQwRiHbtSCh8H4rYt7FLsuOwSTtRQjhWYRRSpdRt2ilfQ6PY6Jx1UkxZq5zo9QAPQ9tKxiFTm7gBpZAiAgb06eyaMBSzyQ8qe2qccaFI6CiZhsiaGMsdKsWuYpuoPmdLPd7aDyYJs=
34
+ gem: jekyll-cloudcannon-schedule
35
+ on:
36
+ tags: true
37
+ repo: CloudCannon/jekyll-cloudcannon-schedule
38
+ condition: "$GITHUB_PAGES == 1"
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+ gemspec
5
+
6
+ if ENV["JEKYLL_VERSION"]
7
+ gem "jekyll", "~> #{ENV["JEKYLL_VERSION"]}"
8
+ end
@@ -0,0 +1,3 @@
1
+ ## 0.1.0 / 2018-02-05
2
+
3
+ * Birthday!
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014-present, GitHub, inc. and the jekyll-cloudcannon-schedule contributors
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 all
13
+ 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 THE
21
+ SOFTWARE.
@@ -0,0 +1,40 @@
1
+ # Jekyll Schedule Generator Plugin
2
+
3
+ *Jekyll plugin to generate _schedule.txt for all future posts in your Jekyll site.*
4
+
5
+ [![Build Status](https://travis-ci.org/CloudCannon/jekyll-cloudcannon-schedule.svg?branch=master)](https://travis-ci.org/CloudCannon/jekyll-cloudcannon-schedule)
6
+ [![Gem Version](https://badge.fury.io/rb/jekyll-cloudcannon-schedule.svg)](https://badge.fury.io/rb/jekyll-cloudcannon-schedule)
7
+
8
+ ## Usage
9
+
10
+ 1. Add `gem 'jekyll-cloudcannon-schedule'` to your site's Gemfile and run `bundle`
11
+ 2. Add the following to your site's `_config.yml`:
12
+
13
+ ```yml
14
+ url: "http://example.com" # the base hostname & protocol for your site
15
+ plugins:
16
+ - jekyll-cloudcannon-schedule
17
+ ```
18
+
19
+ 💡 If you are using a Jekyll version less than 3.5.0, use the `gems` key instead of `plugins`.
20
+
21
+ ## Override default development settings
22
+
23
+ [Follow these instructions on Jekyll's documentation](https://jekyllrb.com/docs/usage/#override-default-development-settings).
24
+
25
+ ## Developing locally
26
+
27
+ * Use `script/bootstrap` to bootstrap your local development environment.
28
+ * Use `script/console` to load a local IRB console with the Gem.
29
+
30
+ ## Testing
31
+
32
+ 1. `script/bootstrap`
33
+ 2. `script/cibuild`
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork the project
38
+ 2. Create a descriptively named feature branch
39
+ 3. Add your feature
40
+ 4. Submit a pull request
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task :default => :spec
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("lib", __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "jekyll-cloudcannon-schedule/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "jekyll-cloudcannon-schedule"
9
+ spec.summary = "Automatically generates _schedule.txt for builds on CloudCannon."
10
+ spec.version = Jekyll::CloudCannonSchedule::VERSION
11
+ spec.authors = ["CloudCannon Inc."]
12
+ spec.email = "support@cloudcannon.com"
13
+ spec.homepage = "https://github.com/CloudCannon/jekyll-cloudcannon-schedule"
14
+ spec.licenses = ["MIT"]
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r!^bin/!) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r!^(test|spec|features)/!)
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "jekyll", "~> 3.3"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.16"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec", "~> 3.0"
26
+ spec.add_development_dependency "rubocop", "0.51"
27
+ end
@@ -0,0 +1,2 @@
1
+ {% for post in page.future_posts %}{{ post.date | date_to_xmlschema }},Build '{{ post.title }}',{{ post.path }}
2
+ {% endfor %}
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll/page_without_a_file"
4
+ require "jekyll/jekyll-cloudcannon-schedule"
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module CloudCannonSchedule
5
+ VERSION = "0.1.2".freeze
6
+ end
7
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "fileutils"
4
+
5
+ module Jekyll
6
+ class FuturePostReader < Jekyll::PostReader
7
+ def read_publishable(dir, magic_dir, matcher)
8
+ future_posts = []
9
+ read_content(dir, magic_dir, matcher).tap { |docs| docs.each(&:read) }
10
+ .each do |doc|
11
+ next unless doc.content.valid_encoding?
12
+ site.publisher.publish?(doc).tap do |will_publish|
13
+ if !will_publish && site.publisher.hidden_in_the_future?(doc)
14
+ future_posts << doc
15
+ end
16
+ end
17
+ end
18
+
19
+ future_posts
20
+ end
21
+ end
22
+
23
+ class JekyllCloudCannonSchedule < Jekyll::Generator
24
+ safe true
25
+ priority :lowest
26
+
27
+ # Main plugin action, called by Jekyll-core
28
+ def generate(site)
29
+ @site = site
30
+ @site.pages << schedule unless file_exists?("_schedule.txt")
31
+ end
32
+
33
+ private
34
+
35
+ def source_path(file = "_schedule.txt")
36
+ File.expand_path "../#{file}", __dir__
37
+ end
38
+
39
+ def future_posts
40
+ FuturePostReader.new(@site).read_posts("")
41
+ end
42
+
43
+ def schedule
44
+ schedule = PageWithoutAFile.new(@site, __dir__, "", "_schedule.txt")
45
+ schedule.content = File.read(source_path)
46
+ schedule.data["layout"] = nil
47
+ schedule.data["future_posts"] = future_posts.map(&:to_liquid)
48
+ schedule
49
+ end
50
+
51
+ # Checks if a file already exists in the site source
52
+ def file_exists?(file_path)
53
+ if @site.respond_to?(:in_source_dir)
54
+ File.exist? @site.in_source_dir(file_path)
55
+ else
56
+ File.exist? Jekyll.sanitized_path(@site.source, file_path)
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ class PageWithoutAFile < Page
5
+ def read_yaml(*)
6
+ @data ||= {}
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ set -ex
3
+
4
+ bundle install
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+ set -e
3
+
4
+ time script/fmt
5
+ time script/test
@@ -0,0 +1,34 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ def relative_to_root(path)
4
+ File.expand_path(path, File.dirname(__dir__))
5
+ end
6
+
7
+ require "jekyll"
8
+ require relative_to_root("lib/jekyll-sitemap.rb")
9
+ require "pry-debugger"
10
+
11
+ SOURCE_DIR = relative_to_root("spec/fixtures")
12
+ DEST_DIR = relative_to_root("spec/dest")
13
+
14
+ def source_dir(*files)
15
+ File.join(SOURCE_DIR, *files)
16
+ end
17
+
18
+ def dest_dir(*files)
19
+ File.join(DEST_DIR, *files)
20
+ end
21
+
22
+ def config(overrides = {})
23
+ Jekyll.configuration({
24
+ "source" => source_dir,
25
+ "destination" => dest_dir,
26
+ "url" => "http://example.org",
27
+ }).merge(overrides)
28
+ end
29
+
30
+ def site(configuration = config)
31
+ Jekyll::Site.new(configuration)
32
+ end
33
+
34
+ binding.pry
@@ -0,0 +1,10 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "Rubocop $(bundle exec rubocop --version)"
5
+ bundle exec rubocop -D -E $@
6
+ success=$?
7
+ if ((success != 0)); then
8
+ echo -e "\nTry running \`script/fmt -a\` to automatically fix errors"
9
+ fi
10
+ exit $success
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+ # Tag and push a release.
3
+
4
+ set -e
5
+
6
+ script/cibuild
7
+ bundle exec rake release
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+ set -ex
3
+
4
+ bundle exec rspec "$@"
@@ -0,0 +1,9 @@
1
+ timezone: UTC
2
+
3
+ defaults:
4
+ -
5
+ scope:
6
+ path: ""
7
+ type: page
8
+ values:
9
+ layout: some_default
@@ -0,0 +1,5 @@
1
+ garthdb:
2
+ name: Garth
3
+ twitter: garthdb
4
+ uri: "http://garthdb.com"
5
+ email: example@mail.com
@@ -0,0 +1,4 @@
1
+ ---
2
+ ---
3
+
4
+ This is a draft.
@@ -0,0 +1,11 @@
1
+ ---
2
+ ---
3
+ <html>
4
+ <head>
5
+ {% feed_meta %}
6
+ </head>
7
+ <body>
8
+ THIS IS MY LAYOUT
9
+ {{ content }}
10
+ </body>
11
+ </html>
@@ -0,0 +1,6 @@
1
+ ---
2
+ excerpt: ""
3
+ author: childish
4
+ ---
5
+
6
+ # No matter what you say or what you do
@@ -0,0 +1,52 @@
1
+ require 'spec_helper'
2
+
3
+ describe(Jekyll::JekyllCloudCannonSchedule) do
4
+ let(:overrides) { Hash.new }
5
+ let(:config) do
6
+ Jekyll.configuration(Jekyll::Utils.deep_merge_hashes({
7
+ "full_rebuild" => true,
8
+ "source" => source_dir,
9
+ "destination" => dest_dir,
10
+ "show_drafts" => true,
11
+ "url" => "http://example.org",
12
+ "name" => "My awesome site",
13
+ "author" => {
14
+ "name" => "Dr. Jekyll"
15
+ },
16
+ "collections" => {
17
+ "my_collection" => { "output" => true },
18
+ "other_things" => { "output" => false }
19
+ }
20
+ }, overrides))
21
+ end
22
+ let(:site) { Jekyll::Site.new(config) }
23
+ let(:contents) { File.read(dest_dir("_schedule.txt")) }
24
+ let(:context) { make_context(site: site) }
25
+ before(:each) do
26
+ site.process
27
+ end
28
+
29
+ it "has no layout" do
30
+ expect(contents).not_to match(/\ATHIS IS MY LAYOUT/)
31
+ end
32
+
33
+ it "creates a _schedule.txt file" do
34
+ expect(Pathname.new(dest_dir("_schedule.txt"))).to exist
35
+ end
36
+
37
+ it "has empty lines or formatted lines" do
38
+ lines = contents.split("\n")
39
+
40
+ lines.each do |line|
41
+ parts = line.split ","
42
+ if parts.length < 2
43
+ expect(line).to match(/^\s+$/)
44
+ else
45
+ expect(parts[0].to_s).to match /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/
46
+ expect(parts[1].to_s).to match /Build \'.*\'/
47
+ expect(parts[2].to_s).to match /_posts\/\d{4}-[01]\d-[0-3]\d-(.*)\.(md|html)$/
48
+ end
49
+ end
50
+
51
+ end
52
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll"
4
+ require File.expand_path("../lib/jekyll-cloudcannon-schedule", __dir__)
5
+
6
+ Jekyll.logger.log_level = :error
7
+
8
+ RSpec.configure do |config|
9
+ config.run_all_when_everything_filtered = true
10
+ config.filter_run :focus
11
+ config.order = "random"
12
+
13
+ SOURCE_DIR = File.expand_path("fixtures", __dir__)
14
+ DEST_DIR = File.expand_path("dest", __dir__)
15
+
16
+ def source_dir(*files)
17
+ File.join(SOURCE_DIR, *files)
18
+ end
19
+
20
+ def dest_dir(*files)
21
+ File.join(DEST_DIR, *files)
22
+ end
23
+ end
metadata ADDED
@@ -0,0 +1,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-cloudcannon-schedule
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - CloudCannon Inc.
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-02-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.16'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.16'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: '0.51'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: '0.51'
83
+ description:
84
+ email: support@cloudcannon.com
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files: []
88
+ files:
89
+ - ".gitignore"
90
+ - ".rspec"
91
+ - ".rubocop.yml"
92
+ - ".ruby-version"
93
+ - ".travis.yml"
94
+ - Gemfile
95
+ - History.markdown
96
+ - LICENSE.md
97
+ - README.md
98
+ - Rakefile
99
+ - jekyll-cloudcannon-schedule.gemspec
100
+ - lib/_schedule.txt
101
+ - lib/jekyll-cloudcannon-schedule.rb
102
+ - lib/jekyll-cloudcannon-schedule/version.rb
103
+ - lib/jekyll/jekyll-cloudcannon-schedule.rb
104
+ - lib/jekyll/page_without_a_file.rb
105
+ - script/bootstrap
106
+ - script/cibuild
107
+ - script/console
108
+ - script/fmt
109
+ - script/release
110
+ - script/test
111
+ - spec/fixtures/_config.yml
112
+ - spec/fixtures/_data/authors.yml
113
+ - spec/fixtures/_drafts/2015-01-12-a-draft.md
114
+ - spec/fixtures/_layouts/some_default.html
115
+ - spec/fixtures/_posts/2015-08-08-stuck-in-the-middle.html
116
+ - spec/fixtures/_posts/3005-10-22-because-of-the-internet.md
117
+ - spec/jekyll-cloudcanon-schedule_spec.rb
118
+ - spec/spec_helper.rb
119
+ homepage: https://github.com/CloudCannon/jekyll-cloudcannon-schedule
120
+ licenses:
121
+ - MIT
122
+ metadata: {}
123
+ post_install_message:
124
+ rdoc_options: []
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ requirements: []
138
+ rubyforge_project:
139
+ rubygems_version: 2.7.3
140
+ signing_key:
141
+ specification_version: 4
142
+ summary: Automatically generates _schedule.txt for builds on CloudCannon.
143
+ test_files:
144
+ - spec/fixtures/_config.yml
145
+ - spec/fixtures/_data/authors.yml
146
+ - spec/fixtures/_drafts/2015-01-12-a-draft.md
147
+ - spec/fixtures/_layouts/some_default.html
148
+ - spec/fixtures/_posts/2015-08-08-stuck-in-the-middle.html
149
+ - spec/fixtures/_posts/3005-10-22-because-of-the-internet.md
150
+ - spec/jekyll-cloudcanon-schedule_spec.rb
151
+ - spec/spec_helper.rb