octopress-deploy 1.0.0.rc.5 → 1.0.0.rc.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f09b31e6aa0f3d103e61dc12c6d16104c6beb07f
4
- data.tar.gz: 82554203c1788bf4a3daff348013d4dd457bfc69
3
+ metadata.gz: 4c467df4b3e393b8f56f2416e57d0cdb38fe912f
4
+ data.tar.gz: 318d2b394f037d4c8d22aff61e1eaa9a932e7b57
5
5
  SHA512:
6
- metadata.gz: 58171d42cffb38df63f6626ea6301bea6d2f411dca39541464b3523cde913097ca9ffd63fb9fb8aaeba29d4bcbb7ab01965332cbfd15fe89c578e891f05c854e
7
- data.tar.gz: b63e8b106dd950ee6646fb2f2e9ea3832a3b4c9286cfa49d5b4ee2fa36ba5f6bdc3e8f959d0f6d2479c7a14cb775420a1742897a80b4ef72e58f5d7a58f96f73
6
+ metadata.gz: fdd39fed5216d0aa542719c5831e9954bc0b88c7b8af08476524470970055510472a53753021a36d34badf2ab8fdd79ff03d7ef2a71e670f46f5551e357ad184
7
+ data.tar.gz: ea58b46c376c30140c713eea0e754adcdcc2d1e69976ee99df31af03d7b273a5a3bf1c9e866123c93caa10e08a8368f8229e78381873aed0ef81c7a7a13dee73
data/.gitignore CHANGED
@@ -23,6 +23,7 @@ _git_deploy.yml
23
23
  pull-git
24
24
  pull-rsync
25
25
  pull-s3
26
- _site
26
+ build
27
27
  local-git
28
28
  local-rsync
29
+ .DS_Store
data/CHANGELOG.md CHANGED
@@ -2,13 +2,18 @@
2
2
 
3
3
  ## Current version
4
4
 
5
+ ### 1.0.0 RC6 - 2014-04-17
6
+
7
+ - Fixed: CLI options now override config file settings.
8
+
9
+ ## Past versions
10
+
5
11
  ### 1.0.0 RC5 - 2014-04-01
6
12
 
7
13
  - Fixed: `site_dir` config didn't work.
8
14
 
9
- ## Past versions
10
15
 
11
- ### 1.0.0 RC4 - 2014-03-22
16
+ ### 1.0.0 RC4 - 2014-03-25
12
17
 
13
18
  - Added: Octopress Ink documentation site support
14
19
 
@@ -5,6 +5,21 @@ permalink: /changelog/
5
5
 
6
6
  ## Current version
7
7
 
8
+ ### 1.0.0 RC6 - 2014-04-17
9
+
10
+ - Fixed: CLI options now override config file settings.
11
+
12
+ ## Past versions
13
+
14
+ ### 1.0.0 RC5 - 2014-04-01
15
+
16
+ - Fixed: `site_dir` config didn't work.
17
+
18
+
19
+ ### 1.0.0 RC4 - 2014-03-25
20
+
21
+ - Added: Octopress Ink documentation site support
22
+
8
23
  ### 1.0.0 RC3 - 2014-03-22
9
24
 
10
25
  #### Minor Enhancements
@@ -19,7 +34,6 @@ permalink: /changelog/
19
34
  - No longer stripping forward slashes on remote_path. Issue #18
20
35
  - `pull` command no longer promises a default directory.
21
36
 
22
- ## Past versions
23
37
 
24
38
  ### 1.0.0 RC2 - 2014-03-18
25
39
  - CHANGE: `add_bucket` command becomes `add-bucket`
@@ -43,16 +43,18 @@ module Octopress
43
43
  end
44
44
 
45
45
  def self.default_config(options={})
46
- <<-CONFIG
46
+ config = <<-CONFIG
47
47
  #{"git_url: #{options[:git_url]}".ljust(40)} # remote repository url, e.g. git@github.com:username/repo_name
48
- #{"git_branch: #{options[:git_branch] || 'master'}".ljust(40)} # Git branch where static site files are commited
49
48
 
50
49
  # Note on git_branch:
51
50
  # If using GitHub project pages, set the branch to 'gh-pages'.
