octopress-deploy 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ff0f9e0959198ae73ff8b5de4129ded2bd17f35
4
- data.tar.gz: 4c93019f735109467267faa368d09abff0dce862
3
+ metadata.gz: 5193cab4ce08ed883a01384d2c19594fc38a5864
4
+ data.tar.gz: c024077ddeab7a639be25ed7c7b77bc4df94564e
5
5
  SHA512:
6
- metadata.gz: 61a6e8bcd5edb808d9f9c182f1f52c298b49d9df6272abc5b8f333cc41d665375b8722a258518e30e7387b327229f1fc9ab5cc4c38716bcd913f118eabde8b40
7
- data.tar.gz: bd42c36239eef26e3f11a95066d2e0c6c17aaf3016d46fef7cf91755556109d42de99fd2ad1ec5c51efa07838d0ce26bba9f6bd8268595395c6d9655c494f085
6
+ metadata.gz: c328742b9202f1a5690730b8e3ccc1f7989cb46caf423336416c9aefe85234953019724d70ebca6bc3ea01acbc1388523792c3c2f09ac480002a7904e36080be
7
+ data.tar.gz: 2bed2d3d3bf4c6ea848ed085d7c1abc576e0b2e3637db47ade8dc8556c935b900009edbe226e8ff3b4829707adb968f33c4312ec7b6069c0d9d5818ab01f5022
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ### 1.2.1 - 2015-04-28
4
+ - Fix: On deploy init git, moved git URL from option to argument since it is required.
5
+ - Minor: Now preventing deploy to working branch, complete with helpful error message.
6
+
3
7
  ### 1.2.1 - 2015-04-25
4
8
 
5
9
  - Fix: Rsync exclude and include options now work properly with multiple items.
data/README.md CHANGED
@@ -26,7 +26,7 @@ $ gem install octopress
26
26
  First set up a configuration file for your deployment method.
27
27
 
28
28
  ```
29
- $ octopress deploy init git --url git@github.com:user/project
29
+ $ octopress deploy init git git@github.com:user/project
30
30
  $ octopress deploy init s3
31
31
  $ octopress deploy init rsync
32
32
  ```
@@ -45,9 +45,8 @@ module Octopress
45
45
  end
46
46
 
47
47
  c.command(:git) do |c|
48
- c.syntax 'git [options]'
48
+ c.syntax 'git <URL> [options]'
49
49
  c.description "Create a git deployment configuration file."
50
- c.option 'git_url', '-u', '--url URL', 'Git url (e.g. git@github.com:user/project)'
51
50
  c.option 'git_branch', '-b', '--branch NAME', 'Branch to deploy to (default: master)'
52
51
  c.option 'remote_path', '-d', '--dir DIR', 'Deploy site into a subdirectory.'
53
52
  c.option 'delete', '--delete', 'Sync file deletion'
@@ -55,8 +54,9 @@ module Octopress
55
54
 
56
55
  c.action do |args, options|
57
56
  options['method'] = 'git'
57
+ options['git_url'] = args.first
58
58
  if options['git_url']
59
- options['git_url'].sub!(/^\./, Dir.pwd)
59
+ options['git_url'] = options['git_url'].sub(/^\./, Dir.pwd)
60
60
  else
61
61
  $stderr.puts "git url missing"
62
62
  puts c # print the help
@@ -18,6 +18,7 @@ module Octopress
18
18
  # Initialize, pull, copy and deploy.
19
19
  #
20
20
  def push
21
+ check_branch
21
22
  init_repo
22
23
  puts "Syncing #{@site_dir.sub(Dir.pwd.strip+'/', '')} files to #{@repo}."
23
24
  FileUtils.cd @deploy_dir do
@@ -32,9 +33,29 @@ module Octopress
32
33
  `git clone -b #{@branch} #{@repo} #{@pull_dir}`
33
34
  end
34
35
 
36
+ # Ensure that the deploy branch is not that same as the current working branch
37
+ #
38
+ def check_branch
39
+ same_branch = `git branch -a` =~ /\* #{@branch}/
40
+
41
+ if current_remote = `git remote -v`.match(/\s\S+/)
42
+ same_remote = current_remote[0].match(/#{@repo}/)
43
+ end
44
+
45
+ if same_remote && same_branch
46
+ puts "Deploy to #{@branch} canceled:".red
47
+ puts "You cannot deploy to the same branch you are working in. This will overwrite the source for your site.\n"
48
+ puts "First, back up your site's source to a branch:"
49
+ puts "\n git checkout -b source".yellow
50
+ puts " git push origin source".yellow
51
+ puts "\nWith that, you'll work in the #{"source".bold} branch and deploy to the #{@branch.bold} branch."
52
+ abort
53
+ end
54
+ end
55
+
35
56
  # Check to see if local deployment dir is configured to deploy.
36
57
  #
37
- def check_repo
58
+ def check_deploy_dir
38
59
  if Dir.exist? @deploy_dir
39
60
  FileUtils.cd @deploy_dir do
40
61
  return `git remote -v`.include? @repo
@@ -60,7 +81,7 @@ CONFIG
60
81
  # If necessary create deploy directory and initialize it with deployment remote.
61
82
  #
62
83
  def init_repo
63
- return if check_repo
84
+ return if check_deploy_dir
64
85
  FileUtils.mkdir_p @deploy_dir
65
86
  FileUtils.cd @deploy_dir do
66
87
  if Dir[@deploy_dir+'/*'].empty?
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module Deploy
3
- VERSION = "1.2.1"
3
+ VERSION = "1.2.2"
4
4
  end
5
5
  end
data/test/_clash.yml CHANGED
@@ -27,7 +27,7 @@
27
27
  before:
28
28
  - reset
29
29
  - git init --bare local-git
30
- - octopress deploy init git --branch test_git_deploy --url ./local-git --dir site --config _git_deploy_local.yml --force
30
+ - octopress deploy init git ./local-git --branch test_git_deploy --dir site --config _git_deploy_local.yml --force
31
31
  - octopress deploy --config _git_deploy_local.yml
32
32
  - octopress deploy pull pull-git --config _git_deploy_local.yml
33
33
  - rm -rf pull-git/.git
@@ -37,7 +37,7 @@
37
37
  title: Test remote Git
38
38
  before:
39
39
  - reset
40
- - octopress deploy init git --branch test_git_deploy --url git@github.com:octopress/deploy --config _git_deploy.yml --force
40
+ - octopress deploy init git git@github.com:octopress/deploy --branch test_git_deploy --config _git_deploy.yml --force
41
41
  - octopress deploy --config _git_deploy.yml
42
42
  - octopress deploy pull pull-git --config _git_deploy.yml
43
43
  - rm -rf pull-git/.git
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopress-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-25 00:00:00.000000000 Z
11
+ date: 2015-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorator
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  version: '0'
157
157
  requirements: []
158
158
  rubyforge_project:
159
- rubygems_version: 2.2.2
159
+ rubygems_version: 2.4.6
160
160
  signing_key:
161
161
  specification_version: 4
162
162
  summary: Easily deploy any Jekyll or Octopress site using S3, Git, or Rsync.