spectat-jekyll 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.gitlab-ci.yml +6 -0
- data/.rspec +3 -0
- data/.rubocop.yml +6 -0
- data/Gemfile +6 -0
- data/README.md +54 -0
- data/Rakefile +8 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/spectat/jekyll/deploy/stages/production.rb +6 -0
- data/lib/spectat/jekyll/deploy/stages/review.rb +8 -0
- data/lib/spectat/jekyll/deploy/stages/staging.rb +6 -0
- data/lib/spectat/jekyll/deploy/tasks/deploy.rake +30 -0
- data/lib/spectat/jekyll/deploy/tasks/review.rake +7 -0
- data/lib/spectat/jekyll/deploy.rb +47 -0
- data/lib/spectat/jekyll/version.rb +5 -0
- data/lib/spectat/jekyll.rb +1 -0
- data/spectat-jekyll.gemspec +42 -0
- metadata +174 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5a2af09733c117d98f58c5fd80df8991958dca719da576c810588ba55e965eb1
|
4
|
+
data.tar.gz: 2c473294983f3136afa34635e9b39a1eb86194a7b3aac01a113e3b903812c609
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8e0f4f87b7944852b374311a57fcad730e0c2dd75109d39afe9871af93616e4500ddf23cc855affce7deb36043684722b784f80ecc90d20793a7b2291d70b170
|
7
|
+
data.tar.gz: 232e53aee11431a856d867ef256584235920666bf613b781c83d31b6768dd83d3c0d505fd114d406c948f65fca0b8ef61e8434cb01c3a9caff135b8057a1b937
|
data/.gitignore
ADDED
data/.gitlab-ci.yml
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Spectat::Jekyll
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/spectat/jekyll`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'spectat-jekyll'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install spectat-jekyll
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
### Capistrano Config
|
26
|
+
|
27
|
+
Create a file `Capfile`:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
require 'spectat/jekyll/deploy'
|
31
|
+
```
|
32
|
+
|
33
|
+
Create the `config` directory:
|
34
|
+
|
35
|
+
```
|
36
|
+
$ mkdir config
|
37
|
+
```
|
38
|
+
|
39
|
+
For instance, given an FQDN `www.spectatdesigns.co.uk`, sourced from https://gitlab.com/spectat/spectat/spectatdesigns.co.uk/, create the file `config/deploy.rb`:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
set :application, 'www.spectatdesigns.co.uk'
|
43
|
+
set :full_repo_path, 'spectat/spectat/spectatdesigns.co.uk'
|
44
|
+
```
|
45
|
+
|
46
|
+
## Development
|
47
|
+
|
48
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
49
|
+
|
50
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
51
|
+
|
52
|
+
## Contributing
|
53
|
+
|
54
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/spectat-jekyll.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'spectat/jekyll'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'spectat/fqdn'
|
2
|
+
|
3
|
+
fqdn_str = Spectat::Fqdn.review_apps_fqdn(fetch(:application))
|
4
|
+
fqdn_helper = Spectat::Fqdn.new(fqdn_str, 'staging')
|
5
|
+
|
6
|
+
set :deploy_to, "#{fqdn_helper.site_dir}/#{fetch :tag}"
|
7
|
+
|
8
|
+
server fqdn_helper.fqdn, user: fqdn_helper.user, roles: %(app)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
namespace :deploy do
|
2
|
+
desc 'Deploy the site'
|
3
|
+
|
4
|
+
task :pull do
|
5
|
+
desc 'Pull the latest image'
|
6
|
+
on roles(:app) do
|
7
|
+
execute "docker pull #{fetch :image_to_deploy}"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
task :copy do
|
12
|
+
desc 'Copy the files from the new image to the release_path'
|
13
|
+
on roles(:app) do
|
14
|
+
within(release_path) do
|
15
|
+
container_id = capture("docker create #{fetch :image_to_deploy} echo")
|
16
|
+
# make the top-level directory, so we can copy into it
|
17
|
+
execute "mkdir #{release_path}/_dist"
|
18
|
+
# copy built site into the `html` folder
|
19
|
+
execute "docker cp #{container_id}:/site #{release_path}/_dist/html"
|
20
|
+
# ensure permissions are correct
|
21
|
+
execute "chmod -R o-rwX #{release_path}"
|
22
|
+
# remove the created container, as we don't need it any more
|
23
|
+
execute "docker rm #{container_id}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
after :updated, :pull
|
29
|
+
after :pull, :copy
|
30
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
set :stage_config_path, File.join(File.dirname(__FILE__), 'deploy', 'stages')
|
2
|
+
|
3
|
+
require 'capistrano/setup'
|
4
|
+
require 'capistrano/deploy'
|
5
|
+
|
6
|
+
lock '~> 3.7.1'
|
7
|
+
|
8
|
+
require 'capistrano/scm/git'
|
9
|
+
install_plugin Capistrano::SCM::Git
|
10
|
+
|
11
|
+
# pick up any custom Capistrano tasks
|
12
|
+
Dir.glob(File.join(File.dirname(__FILE__), 'deploy/tasks/*.rake')).each { |r| import r }
|
13
|
+
|
14
|
+
set :stages, %w[staging production review]
|
15
|
+
set :default_stage, 'staging'
|
16
|
+
|
17
|
+
# `:full_repo_path` should be set within `config/deploy.rb`. Note that we use a
|
18
|
+
# lambda (`->{ }`) to lazy load the value, once other config files have been
|
19
|
+
# parsed
|
20
|
+
set :repo_url, -> { "git@gitlab.com:#{fetch(:full_repo_path)}.git" }
|
21
|
+
|
22
|
+
# Branch for Capistrano checkout {{{
|
23
|
+
if ENV['CI_BUILD_REF_NAME']
|
24
|
+
set :branch, ENV['CI_BUILD_REF_NAME']
|
25
|
+
else
|
26
|
+
set :branch, 'master'
|
27
|
+
end
|
28
|
+
# }}}
|
29
|
+
|
30
|
+
# Docker registry {{{
|
31
|
+
set :registry_url, 'registry.gitlab.com'
|
32
|
+
|
33
|
+
set :tag, 'master'
|
34
|
+
set :tag, ENV['CI_COMMIT_REF_SLUG'] if ENV['CI_COMMIT_REF_SLUG']
|
35
|
+
if fetch(:tag) == 'master'
|
36
|
+
if fetch(:stage) == :production
|
37
|
+
set :tag, 'latest'
|
38
|
+
elsif fetch(:stage) == :staging
|
39
|
+
set :tag, 'master'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# `:full_repo_path` should be set within `config/deploy.rb`. Note that we use a
|
44
|
+
# lambda (`->{ }`) to lazy load the value, once other config files have been
|
45
|
+
# parsed
|
46
|
+
set :image_to_deploy, -> { "#{fetch(:registry_url)}/#{fetch(:full_repo_path)}:#{fetch(:tag)}" }
|
47
|
+
# }}}
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'spectat/jekyll/version'
|
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path('lib', __dir__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'spectat/jekyll/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'spectat-jekyll'
|
8
|
+
spec.version = Spectat::Jekyll::VERSION
|
9
|
+
spec.authors = ['Jamie Tanna']
|
10
|
+
spec.email = ['rubygems@jamietanna.co.uk']
|
11
|
+
|
12
|
+
spec.summary = 'Opinionated Jekyll + Capistrano configuration for Spectat Designs sites'
|
13
|
+
spec.description = 'Opinionated Jekyll + Capistrano configuration for Spectat Designs sites'
|
14
|
+
spec.homepage = 'https://gitlab.com/spectat/gems/spectat-jekyll-gem'
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
20
|
+
else
|
21
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
22
|
+
'public gem pushes.'
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
f.match(%r{^(test|spec|features)/})
|
27
|
+
end
|
28
|
+
spec.bindir = 'exe'
|
29
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ['lib']
|
31
|
+
|
32
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
33
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
34
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
35
|
+
spec.add_development_dependency 'rubocop', '~> 0.55.0'
|
36
|
+
|
37
|
+
spec.add_runtime_dependency 'capistrano', '~> 3.7.1'
|
38
|
+
spec.add_runtime_dependency 'jekyll', '~> 3.7.3'
|
39
|
+
# https://github.com/jekyll/jekyll/issues/4838
|
40
|
+
spec.add_runtime_dependency 'json'
|
41
|
+
spec.add_runtime_dependency 'spectat', '~> 0.1.0'
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spectat-jekyll
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jamie Tanna
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.55.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.55.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: capistrano
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.7.1
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.7.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: jekyll
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 3.7.3
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 3.7.3
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: json
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: spectat
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.1.0
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.1.0
|
125
|
+
description: Opinionated Jekyll + Capistrano configuration for Spectat Designs sites
|
126
|
+
email:
|
127
|
+
- rubygems@jamietanna.co.uk
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".gitignore"
|
133
|
+
- ".gitlab-ci.yml"
|
134
|
+
- ".rspec"
|
135
|
+
- ".rubocop.yml"
|
136
|
+
- Gemfile
|
137
|
+
- README.md
|
138
|
+
- Rakefile
|
139
|
+
- bin/console
|
140
|
+
- bin/setup
|
141
|
+
- lib/spectat/jekyll.rb
|
142
|
+
- lib/spectat/jekyll/deploy.rb
|
143
|
+
- lib/spectat/jekyll/deploy/stages/production.rb
|
144
|
+
- lib/spectat/jekyll/deploy/stages/review.rb
|
145
|
+
- lib/spectat/jekyll/deploy/stages/staging.rb
|
146
|
+
- lib/spectat/jekyll/deploy/tasks/deploy.rake
|
147
|
+
- lib/spectat/jekyll/deploy/tasks/review.rake
|
148
|
+
- lib/spectat/jekyll/version.rb
|
149
|
+
- spectat-jekyll.gemspec
|
150
|
+
homepage: https://gitlab.com/spectat/gems/spectat-jekyll-gem
|
151
|
+
licenses: []
|
152
|
+
metadata:
|
153
|
+
allowed_push_host: https://rubygems.org
|
154
|
+
post_install_message:
|
155
|
+
rdoc_options: []
|
156
|
+
require_paths:
|
157
|
+
- lib
|
158
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
159
|
+
requirements:
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '0'
|
163
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
requirements: []
|
169
|
+
rubyforge_project:
|
170
|
+
rubygems_version: 2.7.6
|
171
|
+
signing_key:
|
172
|
+
specification_version: 4
|
173
|
+
summary: Opinionated Jekyll + Capistrano configuration for Spectat Designs sites
|
174
|
+
test_files: []
|