middleman-gh-pages 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in middleman-gh-pages.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Adam McCrea
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,43 @@
1
+ # Middleman Github Pages
2
+
3
+ [Middleman](http://middlemanapp.com) makes creating static sites a joy, [Github
4
+ Pages](http://pages.github.com) hosts static sites for free, Middleman Github
5
+ Pages brings the two together. Middleman Github Pages is just a few rake tasks
6
+ that automate the process of deploying a Middleman site to Github Pages.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your Gemfile:
11
+
12
+ ```shell
13
+ gem 'middleman-gh-pages'
14
+ ```
15
+
16
+ You'll also need to require the gem in your Rakefile:
17
+
18
+ ```ruby
19
+ require 'middleman-gh-pages'
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ Middleman Github Pages provides the following rake tasks:
25
+
26
+ ```shell
27
+ rake build # Compile all files into the build directory
28
+ rake publish # Build and publish to Github Pages
29
+ ```
30
+
31
+ The only assumption is that you are deploying to a gh-pages branch in the same
32
+ remote as the source. `rake publish` will create this branch for you if it
33
+ doesn't exist.
34
+
35
+ Note that you cannot deploy your site if you have uncommitted changes.
36
+
37
+ ## Contributing
38
+
39
+ 1. Fork it
40
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
41
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
42
+ 4. Push to the branch (`git push origin my-new-feature`)
43
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,63 @@
1
+ require 'fileutils'
2
+
3
+ BUILD_DIR = File.join(File.dirname(__FILE__), "build")
4
+ GH_PAGES_REF = File.join(BUILD_DIR, ".git/refs/remotes/origin/gh-pages")
5
+
6
+ directory BUILD_DIR
7
+
8
+ file GH_PAGES_REF => BUILD_DIR do
9
+ repo_url = `git config --get remote.origin.url`.strip
10
+
11
+ cd BUILD_DIR do
12
+ sh "git init"
13
+ sh "git remote add origin #{repo_url}"
14
+ sh "git fetch origin"
15
+
16
+ if `git branch -r` =~ /gh-pages/
17
+ sh "git checkout gh-pages"
18
+ else
19
+ sh "git checkout --orphan gh-pages"
20
+ sh "touch index.html"
21
+ sh "git add ."
22
+ sh "git commit -m 'initial gh-pages commit'"
23
+ sh "git push origin gh-pages"
24
+ end
25
+ end
26
+ end
27
+
28
+ # Alias to something meaningful
29
+ task :prepare_git_remote_in_build_dir => GH_PAGES_REF
30
+
31
+ # Fetch upstream changes on gh-pages branch
32
+ task :sync do
33
+ cd BUILD_DIR do
34
+ sh "git fetch origin"
35
+ sh "git reset --hard origin/gh-pages"
36
+ end
37
+ end
38
+
39
+ # Prevent accidental publishing before committing changes
40
+ task :not_dirty do
41
+ fail "Directory not clean" if /nothing to commit/ !~ `git status`
42
+ end
43
+
44
+ desc "Compile all files into the build directory"
45
+ task :build do
46
+ sh "bundle exec middleman build --clean"
47
+ end
48
+
49
+ desc "Build and publish to Github Pages"
50
+ task :publish => [:not_dirty, :prepare_git_remote_in_build_dir, :sync, :build] do
51
+ head = `git log --pretty="%h" -n1`.strip
52
+ message = "Site updated to #{head}"
53
+
54
+ cd BUILD_DIR do
55
+ sh 'git add --all'
56
+ if /nothing to commit/ =~ `git status`
57
+ puts "No changes to commit."
58
+ else
59
+ sh "git commit -m \"#{message}\""
60
+ end
61
+ sh "git push origin gh-pages"
62
+ end
63
+ end
@@ -0,0 +1,5 @@
1
+ module Middleman
2
+ module GithubPages
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ require "middleman-gh-pages/version"
2
+
3
+ if defined?(Rake)
4
+ Rake.add_rakelib(File.expand_path('../middleman-gh-pages/tasks', __FILE__))
5
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'middleman-gh-pages/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "middleman-gh-pages"
8
+ gem.version = Middleman::GithubPages::VERSION
9
+ gem.authors = ["Adam McCrea"]
10
+ gem.email = ["adam@adamlogic.com"]
11
+ gem.description = %q{Easy deployment of Middleman sites to Github Pages}
12
+ gem.summary = %q{Easy deployment of Middleman sites to Github Pages}
13
+ gem.homepage = "http://github.com/newcontext/middleman-gh-pages"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency 'rake', '> 0.9.3'
21
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: middleman-gh-pages
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Adam McCrea
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-11-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>'
20
+ - !ruby/object:Gem::Version
21
+ version: 0.9.3
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>'
28
+ - !ruby/object:Gem::Version
29
+ version: 0.9.3
30
+ description: Easy deployment of Middleman sites to Github Pages
31
+ email:
32
+ - adam@adamlogic.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - .gitignore
38
+ - Gemfile
39
+ - LICENSE.txt
40
+ - README.md
41
+ - Rakefile
42
+ - lib/middleman-gh-pages.rb
43
+ - lib/middleman-gh-pages/tasks/gh-pages.rake
44
+ - lib/middleman-gh-pages/version.rb
45
+ - middleman-gh-pages.gemspec
46
+ homepage: http://github.com/newcontext/middleman-gh-pages
47
+ licenses: []
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ segments:
59
+ - 0
60
+ hash: 576739196795499365
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ segments:
68
+ - 0
69
+ hash: 576739196795499365
70
+ requirements: []
71
+ rubyforge_project:
72
+ rubygems_version: 1.8.24
73
+ signing_key:
74
+ specification_version: 3
75
+ summary: Easy deployment of Middleman sites to Github Pages
76
+ test_files: []