52
51
  # For GitHub user/organization pages or Heroku, set the branch to 'master'.
52
+ #
53
+ #{"git_branch: #{options[:git_branch] || 'master'}".ljust(40)} # Git branch where static site files are commited
53
54
 
54
- #{"# remote_path: #{options[:remote_path]}".ljust(40)} # Destination directory
55
55
  CONFIG
56
+ config << "\n# " unless options[:remote_path]
57
+ config << "#{"remote_path: #{options[:remote_path]}".ljust(38)} # Destination directory"
56
58
  end
57
59
 
58
60
  # If necessary create deploy directory and initialize it with deployment remote.
@@ -4,7 +4,7 @@ module Octopress
4
4
 
5
5
  def initialize(options)
6
6
  @options = options
7
- @flags = @options[:flags] || ' -rltDvz'
7
+ @flags = @options[:flags] || ' -avz'
8
8
  @user = @options[:user]
9
9
  @port = @options[:port]
10
10
  @local = @options[:site_dir]
@@ -41,7 +41,7 @@ module Octopress
41
41
  cmd << " --include-from #{@include_file}" if @include_file
42
42
  cmd << " --include #{@include}" if @include
43
43
  cmd << " --rsh='ssh -p#{@port}'" if @user && @port
44
- cmd << " --delete" if @delete
44
+ cmd << " --delete " if @delete
45
45
 
46
46
  local << " #{File.join(@local, '')} "
47
47
  remote << " #{@user}:" if @user
@@ -9,7 +9,7 @@ module Octopress
9
9
  begin
10
10
  require 'aws-sdk'
11
11
  rescue LoadError
12
- abort "Please install the aws-sdk gem first."
12
+ abort "Deploying to S3 requires aws-sdk. Install with `gem install aws-sdk`."
13
13
  end
14
14
  @options = options
15
15
  @local = options[:site_dir]
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module Deploy
3
- VERSION = "1.0.0.rc.5"
3
+ VERSION = "1.0.0.rc.6"
4
4
  end
5
5
  end
@@ -1,5 +1,7 @@
1
1
  $LOAD_PATH.unshift File.expand_path("../", __FILE__)
2
2
  #
3
+ require 'pry-debugger'
4
+
3
5
  require 'colorator'
4
6
  require 'yaml'
5
7
  require 'octopress'
@@ -20,57 +22,61 @@ module Octopress
20
22
  's3' => S3
21
23
  }
22
24
 
25
+ DEFAULT_OPTIONS = {
26
+ :config_file => '_deploy.yml',
27
+ :site_dir => '_site',
28
+ }
29
+
23
30
  def self.push(options={})
24
- init_options(options)
25
- if !File.exists? @options[:config_file]
26
- abort "File not found: #{@options[:config_file]}. Create a deployment config file with `octopress deploy init <METHOD>`."
27
- else
28
- parse_options
29
- deploy_method.new(@options).push()
30
- end
31
+ options = merge_configs(options)
32
+ deployer(options).push
31
33
  end
32
34
 
33
35
  def self.pull(options={})
34
- init_options(options)
35
- if !File.exists? @options[:config_file]
36
- abort "No deployment config found. Create one with: octopress deploy init #{@options[:config_file]}"
37
- else
38
- parse_options
39
- if !File.exists? @options[:dir]
40
- FileUtils.mkdir_p @options[:dir]
41
- end
42
- deploy_method.new(@options).pull()
36
+ options = merge_configs(options)
37
+
38
+ if !File.exists? options[:dir]
39
+ FileUtils.mkdir_p options[:dir]
43
40
  end
41
+
42
+ deployer(options).pull
44
43
  end
45
44
 
46
45
  def self.add_bucket(options={})
47
- init_options(options)
48
- if !File.exists? @options[:config_file]
49
- abort "File not found: #{@options[:config_file]}. Create a deployment config file with `octopress deploy init <METHOD>`."
50
- else
51
- parse_options
52
- deploy_method.new(@options).add_bucket()
53
- end
46
+ options = merge_configs(options)
47
+ get_deployment_method(options).new().add_bucket()
48
+ end
49
+
50
+ def self.merge_configs(options={})
51
+ options = check_config(options)
52
+ config = YAML.load(File.open(options[:config_file])).to_symbol_keys
53
+ options = config.deep_merge(options)
54
54
  end
