jekyll-gh-pages 0.0.1

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 ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ODg3OWI0N2VhZTRmNDUwOTdiYmU1ZDRmZTNjY2E4MmVkYTExY2MxMA==
5
+ data.tar.gz: !binary |-
6
+ ZGMzMjg5ZDZkNzBmMGZhMzRiYmVlMzdhZmJiZWNmMjEwMWVjOTBhNg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ N2JjNDdlMjU0ZDMyODgxYTdmZjJiNWQ2YjMxNzY4N2QwYTdkYTkwYzY0NDY5
10
+ ZGFlNGU1MzI1OWU5MGIzZjgzZDdmNjVlMGQ2YWFhZDAwYWI5YTRiMWM5NzA4
11
+ MzdmNDViODlkN2UxYTI5Y2JjZDZhODVlMDBmYjI3ZjU5MTkzM2I=
12
+ data.tar.gz: !binary |-
13
+ NWZhNmZiNjBhMjJlYTlhOTU4YzU1MjMzNTFjN2FkYzc4ZWIyZDNhMWMzOTY0
14
+ YzYzNDgwMWU3YWU3MzE0NzIxOTMxYjBmYTMyNmI4NzNjZDdlNGY3YjUxNGNj
15
+ MDlhZjIzMzkyNzY4NmFmNmM5N2FmNjEyM2JlZWZlODQ4MTJhMzM=
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ *.swp
2
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jekyll-gh-pages.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,31 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jekyll-gh-pages (0.0.1)
5
+ rake (> 0.9.3)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.2.5)
11
+ rake (10.3.2)
12
+ rspec (3.0.0)
13
+ rspec-core (~> 3.0.0)
14
+ rspec-expectations (~> 3.0.0)
15
+ rspec-mocks (~> 3.0.0)
16
+ rspec-core (3.0.0)
17
+ rspec-support (~> 3.0.0)
18
+ rspec-expectations (3.0.0)
19
+ diff-lcs (>= 1.2.0, < 2.0)
20
+ rspec-support (~> 3.0.0)
21
+ rspec-mocks (3.0.0)
22
+ rspec-support (~> 3.0.0)
23
+ rspec-support (3.0.0)
24
+
25
+ PLATFORMS
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ bundler (~> 1.6)
30
+ jekyll-gh-pages!
31
+ rspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Ryo Chikazawa
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # Jekyll Github Pages
2
+
3
+ Inspired by [middleman-gh-pages](https://github.com/neo/middleman-gh-pages), Jekyll Github Pages helps deploying Jekyll site to github gh-pages branch. However Github Pages basically supports Jekyll, they have a lot of restrictions. So you might want to use github pages just as a host for static pages. This gem provides rake tasks that automate the process of deploying a Jekyll site to Github Pages.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+ ```sh
9
+ gem 'jekyll-gh-pages'
10
+ ```
11
+
12
+ You'll also need to require the gem in your Rakefile:
13
+ ```sh
14
+ require 'jekyll-gh-pages'
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ - Prepare the environment (only for the first time)
20
+ ```sh
21
+ rake prepare
22
+ ```
23
+
24
+ - Watch the changes
25
+ ```sh
26
+ rake watch
27
+ ```
28
+
29
+ - Build a Jekyll site
30
+ ```sh
31
+ rake build
32
+ ```
33
+
34
+ - Deploy to gh-pages branch
35
+ ```sh
36
+ rake deploy
37
+ ```
38
+
39
+
40
+ ## Contributing
41
+
42
+ 1. Fork it ( https://github.com/chikathreesix/jekyll-gh-pages/fork )
43
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
44
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
45
+ 4. Push to the branch (`git push origin my-new-feature`)
46
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
@@ -0,0 +1,24 @@
1
+ #encoding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'jekyll-gh-pages/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "jekyll-gh-pages"
8
+ gem.version = JekyllGhPages::VERSION
9
+ gem.authors = ["Ryo Chikazawa"]
10
+ gem.email = ["chikathreesix@gmail.com"]
11
+ gem.summary = %q{Deploy Jekyll sites to Github Pages easily}
12
+ gem.description = %q{Inspired by middleman-gh-pages, Jekyll Github Pages helps deploying Jekyll site to github gh-pages branch. However Github Pages basically supports Jekyll, they have a lot of restrictions. So you might want to use github pages just as a host for static pages. This gem provides rake tasks that automate the process of deploying a Jekyll site to Github Pages.}
13
+ gem.homepage = "https://github.com/chikathreesix/jekyll-gh-pages"
14
+ gem.license = 'MIT'
15
+
16
+ gem.files = `git ls-files -z`.split("\x0")
17
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
+ gem.require_paths = ["lib"]
20
+
21
+ gem.add_dependency 'rake', '> 0.9.3'
22
+ gem.add_development_dependency "bundler", "~> 1.6"
23
+ gem.add_development_dependency "rspec"
24
+ end
@@ -0,0 +1,69 @@
1
+ require 'fileutils'
2
+
3
+ remote_name = ENV.fetch("REMOTE_NAME", "origin")
4
+
5
+ PROJECT_ROOT = `git rev-parse --show-toplevel`.strip
6
+ BUILD_DIR = File.join(PROJECT_ROOT, "build")
7
+ GH_PAGES_REF = File.join(BUILD_DIR, ".git/refs/remotes/#{remote_name}/gh-pages")
8
+
9
+ directory BUILD_DIR
10
+
11
+ file GH_PAGES_REF => BUILD_DIR do
12
+ repo_url = nil
13
+
14
+ cd PROJECT_ROOT do
15
+ repo_url = `git config --get remote.#{remote_name}.url`.strip
16
+ end
17
+
18
+ cd BUILD_DIR do
19
+ sh "git init"
20
+ sh "git remote add #{remote_name} #{repo_url}"
21
+ sh "git fetch #{remote_name}"
22
+
23
+ if `git branch -r` =~ /gh-pages/
24
+ sh "git checkout gh-pages"
25
+ else
26
+ sh "git checkout --orphan gh-pages"
27
+ sh "touch index.html"
28
+ sh "git add ."
29
+ sh "git commit -m 'initial gh-pages commit'"
30
+ sh "git push #{remote_name} gh-pages"
31
+ end
32
+ end
33
+ end
34
+
35
+ desc "Prepare for build"
36
+ task :prepare => GH_PAGES_REF
37
+
38
+ desc "Watch"
39
+ task :watch do
40
+ sh "bundle exec jekyll serve --watch"
41
+ end
42
+
43
+ desc "Build static files"
44
+ task :build do
45
+ cd PROJECT_ROOT do
46
+ sh "bundle exec jekyll build --destination #{BUILD_DIR} --config _config.yml,_config_prod.yml"
47
+ end
48
+ end
49
+
50
+ desc "Deploy static files to gh-pages branch"
51
+ task :deploy => [:build] do
52
+ message = nil
53
+ suffix = ENV["COMMIT_MESSAGE_SUFFIX"]
54
+
55
+ cd PROJECT_ROOT do
56
+ head = `git log --pretty="%h" -n1`.strip
57
+ message = ["Site updated to #{head}", suffix].compact.join("\n\n")
58
+ end
59
+
60
+ cd BUILD_DIR do
61
+ sh 'git add --all'
62
+ if /nothing to commit/ =~ `git status`
63
+ puts "No changes to commit."
64
+ else
65
+ sh "git commit -m \"#{message}\""
66
+ end
67
+ sh "git push #{remote_name} gh-pages"
68
+ end
69
+ end
@@ -0,0 +1,73 @@
1
+ require 'fileutils'
2
+
3
+ remote_name = ENV.fetch("REMOTE_NAME", "origin")
4
+
5
+ PROJECT_ROOT = `git rev-parse --show-toplevel`.strip
6
+ BUILD_DIR = File.join(PROJECT_ROOT, "build")
7
+ GH_PAGES_REF = File.join(BUILD_DIR, ".git/refs/remotes/#{remote_name}/gh-pages")
8
+
9
+ directory BUILD_DIR
10
+
11
+ file GH_PAGES_REF => BUILD_DIR do
12
+ repo_url = nil
13
+
14
+ cd PROJECT_ROOT do
15
+ repo_url = `git config --get remote.#{remote_name}.url`.strip
16
+ end
17
+
18
+ cd BUILD_DIR do
19
+ sh "git init"
20
+ sh "git remote add #{remote_name} #{repo_url}"
21
+ sh "git fetch #{remote_name}"
22
+
23
+ if `git branch -r` =~ /gh-pages/
24
+ sh "git checkout gh-pages"
25
+ else
26
+ sh "git checkout --orphan gh-pages"
27
+ sh "touch index.html"
28
+ sh "git add ."
29
+ sh "git commit -m 'initial gh-pages commit'"
30
+ sh "git push #{remote_name} gh-pages"
31
+ end
32
+ end
33
+ end
34
+
35
+ desc "Prepare for build"
36
+ task :prepare => GH_PAGES_REF
37
+
38
+ desc "Watch"
39
+ task :watch do
40
+ sh "bundle exec jekyll serve --watch"
41
+ end
42
+
43
+ desc "Build static files"
44
+ task :build do
45
+ cd PROJECT_ROOT do
46
+ if File.exist?('_config_prod.yml')
47
+ sh "bundle exec jekyll build --destination #{BUILD_DIR} --config _config.yml,_config_prod.yml"
48
+ else
49
+ sh "bundle exec jekyll build --destination #{BUILD_DIR}"
50
+ end
51
+ end
52
+ end
53
+
54
+ desc "Deploy static files to gh-pages branch"
55
+ task :deploy => [:build] do
56
+ message = nil
57
+ suffix = ENV["COMMIT_MESSAGE_SUFFIX"]
58
+
59
+ cd PROJECT_ROOT do
60
+ head = `git log --pretty="%h" -n1`.strip
61
+ message = ["Site updated to #{head}", suffix].compact.join("\n\n")
62
+ end
63
+
64
+ cd BUILD_DIR do
65
+ sh 'git add --all'
66
+ if /nothing to commit/ =~ `git status`
67
+ puts "No changes to commit."
68
+ else
69
+ sh "git commit -m \"#{message}\""
70
+ end
71
+ sh "git push #{remote_name} gh-pages"
72
+ end
73
+ end
@@ -0,0 +1,3 @@
1
+ module JekyllGhPages
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,5 @@
1
+ require 'jekyll-gh-pages/version'
2
+
3
+ if defined?(Rake)
4
+ result = Rake.add_rakelib(File.expand_path('../jekyll-gh-pages/tasks', __FILE__))
5
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe JekyllGhPages do
4
+ it 'has a version number' do
5
+ expect(JekyllGhPages::VERSION).not_to be nil
6
+ end
7
+
8
+ describe 'tasks' do
9
+ before(:all) do
10
+ # TODO test jekyll-gh-pages.rb
11
+ load File.expand_path("../../lib/jekyll-gh-pages/tasks/gh-pages.rake", __FILE__)
12
+ end
13
+
14
+ it 'defines build task' do
15
+ expect(Rake::Task.task_defined?('build')).to be true
16
+ end
17
+
18
+ it 'defines prepare task' do
19
+ expect(Rake::Task.task_defined?('prepare')).to be true
20
+ end
21
+
22
+ it 'defines watch task' do
23
+ expect(Rake::Task.task_defined?('watch')).to be true
24
+ end
25
+
26
+ it 'defines deploy task' do
27
+ expect(Rake::Task.task_defined?('deploy')).to be true
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'rake'
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-gh-pages
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ryo Chikazawa
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>'
18
+ - !ruby/object:Gem::Version
19
+ version: 0.9.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>'
25
+ - !ruby/object:Gem::Version
26
+ version: 0.9.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.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
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
+ description: Inspired by middleman-gh-pages, Jekyll Github Pages helps deploying Jekyll
56
+ site to github gh-pages branch. However Github Pages basically supports Jekyll,
57
+ they have a lot of restrictions. So you might want to use github pages just as a
58
+ host for static pages. This gem provides rake tasks that automate the process of
59
+ deploying a Jekyll site to Github Pages.
60
+ email:
61
+ - chikathreesix@gmail.com
62
+ executables: []
63
+ extensions: []
64
+ extra_rdoc_files: []
65
+ files:
66
+ - .gitignore
67
+ - .rspec
68
+ - .travis.yml
69
+ - Gemfile
70
+ - Gemfile.lock
71
+ - LICENSE.txt
72
+ - README.md
73
+ - Rakefile
74
+ - jekyll-gh-pages.gemspec
75
+ - lib/jekyll-gh-pages.rb
76
+ - lib/jekyll-gh-pages/tasks.rake
77
+ - lib/jekyll-gh-pages/tasks/gh-pages.rake
78
+ - lib/jekyll-gh-pages/version.rb
79
+ - spec/jekyll-gh-pages_spec.rb
80
+ - spec/spec_helper.rb
81
+ homepage: https://github.com/chikathreesix/jekyll-gh-pages
82
+ licenses:
83
+ - MIT
84
+ metadata: {}
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 2.2.2
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: Deploy Jekyll sites to Github Pages easily
105
+ test_files:
106
+ - spec/jekyll-gh-pages_spec.rb
107
+ - spec/spec_helper.rb