jekyll_push 0.1.0
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.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +18 -0
- data/.travis.yml +12 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +103 -0
- data/LICENSE.txt +21 -0
- data/README.md +35 -0
- data/jekyll_push.gemspec +25 -0
- data/lib/jekyll_push/branch.rb +75 -0
- data/lib/jekyll_push/command.rb +29 -0
- data/lib/jekyll_push/error.rb +18 -0
- data/lib/jekyll_push/local.rb +25 -0
- data/lib/jekyll_push/site.rb +41 -0
- data/lib/jekyll_push/travis.rb +29 -0
- data/lib/jekyll_push/utils.rb +15 -0
- data/lib/jekyll_push.rb +18 -0
- metadata +123 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 636044e92b2da03bc6f0ba61b2138608abd9e0278ed167ab9524d71636328349
|
|
4
|
+
data.tar.gz: '09b919f4384d22765314f959ad9e8328b2ee7dd0733c339274b7861203a7306f'
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 1abed319e1c23c713e4eb058e15ea01aa92537de7867cde43e99f836c777f0c39f0acae19e3d6e3c05406c30fc2bbe10ec4d63ef9574022c33e0f2bd5adc6113
|
|
7
|
+
data.tar.gz: a3d5de256787e99b9d00b6bb9eab8601f540f5b14eeb4f151839ab4439b0a2368a16ffa891ea8fc8c2848caa2c16428e5b91ffcb9accab6c1d01a1375d73b773
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
TargetRubyVersion: 2.4
|
|
3
|
+
Layout/EmptyComment:
|
|
4
|
+
Enabled: false
|
|
5
|
+
Metrics/LineLength:
|
|
6
|
+
Exclude:
|
|
7
|
+
- '*.gemspec'
|
|
8
|
+
IgnoredPatterns:
|
|
9
|
+
- 'raise'
|
|
10
|
+
- 'puts'
|
|
11
|
+
- 'warn'
|
|
12
|
+
- 'git'
|
|
13
|
+
Style/DoubleNegation:
|
|
14
|
+
Enabled: false
|
|
15
|
+
Metrics/AbcSize:
|
|
16
|
+
Max: 23
|
|
17
|
+
Metrics/MethodLength:
|
|
18
|
+
Max: 15
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
jekyll_push (0.1.0)
|
|
5
|
+
jekyll (> 3.0, < 4.0)
|
|
6
|
+
rainbow (~> 3.0)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
addressable (2.6.0)
|
|
12
|
+
public_suffix (>= 2.0.2, < 4.0)
|
|
13
|
+
ast (2.4.0)
|
|
14
|
+
colorator (1.1.0)
|
|
15
|
+
concurrent-ruby (1.1.5)
|
|
16
|
+
diff-lcs (1.3)
|
|
17
|
+
em-websocket (0.5.1)
|
|
18
|
+
eventmachine (>= 0.12.9)
|
|
19
|
+
http_parser.rb (~> 0.6.0)
|
|
20
|
+
eventmachine (1.2.7)
|
|
21
|
+
ffi (1.11.1)
|
|
22
|
+
forwardable-extended (2.6.0)
|
|
23
|
+
http_parser.rb (0.6.0)
|
|
24
|
+
i18n (0.9.5)
|
|
25
|
+
concurrent-ruby (~> 1.0)
|
|
26
|
+
jaro_winkler (1.5.3)
|
|
27
|
+
jekyll (3.8.6)
|
|
28
|
+
addressable (~> 2.4)
|
|
29
|
+
colorator (~> 1.0)
|
|
30
|
+
em-websocket (~> 0.5)
|
|
31
|
+
i18n (~> 0.7)
|
|
32
|
+
jekyll-sass-converter (~> 1.0)
|
|
33
|
+
jekyll-watch (~> 2.0)
|
|
34
|
+
kramdown (~> 1.14)
|
|
35
|
+
liquid (~> 4.0)
|
|
36
|
+
mercenary (~> 0.3.3)
|
|
37
|
+
pathutil (~> 0.9)
|
|
38
|
+
rouge (>= 1.7, < 4)
|
|
39
|
+
safe_yaml (~> 1.0)
|
|
40
|
+
jekyll-sass-converter (1.5.2)
|
|
41
|
+
sass (~> 3.4)
|
|
42
|
+
jekyll-watch (2.2.1)
|
|
43
|
+
listen (~> 3.0)
|
|
44
|
+
kramdown (1.17.0)
|
|
45
|
+
liquid (4.0.3)
|
|
46
|
+
listen (3.1.5)
|
|
47
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
|
48
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
|
49
|
+
ruby_dep (~> 1.2)
|
|
50
|
+
mercenary (0.3.6)
|
|
51
|
+
parallel (1.17.0)
|
|
52
|
+
parser (2.6.3.0)
|
|
53
|
+
ast (~> 2.4.0)
|
|
54
|
+
pathutil (0.16.2)
|
|
55
|
+
forwardable-extended (~> 2.6)
|
|
56
|
+
public_suffix (3.1.1)
|
|
57
|
+
rainbow (3.0.0)
|
|
58
|
+
rake (10.5.0)
|
|
59
|
+
rb-fsevent (0.10.3)
|
|
60
|
+
rb-inotify (0.10.0)
|
|
61
|
+
ffi (~> 1.0)
|
|
62
|
+
rouge (3.7.0)
|
|
63
|
+
rspec (3.8.0)
|
|
64
|
+
rspec-core (~> 3.8.0)
|
|
65
|
+
rspec-expectations (~> 3.8.0)
|
|
66
|
+
rspec-mocks (~> 3.8.0)
|
|
67
|
+
rspec-core (3.8.2)
|
|
68
|
+
rspec-support (~> 3.8.0)
|
|
69
|
+
rspec-expectations (3.8.4)
|
|
70
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
71
|
+
rspec-support (~> 3.8.0)
|
|
72
|
+
rspec-mocks (3.8.1)
|
|
73
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
74
|
+
rspec-support (~> 3.8.0)
|
|
75
|
+
rspec-support (3.8.2)
|
|
76
|
+
rubocop (0.73.0)
|
|
77
|
+
jaro_winkler (~> 1.5.1)
|
|
78
|
+
parallel (~> 1.10)
|
|
79
|
+
parser (>= 2.6)
|
|
80
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
81
|
+
ruby-progressbar (~> 1.7)
|
|
82
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
|
83
|
+
ruby-progressbar (1.10.1)
|
|
84
|
+
ruby_dep (1.5.0)
|
|
85
|
+
safe_yaml (1.0.5)
|
|
86
|
+
sass (3.7.4)
|
|
87
|
+
sass-listen (~> 4.0.0)
|
|
88
|
+
sass-listen (4.0.0)
|
|
89
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
|
90
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
|
91
|
+
unicode-display_width (1.6.0)
|
|
92
|
+
|
|
93
|
+
PLATFORMS
|
|
94
|
+
ruby
|
|
95
|
+
|
|
96
|
+
DEPENDENCIES
|
|
97
|
+
jekyll_push!
|
|
98
|
+
rake (~> 10.0)
|
|
99
|
+
rspec (~> 3.0)
|
|
100
|
+
rubocop
|
|
101
|
+
|
|
102
|
+
BUNDLED WITH
|
|
103
|
+
2.0.1
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Marii Nyrop
|
|
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,35 @@
|
|
|
1
|
+
# JekyllPush
|
|
2
|
+
Jekyll gem plugin to push a compiled site to a GitHub branch. Works locally or on Travis CI if you add an access token.
|
|
3
|
+
|
|
4
|
+
## Installation
|
|
5
|
+
|
|
6
|
+
Add this line to your application's Gemfile:
|
|
7
|
+
|
|
8
|
+
```ruby
|
|
9
|
+
gem 'jekyll_push'
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
And then execute:
|
|
13
|
+
|
|
14
|
+
$ bundle
|
|
15
|
+
|
|
16
|
+
Or install it yourself as:
|
|
17
|
+
|
|
18
|
+
$ gem install jekyll_push
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
`$ jekyll push <branch_name>` or `$ bundle exec jekyll push <branch_name>`
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## Contributing
|
|
26
|
+
|
|
27
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mnyrop/jekyll_push. 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.
|
|
28
|
+
|
|
29
|
+
## License
|
|
30
|
+
|
|
31
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
32
|
+
|
|
33
|
+
## Code of Conduct
|
|
34
|
+
|
|
35
|
+
Everyone interacting in the JekyllPush project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/mnyrop/jekyll_push/blob/master/CODE_OF_CONDUCT.md).
|
data/jekyll_push.gemspec
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |spec|
|
|
4
|
+
spec.name = 'jekyll_push'
|
|
5
|
+
spec.version = '0.1.0'
|
|
6
|
+
spec.authors = ['marii']
|
|
7
|
+
spec.email = ['m.s.nyrop@gmail.com']
|
|
8
|
+
|
|
9
|
+
spec.summary = 'gem to push a compiled jekyll site to a github branch'
|
|
10
|
+
spec.description = 'gem to push a compiled jekyll site to a github branch'
|
|
11
|
+
spec.homepage = 'https://github.com/mnyrop/jekyll_push'
|
|
12
|
+
spec.license = 'MIT'
|
|
13
|
+
|
|
14
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
15
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
spec.require_paths = ['lib']
|
|
19
|
+
|
|
20
|
+
spec.add_runtime_dependency 'jekyll', '> 3.0', '< 4.0'
|
|
21
|
+
spec.add_runtime_dependency 'rainbow', '~> 3.0'
|
|
22
|
+
|
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
|
24
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
25
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module JekyllPush
|
|
4
|
+
#
|
|
5
|
+
#
|
|
6
|
+
class Branch
|
|
7
|
+
attr_reader :target
|
|
8
|
+
|
|
9
|
+
# @param target [String] the name of the Git branch to deploy to
|
|
10
|
+
# @param time [String] message with the time of deployment
|
|
11
|
+
def initialize(target)
|
|
12
|
+
@target = JekyllPush::Utils.slugify target
|
|
13
|
+
@time = Time.now.strftime('%H:%M on %Y-%m-%d')
|
|
14
|
+
|
|
15
|
+
(class << self; include JekyllPush::Travis; end) if on_travis?
|
|
16
|
+
(class << self; include JekyllPush::Local; end) if local?
|
|
17
|
+
|
|
18
|
+
@commit = commit
|
|
19
|
+
@origin = origin
|
|
20
|
+
@msg = msg
|
|
21
|
+
|
|
22
|
+
raise JekyllPush::Error::NoOrigin, 'No remote origin was found for the project GitHub repository.' if @origin.empty?
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
#
|
|
26
|
+
#
|
|
27
|
+
def on_travis?
|
|
28
|
+
!!ENV.fetch('CI', false)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
#
|
|
32
|
+
#
|
|
33
|
+
def local?
|
|
34
|
+
!on_travis?
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
#
|
|
38
|
+
#
|
|
39
|
+
def git_commands
|
|
40
|
+
['git init && git add .', "git commit -m '#{@commit}'", "git remote add origin #{@origin}", "git push origin master:refs/heads/#{@target} --force"]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
#
|
|
44
|
+
#
|
|
45
|
+
def push(dir)
|
|
46
|
+
files = Dir.glob "#{dir}/**/*"
|
|
47
|
+
raise JekyllPush::Error::NoFilesBuilt, "Found no files inside site directory '#{dir}' to push." if files.empty?
|
|
48
|
+
|
|
49
|
+
puts Rainbow("\nFound the following _site files:").cyan
|
|
50
|
+
pretty_list files
|
|
51
|
+
puts Rainbow(@msg).cyan
|
|
52
|
+
|
|
53
|
+
Dir.chdir dir
|
|
54
|
+
File.open('.info', 'w') { |f| f.write @time }
|
|
55
|
+
|
|
56
|
+
git_commands.each { |cmd| system_try cmd }
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
#
|
|
60
|
+
#
|
|
61
|
+
def pretty_list(items)
|
|
62
|
+
items.each { |i| puts "\t+ #{i.strip}" }
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
#
|
|
66
|
+
#
|
|
67
|
+
def system_try(command)
|
|
68
|
+
puts Rainbow("\nTrying `#{command}`").cyan
|
|
69
|
+
success = system command
|
|
70
|
+
return if success
|
|
71
|
+
|
|
72
|
+
raise JekyllPush::Error::SystemCall, Rainbow("JekyllPush Failed on command '#{command}'.")
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module JekyllPush
|
|
4
|
+
#
|
|
5
|
+
#
|
|
6
|
+
class Command < Jekyll::Command
|
|
7
|
+
class << self
|
|
8
|
+
def init_with_program(prog)
|
|
9
|
+
prog.command(:push) do |c|
|
|
10
|
+
c.syntax 'push [args]'
|
|
11
|
+
c.description 'pushes compiled site to specified github branch'
|
|
12
|
+
c.action do |args, _options|
|
|
13
|
+
raise Error::MissingBranch, "You must specify a target branch name after 'jekyll push'." if args.empty?
|
|
14
|
+
|
|
15
|
+
site = JekyllPush::Site.new
|
|
16
|
+
branch = JekyllPush::Branch.new args.first
|
|
17
|
+
|
|
18
|
+
warn Rainbow('Warning: Building the site without a baseurl is not recommended if using GitHub pages.').yellow if site.baseurl.empty? && branch.target == 'gh-pages'
|
|
19
|
+
|
|
20
|
+
site.rebuild
|
|
21
|
+
branch.push site.dir
|
|
22
|
+
|
|
23
|
+
puts Rainbow("\nDone ✓").green
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module JekyllPush
|
|
4
|
+
module Error
|
|
5
|
+
#
|
|
6
|
+
#
|
|
7
|
+
class RainbowError < StandardError
|
|
8
|
+
def initialize(msg = '')
|
|
9
|
+
super Rainbow(msg).magenta
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class MissingBranch < RainbowError; end
|
|
14
|
+
class NoFilesBuilt < RainbowError; end
|
|
15
|
+
class NoOrigin < RainbowError; end
|
|
16
|
+
class SystemCall < RainbowError; end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module JekyllPush
|
|
4
|
+
#
|
|
5
|
+
#
|
|
6
|
+
module Local
|
|
7
|
+
#
|
|
8
|
+
#
|
|
9
|
+
def commit
|
|
10
|
+
"Updated via JekyllPush local task at #{@time}"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
#
|
|
14
|
+
#
|
|
15
|
+
def origin
|
|
16
|
+
`git config --get remote.origin.url`.strip
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
#
|
|
20
|
+
#
|
|
21
|
+
def msg
|
|
22
|
+
"\nDeploying to branch '#{@target}' from local task."
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module JekyllPush
|
|
4
|
+
#
|
|
5
|
+
#
|
|
6
|
+
class Site
|
|
7
|
+
attr_reader :baseurl, :dir
|
|
8
|
+
#
|
|
9
|
+
#
|
|
10
|
+
def initialize(config = nil)
|
|
11
|
+
@config = config || config_from_file
|
|
12
|
+
@baseurl = @config.fetch 'baseurl', ''
|
|
13
|
+
@dir = compiled_site_dir
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
#
|
|
17
|
+
#
|
|
18
|
+
def config_from_file
|
|
19
|
+
YAML.load_file "#{`pwd`.strip}/_config.yml"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
#
|
|
23
|
+
#
|
|
24
|
+
def compiled_site_dir
|
|
25
|
+
File.join `pwd`.strip, '_site'
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Rebuild the Jekyll site with @baseurl
|
|
29
|
+
# @return [Nil]
|
|
30
|
+
def rebuild
|
|
31
|
+
FileUtils.rm_r @dir if File.directory? @dir
|
|
32
|
+
opts = {
|
|
33
|
+
destination: @dir,
|
|
34
|
+
baseurl: @baseurl
|
|
35
|
+
}
|
|
36
|
+
opts['source'] = @config.dig 'source_dir' if @config.key? 'source'
|
|
37
|
+
|
|
38
|
+
Jekyll::Site.new(Jekyll.configuration(opts)).process
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module JekyllPush
|
|
4
|
+
#
|
|
5
|
+
#
|
|
6
|
+
module Travis
|
|
7
|
+
#
|
|
8
|
+
#
|
|
9
|
+
def commit
|
|
10
|
+
"Updated via JekyllPush Travis \"#{ENV['TRAVIS_COMMIT']}\" at #{@time}."
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
#
|
|
14
|
+
#
|
|
15
|
+
def origin
|
|
16
|
+
@repo_slug = ENV['TRAVIS_REPO_SLUG']
|
|
17
|
+
@user = @repo_slug.split('/').first
|
|
18
|
+
@token = ENV['ACCESS_TOKEN']
|
|
19
|
+
|
|
20
|
+
"https://#{@user}:#{@token}@github.com/#{@repo_slug}.git"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
#
|
|
24
|
+
#
|
|
25
|
+
def msg
|
|
26
|
+
"\nDeploying to branch '#{@target}' from Travis as #{@user}."
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module JekyllPush
|
|
4
|
+
#
|
|
5
|
+
#
|
|
6
|
+
module Utils
|
|
7
|
+
#
|
|
8
|
+
#
|
|
9
|
+
def self.slugify(str)
|
|
10
|
+
safe = str.to_s.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
|
|
11
|
+
warn Rainbow("Warning: '#{str}' is not an acceptable branch name. Using '#{safe}' instead.").orange unless safe.eql?(str)
|
|
12
|
+
safe
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
data/lib/jekyll_push.rb
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# 3rd party
|
|
4
|
+
require 'jekyll'
|
|
5
|
+
require 'rainbow'
|
|
6
|
+
|
|
7
|
+
# relative
|
|
8
|
+
require_relative 'jekyll_push/branch'
|
|
9
|
+
require_relative 'jekyll_push/command'
|
|
10
|
+
require_relative 'jekyll_push/error'
|
|
11
|
+
require_relative 'jekyll_push/local'
|
|
12
|
+
require_relative 'jekyll_push/site'
|
|
13
|
+
require_relative 'jekyll_push/travis'
|
|
14
|
+
require_relative 'jekyll_push/utils'
|
|
15
|
+
|
|
16
|
+
#
|
|
17
|
+
#
|
|
18
|
+
module JekyllPush; end
|
metadata
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: jekyll_push
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- marii
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-07-24 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.0'
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '4.0'
|
|
23
|
+
type: :runtime
|
|
24
|
+
prerelease: false
|
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
+
requirements:
|
|
27
|
+
- - ">"
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '3.0'
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '4.0'
|
|
33
|
+
- !ruby/object:Gem::Dependency
|
|
34
|
+
name: rainbow
|
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '3.0'
|
|
40
|
+
type: :runtime
|
|
41
|
+
prerelease: false
|
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '3.0'
|
|
47
|
+
- !ruby/object:Gem::Dependency
|
|
48
|
+
name: rake
|
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '10.0'
|
|
54
|
+
type: :development
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '10.0'
|
|
61
|
+
- !ruby/object:Gem::Dependency
|
|
62
|
+
name: rspec
|
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '3.0'
|
|
68
|
+
type: :development
|
|
69
|
+
prerelease: false
|
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '3.0'
|
|
75
|
+
description: gem to push a compiled jekyll site to a github branch
|
|
76
|
+
email:
|
|
77
|
+
- m.s.nyrop@gmail.com
|
|
78
|
+
executables: []
|
|
79
|
+
extensions: []
|
|
80
|
+
extra_rdoc_files: []
|
|
81
|
+
files:
|
|
82
|
+
- ".gitignore"
|
|
83
|
+
- ".rspec"
|
|
84
|
+
- ".rubocop.yml"
|
|
85
|
+
- ".travis.yml"
|
|
86
|
+
- CODE_OF_CONDUCT.md
|
|
87
|
+
- Gemfile
|
|
88
|
+
- Gemfile.lock
|
|
89
|
+
- LICENSE.txt
|
|
90
|
+
- README.md
|
|
91
|
+
- jekyll_push.gemspec
|
|
92
|
+
- lib/jekyll_push.rb
|
|
93
|
+
- lib/jekyll_push/branch.rb
|
|
94
|
+
- lib/jekyll_push/command.rb
|
|
95
|
+
- lib/jekyll_push/error.rb
|
|
96
|
+
- lib/jekyll_push/local.rb
|
|
97
|
+
- lib/jekyll_push/site.rb
|
|
98
|
+
- lib/jekyll_push/travis.rb
|
|
99
|
+
- lib/jekyll_push/utils.rb
|
|
100
|
+
homepage: https://github.com/mnyrop/jekyll_push
|
|
101
|
+
licenses:
|
|
102
|
+
- MIT
|
|
103
|
+
metadata: {}
|
|
104
|
+
post_install_message:
|
|
105
|
+
rdoc_options: []
|
|
106
|
+
require_paths:
|
|
107
|
+
- lib
|
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
|
+
requirements:
|
|
110
|
+
- - ">="
|
|
111
|
+
- !ruby/object:Gem::Version
|
|
112
|
+
version: '0'
|
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0'
|
|
118
|
+
requirements: []
|
|
119
|
+
rubygems_version: 3.0.2
|
|
120
|
+
signing_key:
|
|
121
|
+
specification_version: 4
|
|
122
|
+
summary: gem to push a compiled jekyll site to a github branch
|
|
123
|
+
test_files: []
|