55
55
 
56
- def self.parse_options
57
- config = YAML.load(File.open(@options[:config_file])).to_symbol_keys
58
- @options = @options.to_symbol_keys
59
- @options = config.deep_merge(@options)
56
+ def self.check_config(options={})
57
+ options = options.to_symbol_keys
58
+ options[:config_file] ||= DEFAULT_OPTIONS[:config_file]
59
+
60
+ if !File.exists? options[:config_file]
61
+ abort "File not found: #{options[:config_file]}. Create a deployment config file with `octopress deploy init <METHOD>`."
62
+ end
63
+
64
+ options
60
65
  end
61
66
 
62
- def self.init_options(options={})
63
- @options = options.to_symbol_keys
64
- @options[:config_file] ||= '_deploy.yml'
65
- @options[:site_dir] ||= site_dir
67
+ def self.deployer(options)
68
+ get_deployment_method(options).new(options)
66
69
  end
67
70
 
68
- def self.deploy_method
69
- METHODS[@options[:method].downcase]
71
+ def self.get_deployment_method(options)
72
+ METHODS[options[:method].downcase]
70
73
  end
71
74
 
75
+
72
76
  def self.site_dir
73
- @options[:site_dir] || if File.exist? '_config.yml'
77
+ if options[:site_dir]
78
+ options[:site_dir]
79
+ elsif File.exist? '_config.yml'
74
80
  YAML.load(File.open('_config.yml'))['site_dir'] || '_site'
75
81
  else
76
82
  '_site'
@@ -86,7 +92,7 @@ module Octopress
86
92
  abort "Please provide a deployment method. e.g. #{METHODS.keys}"
87
93
  end
88
94
 
89
- init_options(options)
95
+ @options = DEFAULT_OPTIONS.deep_merge(options)
90
96
  write_config
91
97
  check_gitignore
92
98
  end
@@ -110,7 +116,7 @@ module Octopress
110
116
  #{"method: #{@options[:method]}".ljust(40)} # How do you want to deploy? git, rsync or s3.
111
117
  #{"site_dir: #{@options[:site_dir]}".ljust(40)} # Location of your your static site files.
112
118
 
113
- #{deploy_method.default_config(@options)}
119
+ #{get_deployment_method(@options).default_config(@options)}
114
120
  FILE
115
121
  end
116
122
 
@@ -1,6 +1,6 @@
1
1
  method: rsync
2
- site_dir: _site
2
+ site_dir: build
3
3
  user: imathis@imathis.com
4
4
  port:
5
5
  remote_path: ~/octopress-deploy/rsync/
6
- delete:
6
+ delete:
@@ -1,6 +1,6 @@
1
1
  method: rsync
2
- site_dir: _site
2
+ site_dir: build
3
3
  user:
4
4
  port:
5
5
  remote_path: local-rsync
6
- delete:
6
+ delete:
data/test/test.rb CHANGED
@@ -6,13 +6,13 @@ require 'find'
6
6
  @failures = {}
7
7
 
8
8
  def setup_tests
9
- `rm -rf _site` # clean up from previous tests
9
+ `rm -rf build` # clean up from previous tests
10
10
  generate_site
11
11
  end
12
12
 
13
13
  def generate_site
14
- system "cp -r source/ _site"
15
- Find.find('_site').to_a.each do |f|
14
+ system "cp -r source/ build"
15
+ Find.find('build').to_a.each do |f|
16
16
  system("echo '#{garbage}' >> #{f}") unless File.directory?(f)
17
17
  end
18
18
  end
@@ -67,10 +67,10 @@ def test_remote_git
67
67
 
68
68
  # Test remote git deployment
69
69
  #
70
- Octopress::Deploy.init_config(method: 'git', config_file: config, force: true, git_branch: 'test_git_deploy', git_url: repo)
70
+ Octopress::Deploy.init_config(method: 'git', config_file: config, force: true, site_dir: 'build', git_branch: 'test_git_deploy', git_url: repo)
71
71
  Octopress::Deploy.push(config_file: config)
