-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pages target dir #1170
Open
adrianbroher
wants to merge
3
commits into
travis-ci:master
Choose a base branch
from
adrianbroher:pages-target-dir
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+20
−7
Open
Pages target dir #1170
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ class Git < Pages | |
opt '--allow_empty_commit', 'Allow an empty commit to be created', requires: :keep_history | ||
opt '--verbose', 'Be verbose about the deploy process' | ||
opt '--local_dir DIR', 'Directory to push to GitHub Pages', default: '.' | ||
opt '--target_dir DIR', 'Target directory within repository', default: '.' | ||
opt '--fqdn FQDN', 'Write the given domain name to the CNAME file' | ||
opt '--project_name NAME', 'Used in the commit message only (defaults to fqdn or the current repo slug)' | ||
opt '--name NAME', 'Committer name', note: 'defaults to the current git commit author name' | ||
|
@@ -46,10 +47,11 @@ class Git < Pages | |
work_dir: 'Using temporary work directory %{work_dir}', | ||
committer_from_gh: 'The repo is configured to use committer user and email.', | ||
setup_dir: 'The source dir for deployment is %s', | ||
target_dir: 'The target dir for deployment is %s', | ||
git_clone: 'Cloning the branch %{target_branch} from the remote repo', | ||
git_init: 'Initializing local git repo', | ||
git_checkout: 'Checking out orphan branch %{target_branch}', | ||
copy_files: 'Copying %{src_dir} contents to %{work_dir}', | ||
copy_files: 'Copying %{src_dir} contents to %{dst_dir}', | ||
git_config: 'Configuring git committer to be %{name} <%{email}>', | ||
prepare: 'Preparing to deploy %{target_branch} branch to gh-pages', | ||
git_push: 'Pushing to %{url}', | ||
|
@@ -59,7 +61,7 @@ class Git < Pages | |
git_init: 'git init .', | ||
git_checkout: 'git checkout --orphan "%{target_branch}"', | ||
check_deploy_key: 'ssh -i %{key} -T [email protected] 2>&1 | grep successful > /dev/null', | ||
copy_files: 'rsync -rl --exclude .git --delete "%{src_dir}/" .', | ||
copy_files: 'rsync -rl --exclude .git --delete "%{src_dir}/" "%{dst_dir}"', | ||
git_config_email: 'git config user.email %{quoted_email}', | ||
git_config_name: 'git config user.name %{quoted_name}', | ||
deployment_file: 'touch "deployed at %{now} by %{name}"', | ||
|
@@ -82,6 +84,7 @@ def login | |
|
||
def setup | ||
info :setup_dir, src_dir | ||
info :target_dir, dst_dir | ||
info :committer_from_gh if committer_from_gh? | ||
info :git_config | ||
end | ||
|
@@ -231,6 +234,10 @@ def src_dir | |
@src_dir ||= expand(local_dir) | ||
end | ||
|
||
def dst_dir | ||
@dst_dir ||= target_dir | ||
end | ||
|
||
def work_dir | ||
@work_dir ||= tmp_dir | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
it { should have_run '[info] Deploying branch gh-pages to github.com/travis-ci/dpl.git' } | ||
it { should have_run '[info] Cloning the branch gh-pages from the remote repo' } | ||
it { should have_run 'git clone --quiet --branch="gh-pages" --depth=1 "https://[email protected]/travis-ci/dpl.git" . > /dev/null 2>&1' } | ||
it { should have_run %(rsync -rl --exclude .git --delete "#{cwd}/" .) } | ||
it { should have_run %(rsync -rl --exclude .git --delete "#{cwd}/" ".") } | ||
it { should have_run 'git config user.name "author name (via Travis CI)"' } | ||
it { should have_run 'git config user.email "author email"' } | ||
it { should have_run 'git add -A .' } | ||
|
@@ -36,7 +36,7 @@ | |
it { should have_run '[info] Deploying branch gh-pages to github.com/travis-ci/dpl.git' } | ||
it { should have_run '[info] Using temporary work directory tmp' } | ||
it { should have_run "[info] Cloning the branch gh-pages from the remote repo" } | ||
it { should have_run "[info] Copying #{cwd} contents to tmp" } | ||
it { should have_run "[info] Copying #{cwd} contents to ." } | ||
it { should have_run '[info] Configuring git committer to be author name (via Travis CI) <author email>' } | ||
it { should have_run '[info] Preparing to deploy gh-pages branch to gh-pages' } | ||
it { should have_run '[info] Pushing to github.com/travis-ci/dpl.git' } | ||
|
@@ -57,7 +57,7 @@ | |
it { should have_run '[info] Initializing local git repo' } | ||
it { should have_run 'git init .' } | ||
it { should have_run 'git checkout --orphan "gh-pages"' } | ||
it { should have_run %(rsync -rl --exclude .git --delete "#{cwd}/" .) } | ||
it { should have_run %(rsync -rl --exclude .git --delete "#{cwd}/" ".") } | ||
it { should have_run 'git add -A .' } | ||
it { should have_run 'git commit -q -m "Deploy travis-ci/dpl to github.com/travis-ci/dpl.git:gh-pages"' } | ||
it { should have_run 'git show --stat-count=10 HEAD' } | ||
|
@@ -74,9 +74,15 @@ | |
end | ||
|
||
describe 'given --local_dir ./dir --verbose' do | ||
it { should have_run "rsync -rl --exclude .git --delete \"#{cwd}/dir/\" ." } | ||
it { should have_run "rsync -rl --exclude .git --delete \"#{cwd}/dir/\" \".\"" } | ||
it { should have_run "[info] The source dir for deployment is #{cwd}/dir" } | ||
it { should have_run "[info] Copying #{cwd}/dir contents to tmp" } | ||
it { should have_run "[info] Copying #{cwd}/dir contents to ." } | ||
end | ||
|
||
describe 'given --target_dir ./dir --verbose' do | ||
it { should have_run "rsync -rl --exclude .git --delete \"#{cwd}/\" \"./dir\"" } | ||
it { should have_run "[info] The target dir for deployment is ./dir" } | ||
it { should have_run "[info] Copying #{cwd} contents to ./dir" } | ||
end | ||
|
||
describe 'given --fqdn fqdn.com' do | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this can just be
target_dir
, in which case we wouldn't need the extra methoddst_dir
below.