nanoc-git 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -33
- data/nanoc-git.gemspec +8 -19
- metadata +13 -50
- data/Gemfile +0 -7
- data/Gemfile.lock +0 -59
- data/LICENSE +0 -19
- data/NEWS.md +0 -10
- data/Rakefile +0 -10
- data/lib/nanoc-git.rb +0 -3
- data/lib/nanoc/git.rb +0 -9
- data/lib/nanoc/git/deployer.rb +0 -90
- data/lib/nanoc/git/version.rb +0 -7
- data/test/filters/test_git.rb +0 -300
- data/test/helper.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06c0f31b6ffd0812cde9d6204d47acc97a557820
|
4
|
+
data.tar.gz: 68b149ebe8ff2b6ab0d50cde9da0e96bc856ae54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 701556620c5bbfbcef9a769f41a1202e3f1def634a2fc2e18d0f209c5d19827ac62aa91e5733f0ca4f5cc34a0a6657927859c16b2cd6e3871c301cf7e045249e
|
7
|
+
data.tar.gz: e365ea496a01a408823f4d5f0bd89443432db8045deb4e9791112035411d79f72037e4fe0608cf45369cbad3fbe441761a2fa8579aa31cc55c52e31017133a59
|
data/README.md
CHANGED
@@ -1,35 +1,3 @@
|
|
1
|
-
[![Build Status](https://travis-ci.org/nanoc/nanoc-git.png)](https://travis-ci.org/nanoc/nanoc-git)
|
2
|
-
|
3
1
|
# nanoc-git
|
4
2
|
|
5
|
-
This
|
6
|
-
|
7
|
-
Maintained by [lifepillar](https://github.com/lifepillar).
|
8
|
-
|
9
|
-
## Compatibility
|
10
|
-
|
11
|
-
Nanoc 4.0.0 or later.
|
12
|
-
|
13
|
-
## Installation
|
14
|
-
|
15
|
-
`gem install nanoc-git`
|
16
|
-
|
17
|
-
## Usage
|
18
|
-
|
19
|
-
Example configuration for the Git deployer:
|
20
|
-
|
21
|
-
```yaml
|
22
|
-
deploy:
|
23
|
-
default:
|
24
|
-
kind: git
|
25
|
-
remote: git@github.com:myself/myproject.git
|
26
|
-
branch: gh-pages
|
27
|
-
forced: true
|
28
|
-
```
|
29
|
-
|
30
|
-
The following configuration options are available:
|
31
|
-
|
32
|
-
* `remote` (default `origin`): the Git remote to deploy to
|
33
|
-
* `branch` (default `master`): the Git branch to deploy
|
34
|
-
* `forced` (default `false`): Whether or not to push with `--force`
|
35
|
-
|
3
|
+
This repository is obsolete. The Git deployer is now part of Nanoc.
|
data/nanoc-git.gemspec
CHANGED
@@ -1,29 +1,18 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
$LOAD_PATH.unshift(File.expand_path('../lib/', __FILE__))
|
4
|
-
require 'nanoc/git/version'
|
5
|
-
|
6
3
|
Gem::Specification.new do |s|
|
7
4
|
s.name = 'nanoc-git'
|
8
|
-
s.version =
|
5
|
+
s.version = '2.0.0'
|
9
6
|
s.homepage = 'http://nanoc.ws/'
|
10
|
-
s.summary = 'Git deployer for
|
11
|
-
s.description = 'Provides a Git deployer for
|
7
|
+
s.summary = '(Obsolete) Git deployer for Nanoc'
|
8
|
+
s.description = 'Provides a Git deployer for Nanoc. Obsolete; merged into Nanoc 4.5.'
|
12
9
|
|
13
|
-
s.author = '
|
14
|
-
s.email = '
|
10
|
+
s.author = 'Denis Defreyne'
|
11
|
+
s.email = 'denis@stoneship.orgorg'
|
15
12
|
s.license = 'MIT'
|
16
13
|
|
17
|
-
s.
|
18
|
-
|
19
|
-
s.files = Dir['[A-Z]*'] +
|
20
|
-
Dir['{lib,test}/**/*'] +
|
21
|
-
[ 'nanoc-git.gemspec' ]
|
22
|
-
s.require_paths = [ 'lib' ]
|
23
|
-
|
24
|
-
s.rdoc_options = [ '--main', 'README.md' ]
|
25
|
-
s.extra_rdoc_files = [ 'LICENSE', 'README.md', 'NEWS.md' ]
|
14
|
+
s.files = Dir['[A-Z]*'] + ['nanoc-git.gemspec']
|
15
|
+
s.require_paths = ['lib']
|
26
16
|
|
27
|
-
s.add_runtime_dependency('nanoc', '
|
28
|
-
s.add_development_dependency('bundler', '~> 1.5')
|
17
|
+
s.add_runtime_dependency('nanoc', '~> 4.5')
|
29
18
|
end
|
metadata
CHANGED
@@ -1,86 +1,50 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc-git
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nanoc
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 3.7.0
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 5.0.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.7.0
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 5.0.0
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: bundler
|
35
15
|
requirement: !ruby/object:Gem::Requirement
|
36
16
|
requirements:
|
37
17
|
- - "~>"
|
38
18
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
40
|
-
type: :
|
19
|
+
version: '4.5'
|
20
|
+
type: :runtime
|
41
21
|
prerelease: false
|
42
22
|
version_requirements: !ruby/object:Gem::Requirement
|
43
23
|
requirements:
|
44
24
|
- - "~>"
|
45
25
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
47
|
-
description: Provides a Git deployer for
|
48
|
-
email:
|
26
|
+
version: '4.5'
|
27
|
+
description: Provides a Git deployer for Nanoc. Obsolete; merged into Nanoc 4.5.
|
28
|
+
email: denis@stoneship.orgorg
|
49
29
|
executables: []
|
50
30
|
extensions: []
|
51
|
-
extra_rdoc_files:
|
52
|
-
- LICENSE
|
53
|
-
- README.md
|
54
|
-
- NEWS.md
|
31
|
+
extra_rdoc_files: []
|
55
32
|
files:
|
56
|
-
- Gemfile
|
57
|
-
- Gemfile.lock
|
58
|
-
- LICENSE
|
59
|
-
- NEWS.md
|
60
33
|
- README.md
|
61
|
-
- Rakefile
|
62
|
-
- lib/nanoc-git.rb
|
63
|
-
- lib/nanoc/git.rb
|
64
|
-
- lib/nanoc/git/deployer.rb
|
65
|
-
- lib/nanoc/git/version.rb
|
66
34
|
- nanoc-git.gemspec
|
67
|
-
- test/filters/test_git.rb
|
68
|
-
- test/helper.rb
|
69
35
|
homepage: http://nanoc.ws/
|
70
36
|
licenses:
|
71
37
|
- MIT
|
72
38
|
metadata: {}
|
73
39
|
post_install_message:
|
74
|
-
rdoc_options:
|
75
|
-
- "--main"
|
76
|
-
- README.md
|
40
|
+
rdoc_options: []
|
77
41
|
require_paths:
|
78
42
|
- lib
|
79
43
|
required_ruby_version: !ruby/object:Gem::Requirement
|
80
44
|
requirements:
|
81
45
|
- - ">="
|
82
46
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
47
|
+
version: '0'
|
84
48
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
49
|
requirements:
|
86
50
|
- - ">="
|
@@ -88,9 +52,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
52
|
version: '0'
|
89
53
|
requirements: []
|
90
54
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.
|
55
|
+
rubygems_version: 2.6.8
|
92
56
|
signing_key:
|
93
57
|
specification_version: 4
|
94
|
-
summary: Git deployer for
|
58
|
+
summary: "(Obsolete) Git deployer for Nanoc"
|
95
59
|
test_files: []
|
96
|
-
has_rdoc:
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
nanoc-git (1.0.1)
|
5
|
-
nanoc (>= 3.7.0, < 5.0.0)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
colored (1.2)
|
11
|
-
coveralls (0.8.3)
|
12
|
-
json (~> 1.8)
|
13
|
-
rest-client (>= 1.6.8, < 2)
|
14
|
-
simplecov (~> 0.10.0)
|
15
|
-
term-ansicolor (~> 1.3)
|
16
|
-
thor (~> 0.19.1)
|
17
|
-
cri (2.7.0)
|
18
|
-
colored (~> 1.2)
|
19
|
-
docile (1.1.5)
|
20
|
-
domain_name (0.5.25)
|
21
|
-
unf (>= 0.0.5, < 1.0.0)
|
22
|
-
http-cookie (1.0.2)
|
23
|
-
domain_name (~> 0.5)
|
24
|
-
json (1.8.3)
|
25
|
-
mime-types (2.6.2)
|
26
|
-
minitest (5.8.2)
|
27
|
-
nanoc (4.0.0)
|
28
|
-
cri (~> 2.3)
|
29
|
-
netrc (0.11.0)
|
30
|
-
rake (10.4.2)
|
31
|
-
rest-client (1.8.0)
|
32
|
-
http-cookie (>= 1.0.2, < 2.0)
|
33
|
-
mime-types (>= 1.16, < 3.0)
|
34
|
-
netrc (~> 0.7)
|
35
|
-
simplecov (0.10.0)
|
36
|
-
docile (~> 1.1.0)
|
37
|
-
json (~> 1.8)
|
38
|
-
simplecov-html (~> 0.10.0)
|
39
|
-
simplecov-html (0.10.0)
|
40
|
-
term-ansicolor (1.3.2)
|
41
|
-
tins (~> 1.0)
|
42
|
-
thor (0.19.1)
|
43
|
-
tins (1.6.0)
|
44
|
-
unf (0.1.4)
|
45
|
-
unf_ext
|
46
|
-
unf_ext (0.0.7.1)
|
47
|
-
|
48
|
-
PLATFORMS
|
49
|
-
ruby
|
50
|
-
|
51
|
-
DEPENDENCIES
|
52
|
-
bundler (~> 1.5)
|
53
|
-
coveralls
|
54
|
-
minitest
|
55
|
-
nanoc-git!
|
56
|
-
rake
|
57
|
-
|
58
|
-
BUNDLED WITH
|
59
|
-
1.10.6
|
data/LICENSE
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
Copyright (c) 2015 Denis Defreyne and contributors
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
5
|
-
in the Software without restriction, including without limitation the rights
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
8
|
-
furnished to do so, subject to the following conditions:
|
9
|
-
|
10
|
-
The above copyright notice and this permission notice shall be included in all
|
11
|
-
copies or substantial portions of the Software.
|
12
|
-
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
-
SOFTWARE.
|
data/NEWS.md
DELETED
data/Rakefile
DELETED
data/lib/nanoc-git.rb
DELETED
data/lib/nanoc/git.rb
DELETED
data/lib/nanoc/git/deployer.rb
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module Nanoc::Git
|
4
|
-
# A deployer that deploys a site using [Git](http://git-scm.com).
|
5
|
-
#
|
6
|
-
# @example A deployment configuration for GitHub Pages:
|
7
|
-
#
|
8
|
-
# deploy:
|
9
|
-
# default:
|
10
|
-
# kind: git
|
11
|
-
# remote: git@github.com:myself/myproject.git
|
12
|
-
# branch: gh-pages
|
13
|
-
# forced: true
|
14
|
-
#
|
15
|
-
class Deployer < ::Nanoc::Extra::Deployer
|
16
|
-
identifier :git
|
17
|
-
|
18
|
-
# @see Nanoc::Extra::Deployer#run
|
19
|
-
def run
|
20
|
-
unless File.exist?(source_path)
|
21
|
-
raise "#{source_path} does not exist. Please build your site first."
|
22
|
-
end
|
23
|
-
|
24
|
-
remote = config.fetch(:remote, 'origin')
|
25
|
-
branch = config.fetch(:branch, 'master')
|
26
|
-
forced = config.fetch(:forced, false)
|
27
|
-
|
28
|
-
puts "Deploying via git to remote='#{remote}' and branch='#{branch}'"
|
29
|
-
|
30
|
-
Dir.chdir(source_path) do
|
31
|
-
unless File.exist?('.git')
|
32
|
-
puts "#{source_path} does not appear to be a Git repo. Creating one..."
|
33
|
-
run_shell_cmd(%w( git init ))
|
34
|
-
end
|
35
|
-
|
36
|
-
# If the remote is not a URL already, verify that it is defined.
|
37
|
-
# Examples of URLs:
|
38
|
-
# https://github.com/nanoc/nanoc.git
|
39
|
-
# git@github.com:lifepillar/nanoc.git
|
40
|
-
unless remote.match(/:\/\/|@.+:/)
|
41
|
-
begin
|
42
|
-
run_shell_cmd(%W( git config --get remote.#{remote}.url ))
|
43
|
-
rescue Nanoc::Extra::Piper::Error
|
44
|
-
raise "Please add a remote called '#{remote}' to the repo inside #{source_path}."
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
# If the branch exists then switch to it, otherwise prompt the user to create one.
|
49
|
-
begin
|
50
|
-
run_shell_cmd(%W( git checkout #{branch} ))
|
51
|
-
rescue
|
52
|
-
raise "Branch '#{branch}' does not exist inside #{source_path}. Please create one and try again."
|
53
|
-
end
|
54
|
-
|
55
|
-
unless clean_repo?
|
56
|
-
msg = "Automated commit at #{Time.now.utc} by nanoc #{Nanoc::VERSION}"
|
57
|
-
run_shell_cmd(%w( git add -A ))
|
58
|
-
run_shell_cmd(%W( git commit -am #{msg} ))
|
59
|
-
end
|
60
|
-
if forced
|
61
|
-
run_shell_cmd(%W( git push -f #{remote} #{branch} ))
|
62
|
-
else
|
63
|
-
run_shell_cmd(%W( git push #{remote} #{branch} ))
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
private
|
69
|
-
|
70
|
-
def run_shell_cmd(cmd)
|
71
|
-
if dry_run
|
72
|
-
puts cmd.join(' ')
|
73
|
-
else
|
74
|
-
piper = Nanoc::Extra::Piper.new(:stdout => $stdout, :stderr => $stderr)
|
75
|
-
piper.run(cmd, nil)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def clean_repo?
|
80
|
-
if dry_run && !File.exist?('.git')
|
81
|
-
true
|
82
|
-
else
|
83
|
-
stdout = StringIO.new
|
84
|
-
piper = Nanoc::Extra::Piper.new(:stdout => stdout, :stderr => $stderr)
|
85
|
-
piper.run(%w( git status --porcelain ), nil)
|
86
|
-
stdout.string.empty?
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
data/lib/nanoc/git/version.rb
DELETED
data/test/filters/test_git.rb
DELETED
@@ -1,300 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'helper'
|
4
|
-
|
5
|
-
class Nanoc::Git::DeployerTest < Minitest::Test
|
6
|
-
def setup
|
7
|
-
# Go quiet
|
8
|
-
unless ENV['QUIET'] == 'false'
|
9
|
-
@orig_stdout = $stdout
|
10
|
-
@orig_stderr = $stderr
|
11
|
-
|
12
|
-
$stdout = StringIO.new
|
13
|
-
$stderr = StringIO.new
|
14
|
-
end
|
15
|
-
|
16
|
-
# Enter tmp
|
17
|
-
@tmp_dir = Dir.mktmpdir('nanoc-test')
|
18
|
-
@orig_wd = FileUtils.pwd
|
19
|
-
FileUtils.cd(@tmp_dir)
|
20
|
-
end
|
21
|
-
|
22
|
-
def teardown
|
23
|
-
# Exit tmp
|
24
|
-
FileUtils.cd(@orig_wd)
|
25
|
-
FileUtils.rm_rf(@tmp_dir)
|
26
|
-
|
27
|
-
# Go unquiet
|
28
|
-
unless ENV['QUIET'] == 'false'
|
29
|
-
$stdout = @orig_stdout
|
30
|
-
$stderr = @orig_stderr
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_run_without_output_folder
|
35
|
-
# Create deployer
|
36
|
-
git = Nanoc::Git::Deployer.new(
|
37
|
-
'output/',
|
38
|
-
{})
|
39
|
-
|
40
|
-
# Try running
|
41
|
-
error = assert_raises(RuntimeError) do
|
42
|
-
git.run
|
43
|
-
end
|
44
|
-
|
45
|
-
# Check error message
|
46
|
-
assert_equal 'output/ does not exist. Please build your site first.', error.message
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_run_with_defaults_options
|
50
|
-
# Create deployer
|
51
|
-
git = Nanoc::Git::Deployer.new(
|
52
|
-
'output/',
|
53
|
-
{})
|
54
|
-
|
55
|
-
# Mock run_shell_cmd
|
56
|
-
def git.run_shell_cmd(args, opts = {})
|
57
|
-
@shell_cmd_args = [] unless defined? @shell_cmd_args
|
58
|
-
@shell_cmd_args << args.join(' ')
|
59
|
-
end
|
60
|
-
|
61
|
-
# Mock clean_repo?
|
62
|
-
def git.clean_repo?
|
63
|
-
false
|
64
|
-
end
|
65
|
-
|
66
|
-
# Create site
|
67
|
-
FileUtils.mkdir_p('output')
|
68
|
-
|
69
|
-
# Try running
|
70
|
-
git.run
|
71
|
-
|
72
|
-
commands = <<-EOS
|
73
|
-
git init
|
74
|
-
git config --get remote.origin.url
|
75
|
-
git checkout master
|
76
|
-
git add -A
|
77
|
-
git commit -am Automated commit at .+ by nanoc \\d+\\.\\d+\\.\\d+\\w*
|
78
|
-
git push origin master
|
79
|
-
EOS
|
80
|
-
|
81
|
-
assert_match Regexp.new(/^#{commands.chomp}$/), git.instance_eval { @shell_cmd_args.join("\n") }
|
82
|
-
end
|
83
|
-
|
84
|
-
def test_run_with_clean_repository
|
85
|
-
# Create deployer
|
86
|
-
git = Nanoc::Git::Deployer.new(
|
87
|
-
'output/',
|
88
|
-
{})
|
89
|
-
|
90
|
-
# Mock run_shell_cmd
|
91
|
-
def git.run_shell_cmd(args, opts = {})
|
92
|
-
@shell_cmd_args = [] unless defined? @shell_cmd_args
|
93
|
-
@shell_cmd_args << args.join(' ')
|
94
|
-
end
|
95
|
-
|
96
|
-
# Mock clean_repo?
|
97
|
-
def git.clean_repo?
|
98
|
-
true
|
99
|
-
end
|
100
|
-
|
101
|
-
# Create site
|
102
|
-
FileUtils.mkdir_p('output')
|
103
|
-
|
104
|
-
# Try running
|
105
|
-
git.run
|
106
|
-
|
107
|
-
commands = <<-EOS
|
108
|
-
git init
|
109
|
-
git config --get remote.origin.url
|
110
|
-
git checkout master
|
111
|
-
git push origin master
|
112
|
-
EOS
|
113
|
-
|
114
|
-
assert_match Regexp.new(/^#{commands.chomp}$/), git.instance_eval { @shell_cmd_args.join("\n") }
|
115
|
-
end
|
116
|
-
|
117
|
-
def test_run_with_custom_options
|
118
|
-
# Create deployer
|
119
|
-
git = Nanoc::Git::Deployer.new(
|
120
|
-
'output/',
|
121
|
-
{ :remote => 'github', :branch => 'gh-pages', :forced => true })
|
122
|
-
|
123
|
-
# Mock run_shell_cmd
|
124
|
-
def git.run_shell_cmd(args, opts = {})
|
125
|
-
@shell_cmd_args = [] unless defined? @shell_cmd_args
|
126
|
-
@shell_cmd_args << args.join(' ')
|
127
|
-
end
|
128
|
-
|
129
|
-
# Mock clean_repo?
|
130
|
-
def git.clean_repo?
|
131
|
-
false
|
132
|
-
end
|
133
|
-
|
134
|
-
# Create site
|
135
|
-
FileUtils.mkdir_p('output')
|
136
|
-
|
137
|
-
# Try running
|
138
|
-
git.run
|
139
|
-
|
140
|
-
commands = <<-EOS
|
141
|
-
git init
|
142
|
-
git config --get remote.github.url
|
143
|
-
git checkout gh-pages
|
144
|
-
git add -A
|
145
|
-
git commit -am Automated commit at .+ by nanoc \\d+\\.\\d+\\.\\d+\\w*
|
146
|
-
git push -f github gh-pages
|
147
|
-
EOS
|
148
|
-
|
149
|
-
assert_match Regexp.new(/^#{commands.chomp}$/), git.instance_eval { @shell_cmd_args.join("\n") }
|
150
|
-
end
|
151
|
-
|
152
|
-
def test_run_without_git_init
|
153
|
-
# Create deployer
|
154
|
-
git = Nanoc::Git::Deployer.new(
|
155
|
-
'output/',
|
156
|
-
{})
|
157
|
-
|
158
|
-
# Mock run_shell_cmd
|
159
|
-
def git.run_shell_cmd(args, opts = {})
|
160
|
-
@shell_cmd_args = [] unless defined? @shell_cmd_args
|
161
|
-
@shell_cmd_args << args.join(' ')
|
162
|
-
end
|
163
|
-
|
164
|
-
# Mock clean_repo?
|
165
|
-
def git.clean_repo?
|
166
|
-
false
|
167
|
-
end
|
168
|
-
|
169
|
-
# Create site
|
170
|
-
FileUtils.mkdir_p('output/.git')
|
171
|
-
|
172
|
-
# Try running
|
173
|
-
git.run
|
174
|
-
|
175
|
-
commands = <<-EOS
|
176
|
-
git config --get remote.origin.url
|
177
|
-
git checkout master
|
178
|
-
git add -A
|
179
|
-
git commit -am Automated commit at .+ by nanoc \\d+\\.\\d+\\.\\d+\\w*
|
180
|
-
git push origin master
|
181
|
-
EOS
|
182
|
-
|
183
|
-
assert_match Regexp.new(/^#{commands.chomp}$/), git.instance_eval { @shell_cmd_args.join("\n") }
|
184
|
-
end
|
185
|
-
|
186
|
-
def test_run_with_ssh_url
|
187
|
-
# Create deployer
|
188
|
-
git = Nanoc::Git::Deployer.new(
|
189
|
-
'output/',
|
190
|
-
{ :remote => 'git@github.com:myself/myproject.git' })
|
191
|
-
|
192
|
-
# Mock run_shell_cmd
|
193
|
-
def git.run_shell_cmd(args, opts = {})
|
194
|
-
@shell_cmd_args = [] unless defined? @shell_cmd_args
|
195
|
-
@shell_cmd_args << args.join(' ')
|
196
|
-
end
|
197
|
-
|
198
|
-
# Mock clean_repo?
|
199
|
-
def git.clean_repo?
|
200
|
-
false
|
201
|
-
end
|
202
|
-
|
203
|
-
# Create site
|
204
|
-
FileUtils.mkdir_p('output')
|
205
|
-
|
206
|
-
# Try running
|
207
|
-
git.run
|
208
|
-
|
209
|
-
commands = <<-EOS
|
210
|
-
git init
|
211
|
-
git checkout master
|
212
|
-
git add -A
|
213
|
-
git commit -am Automated commit at .+ by nanoc \\d+\\.\\d+\\.\\d+\\w*
|
214
|
-
git push git@github.com:myself/myproject.git master
|
215
|
-
EOS
|
216
|
-
|
217
|
-
assert_match Regexp.new(/^#{commands.chomp}$/), git.instance_eval { @shell_cmd_args.join("\n") }
|
218
|
-
end
|
219
|
-
|
220
|
-
def test_run_with_http_url
|
221
|
-
# Create deployer
|
222
|
-
git = Nanoc::Git::Deployer.new(
|
223
|
-
'output/',
|
224
|
-
{ :remote => 'https://github.com/nanoc/nanoc.git' })
|
225
|
-
|
226
|
-
# Mock run_shell_cmd
|
227
|
-
def git.run_shell_cmd(args, opts = {})
|
228
|
-
@shell_cmd_args = [] unless defined? @shell_cmd_args
|
229
|
-
@shell_cmd_args << args.join(' ')
|
230
|
-
end
|
231
|
-
|
232
|
-
# Mock clean_repo?
|
233
|
-
def git.clean_repo?
|
234
|
-
false
|
235
|
-
end
|
236
|
-
|
237
|
-
# Create site
|
238
|
-
FileUtils.mkdir_p('output')
|
239
|
-
|
240
|
-
# Try running
|
241
|
-
git.run
|
242
|
-
|
243
|
-
commands = <<-EOS
|
244
|
-
git init
|
245
|
-
git checkout master
|
246
|
-
git add -A
|
247
|
-
git commit -am Automated commit at .+ by nanoc \\d+\\.\\d+\\.\\d+\\w*
|
248
|
-
git push https://github.com/nanoc/nanoc.git master
|
249
|
-
EOS
|
250
|
-
|
251
|
-
assert_match Regexp.new(/^#{commands.chomp}$/), git.instance_eval { @shell_cmd_args.join("\n") }
|
252
|
-
end
|
253
|
-
|
254
|
-
def test_clean_repo_on_a_clean_repo
|
255
|
-
# Create deployer
|
256
|
-
git = Nanoc::Git::Deployer.new(
|
257
|
-
'output/',
|
258
|
-
{ :remote => 'https://github.com/nanoc/nanoc.git' })
|
259
|
-
|
260
|
-
FileUtils.mkdir_p('output')
|
261
|
-
|
262
|
-
piper = Nanoc::Extra::Piper.new(:stdout => $stdout, :stderr => $stderr)
|
263
|
-
|
264
|
-
Dir.chdir('output') do
|
265
|
-
piper.run('git init', nil)
|
266
|
-
assert git.send(:clean_repo?)
|
267
|
-
end
|
268
|
-
end
|
269
|
-
|
270
|
-
def test_clean_repo_on_a_dirty_repo
|
271
|
-
# Create deployer
|
272
|
-
git = Nanoc::Git::Deployer.new(
|
273
|
-
'output/',
|
274
|
-
{ :remote => 'https://github.com/nanoc/nanoc.git' })
|
275
|
-
|
276
|
-
FileUtils.mkdir_p('output')
|
277
|
-
|
278
|
-
piper = Nanoc::Extra::Piper.new(:stdout => $stdout, :stderr => $stderr)
|
279
|
-
Dir.chdir('output') do
|
280
|
-
piper.run('git init', nil)
|
281
|
-
FileUtils.touch('foobar')
|
282
|
-
refute git.send(:clean_repo?)
|
283
|
-
end
|
284
|
-
end
|
285
|
-
|
286
|
-
def test_clean_repo_not_git_repo
|
287
|
-
# Create deployer
|
288
|
-
git = Nanoc::Git::Deployer.new(
|
289
|
-
'output/',
|
290
|
-
{ :remote => 'https://github.com/nanoc/nanoc.git' })
|
291
|
-
|
292
|
-
FileUtils.mkdir_p('output')
|
293
|
-
|
294
|
-
Dir.chdir('output') do
|
295
|
-
assert_raises Nanoc::Extra::Piper::Error do
|
296
|
-
git.send(:clean_repo?)
|
297
|
-
end
|
298
|
-
end
|
299
|
-
end
|
300
|
-
end
|