72
72
  Octopress::Deploy.pull(dir: 'pull-git', config_file: config)
73
- diff_dir('_site', 'pull-git')
73
+ diff_dir('build', 'pull-git')
74
74
  end
75
75
 
76
76
  def test_local_git
@@ -85,9 +85,10 @@ def test_local_git
85
85
 
86
86
  # Test local git deployment
87
87
  #
88
- Octopress::Deploy.push(config_file: config, git_url: File.expand_path(repo), remote_path: 'site')
88
+ Octopress::Deploy.init_config(method: 'git', config_file: config, force: true, site_dir: 'build', git_branch: 'test_git_deploy', git_url: File.expand_path(repo), remote_path: 'site')
89
+ Octopress::Deploy.push(config_file: config)
89
90
  Octopress::Deploy.pull(dir: 'pull-git', config_file: config, git_url: File.expand_path(repo), remote_path: 'site')
90
- diff_dir('_site', 'pull-git/site')
91
+ diff_dir('build', 'pull-git/site')
91
92
  end
92
93
 
93
94
  def test_remote_rsync
@@ -99,10 +100,10 @@ def test_remote_rsync
99
100
 
100
101
  # Test remote git deployment
101
102
  #
102
- Octopress::Deploy.init_config(method: 'rsync', config_file: config, force: true, user: 'imathis@imathis.com', remote_path: '~/octopress-deploy/rsync/')
103
+ Octopress::Deploy.init_config(method: 'rsync', config_file: config, site_dir: 'build', force: true, user: 'imathis@imathis.com', remote_path: '~/octopress-deploy/rsync/')
103
104
  Octopress::Deploy.push(config_file: config)
104
105
  Octopress::Deploy.pull(dir: 'pull-rsync', config_file: config)
105
- diff_dir('_site', 'pull-rsync')
106
+ diff_dir('build', 'pull-rsync')
106
107
 
107
108
  end
108
109
 
@@ -115,10 +116,10 @@ def test_local_rsync
115
116
 
116
117
  # Test local git deployment
117
118
  #
118
- Octopress::Deploy.init_config(method: 'rsync', config_file: config, force: true, remote_path: 'local-rsync')
119
+ Octopress::Deploy.init_config(method: 'rsync', config_file: config, site_dir: 'build', force: true, remote_path: 'local-rsync')
119
120
  Octopress::Deploy.push(config_file: config)
120
121
  Octopress::Deploy.pull(dir: 'pull-rsync', config_file: config, user: false, remote_path: 'local-rsync')
121
- diff_dir('_site', 'pull-rsync')
122
+ diff_dir('build', 'pull-rsync')
122
123
  end
123
124
 
124
125
  def test_s3
@@ -127,7 +128,7 @@ def test_s3
127
128
  `rm -rf pull-s3`
128
129
  Octopress::Deploy.push(config_file: config)
129
130
  Octopress::Deploy.pull(dir: 'pull-s3', config_file: config)
130
- diff_dir('_site', 'pull-s3')
131
+ diff_dir('build', 'pull-s3')
131
132
  end
132
133
 
133
134
  def print_test_results
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopress-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc.5
4
+ version: 1.0.0.rc.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-01 00:00:00.000000000 Z
11
+ date: 2014-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octopress
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.0.0.rc.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.0.0.rc.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: colorator
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: octopress-ink
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.3'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: Deploy Octopress and Jekyll sites easily
@@ -87,7 +87,7 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - .gitignore
90
+ - ".gitignore"
91
91
  - CHANGELOG.md
92
92
  - Gemfile
93
93
  - LICENSE.txt
@@ -122,17 +122,17 @@ require_paths:
122
122
  - lib
123
123
  required_ruby_version: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - '>='
125
+ - - ">="
126
126
  - !ruby/object:Gem::Version
127
127
  version: '0'
128
128
  required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - '>'
130
+ - - ">"
131
131
  - !ruby/object:Gem::Version
132
132
  version: 1.3.1
133
133
  requirements: []
134
134
  rubyforge_project:
135
- rubygems_version: 2.1.11
135
+ rubygems_version: 2.2.2
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: Deploy Octopress and Jekyll sites easily