octopress-deploy 1.0.0.rc.8 → 1.0.0.rc.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -2
- data/README.md +28 -0
- data/assets/docs/changelog.markdown +7 -2
- data/assets/docs/index.markdown +28 -0
- data/lib/octopress-deploy/git.rb +11 -6
- data/lib/octopress-deploy/rsync.rb +1 -1
- data/lib/octopress-deploy/s3.rb +50 -5
- data/lib/octopress-deploy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ef41485f860af0564de3ea78c84c486da797d39
|
4
|
+
data.tar.gz: 588bc538b038234a285f95aaff34f7b38631d5be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe6a2c50c206d7c38d7ed6249701a2751fcc1efa46311ba1108170000e69b401998f23b515e0d5f9e3410066079033af062eed5f580d9528a95efa4f17ded850
|
7
|
+
data.tar.gz: fdd2b7dc8bf51523c018bd0062497993873ef64fc771832eac33df6b560fb8bc8751e9cc80d313a72c2b6ac24c65e319cbc43dab5a2372735a1276c753bd574a
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
## Current version
|
5
|
+
### 1.0.0 RC9 - 2014-05-31
|
6
|
+
|
7
|
+
- New: S3 header configuration options. [#25](https://github.com/octopress/deploy/issues/25')
|
8
|
+
- Fix: `site_dir` defaults to `'_site'`. [#29](https://github.com/octopress/deploy/issues/29')
|
9
|
+
- Fix: A Windows OS issue. [#30](https://github.com/octopress/deploy/pull/30).
|
10
|
+
|
11
|
+
## Past versions
|
5
12
|
|
6
13
|
### 1.0.0 RC8 - 2014-05-08
|
7
14
|
|
@@ -16,8 +23,6 @@
|
|
16
23
|
|
17
24
|
- Fixed: CLI options now override config file settings.
|
18
25
|
|
19
|
-
## Past versions
|
20
|
-
|
21
26
|
### 1.0.0 RC5 - 2014-04-01
|
22
27
|
|
23
28
|
- Fixed: `site_dir` config didn't work.
|
data/README.md
CHANGED
@@ -77,12 +77,40 @@ account access information.
|
|
77
77
|
| `verbose` | [optional] Display all file actions during deploy. | true |
|
78
78
|
| `region` | [optional] Region for your AWS bucket | us-east-1 |
|
79
79
|
| `delete` | Delete files in `remote_path` not found in `site_dir` | false |
|
80
|
+
| `headers` | Set headers for matched files | [] |
|
80
81
|
|
81
82
|
If you choose a bucket which doesn't yet exist, Octopress Deploy will offer to create it for you, and offer to configure it as a static website.
|
82
83
|
|
83
84
|
If you configure Octopress to delete files, all files found in the `remote_path` on S3 bucket will be removed unless they match local site files.
|
84
85
|
If `remote_path` is a subdirectory, only files in that subdirectory will be evaluated for deletion.
|
85
86
|
|
87
|
+
|
88
|
+
### S3 Headers
|
89
|
+
|
90
|
+
You can create an array of header congifs to set expiration, content and cache settings for any paths matching the `filename`.
|
91
|
+
|
92
|
+
| Header Config | Description | Default
|
93
|
+
|:--------------------|:------------------------------------------------------|:-------------|
|
94
|
+
| `filename` | A regex or a substring of the file to match | |
|
95
|
+
| `site_dir` | An http date or a number of years or days from now | |
|
96
|
+
| `content_type` | A string which is passed through to the headers | |
|
97
|
+
| `content_encoding` | A string which is passed through to the headers | |
|
98
|
+
| `cache_control` | A string which is passed through to the headers | |
|
99
|
+
|
100
|
+
Here is how you might set expriation and cache controls for CSS and Javascript files.
|
101
|
+
|
102
|
+
```yaml
|
103
|
+
headers:
|
104
|
+
- filename: '^assets.*\.js$'
|
105
|
+
expires: '+3 years'
|
106
|
+
cache_control: 'max-age=94608000'
|
107
|
+
content_type: 'application/javascript'
|
108
|
+
- filename: '^assets.*\.css$'
|
109
|
+
expires: '+3 years'
|
110
|
+
cache_control: 'max-age=94608000'
|
111
|
+
content_type: 'text/css'
|
112
|
+
```
|
113
|
+
|
86
114
|
### AWS config via ENV
|
87
115
|
|
88
116
|
If you prefer, you can store AWS access credentials in environment variables instead of a conifiguration file.
|
@@ -5,6 +5,13 @@ permalink: /changelog/
|
|
5
5
|
|
6
6
|
|
7
7
|
## Current version
|
8
|
+
### 1.0.0 RC9 - 2014-05-31
|
9
|
+
|
10
|
+
- New: S3 header configuration options. [#25](https://github.com/octopress/deploy/issues/25')
|
11
|
+
- Fix: `site_dir` defaults to `'_site'`. [#29](https://github.com/octopress/deploy/issues/29')
|
12
|
+
- Fix: A Windows OS issue. [#30](https://github.com/octopress/deploy/pull/30).
|
13
|
+
|
14
|
+
## Past versions
|
8
15
|
|
9
16
|
### 1.0.0 RC8 - 2014-05-08
|
10
17
|
|
@@ -19,8 +26,6 @@ permalink: /changelog/
|
|
19
26
|
|
20
27
|
- Fixed: CLI options now override config file settings.
|
21
28
|
|
22
|
-
## Past versions
|
23
|
-
|
24
29
|
### 1.0.0 RC5 - 2014-04-01
|
25
30
|
|
26
31
|
- Fixed: `site_dir` config didn't work.
|
data/assets/docs/index.markdown
CHANGED
@@ -79,12 +79,40 @@ account access information.
|
|
79
79
|
| `verbose` | [optional] Display all file actions during deploy. | true |
|
80
80
|
| `region` | [optional] Region for your AWS bucket | us-east-1 |
|
81
81
|
| `delete` | Delete files in `remote_path` not found in `site_dir` | false |
|
82
|
+
| `headers` | Set headers for matched files | [] |
|
82
83
|
|
83
84
|
If you choose a bucket which doesn't yet exist, Octopress Deploy will offer to create it for you, and offer to configure it as a static website.
|
84
85
|
|
85
86
|
If you configure Octopress to delete files, all files found in the `remote_path` on S3 bucket will be removed unless they match local site files.
|
86
87
|
If `remote_path` is a subdirectory, only files in that subdirectory will be evaluated for deletion.
|
87
88
|
|
89
|
+
|
90
|
+
### S3 Headers
|
91
|
+
|
92
|
+
You can create an array of header congifs to set expiration, content and cache settings for any paths matching the `filename`.
|
93
|
+
|
94
|
+
| Header Config | Description | Default
|
95
|
+
|:--------------------|:------------------------------------------------------|:-------------|
|
96
|
+
| `filename` | A regex or a substring of the file to match | |
|
97
|
+
| `site_dir` | An http date or a number of years or days from now | |
|
98
|
+
| `content_type` | A string which is passed through to the headers | |
|
99
|
+
| `content_encoding` | A string which is passed through to the headers | |
|
100
|
+
| `cache_control` | A string which is passed through to the headers | |
|
101
|
+
|
102
|
+
Here is how you might set expriation and cache controls for CSS and Javascript files.
|
103
|
+
|
104
|
+
```yaml
|
105
|
+
headers:
|
106
|
+
- filename: '^assets.*\.js$'
|
107
|
+
expires: '+3 years'
|
108
|
+
cache_control: 'max-age=94608000'
|
109
|
+
content_type: 'application/javascript'
|
110
|
+
- filename: '^assets.*\.css$'
|
111
|
+
expires: '+3 years'
|
112
|
+
cache_control: 'max-age=94608000'
|
113
|
+
content_type: 'text/css'
|
114
|
+
```
|
115
|
+
|
88
116
|
### AWS config via ENV
|
89
117
|
|
90
118
|
If you prefer, you can store AWS access credentials in environment variables instead of a conifiguration file.
|
data/lib/octopress-deploy/git.rb
CHANGED
@@ -9,7 +9,7 @@ module Octopress
|
|
9
9
|
@remote = @options[:remote] || 'deploy'
|
10
10
|
@remote_path = @options[:remote_path] || ''
|
11
11
|
@remote_path = @remote_path.sub(/^\//,'') #remove leading slash
|
12
|
-
@site_dir = File.expand_path(@options[:site_dir]
|
12
|
+
@site_dir = File.expand_path(@options[:site_dir] || '_site')
|
13
13
|
@deploy_dir = File.expand_path(@options[:deploy_dir] || '.deploy')
|
14
14
|
@pull_dir = @options[:dir]
|
15
15
|
abort "Deploy Failed: Configure a git_url in #{@options[:config_file]} before deploying.".red if @repo.nil?
|
@@ -19,7 +19,7 @@ module Octopress
|
|
19
19
|
#
|
20
20
|
def push
|
21
21
|
init_repo
|
22
|
-
puts "Syncing #{@site_dir.sub(
|
22
|
+
puts "Syncing #{@site_dir.sub(Dir.pwd.strip+'/', '')} files to #{@repo}."
|
23
23
|
FileUtils.cd @deploy_dir do
|
24
24
|
git_pull
|
25
25
|
clean_deploy
|
@@ -67,7 +67,8 @@ CONFIG
|
|
67
67
|
|
68
68
|
# initialize the repository and add the remote.
|
69
69
|
#
|
70
|
-
`git init
|
70
|
+
`git init`
|
71
|
+
`git remote add #{@remote} #{@repo}`
|
71
72
|
|
72
73
|
# Attempt to pull from the remote.
|
73
74
|
#
|
@@ -77,9 +78,12 @@ CONFIG
|
|
77
78
|
# If no branch exists on remote, create one locally.
|
78
79
|
else
|
79
80
|
`echo "initialize deploy repo" > _`
|
80
|
-
`git add
|
81
|
+
`git add .`
|
82
|
+
`git commit -m \"initial commit\"`
|
81
83
|
`git branch -m #{@branch}`
|
82
|
-
`git rm _
|
84
|
+
`git rm _`
|
85
|
+
`git add -u`
|
86
|
+
`git commit -m 'cleanup'`
|
83
87
|
end
|
84
88
|
end
|
85
89
|
end
|
@@ -110,7 +114,8 @@ CONFIG
|
|
110
114
|
target_dir = File.join(@deploy_dir, @remote_path).sub(/\/$/,'')
|
111
115
|
FileUtils.cp_r @site_dir + '/.', target_dir
|
112
116
|
message = "Site updated at: #{Time.now.utc}"
|
113
|
-
`git add --all
|
117
|
+
`git add --all :/`
|
118
|
+
`git commit -m \"#{message}\"`
|
114
119
|
end
|
115
120
|
end
|
116
121
|
end
|
@@ -7,7 +7,7 @@ module Octopress
|
|
7
7
|
@flags = @options[:flags] || ' -avz'
|
8
8
|
@user = @options[:user]
|
9
9
|
@port = @options[:port]
|
10
|
-
@local = @options[:site_dir]
|
10
|
+
@local = @options[:site_dir] || '_site'
|
11
11
|
@remote_path = @options[:remote_path]
|
12
12
|
@exclude = @options[:exclude]
|
13
13
|
@exclude_file = @options[:exclude_file]
|
data/lib/octopress-deploy/s3.rb
CHANGED
@@ -12,7 +12,7 @@ module Octopress
|
|
12
12
|
abort "Deploying to S3 requires aws-sdk. Install with `gem install aws-sdk`."
|
13
13
|
end
|
14
14
|
@options = options
|
15
|
-
@local = options[:site_dir]
|
15
|
+
@local = options[:site_dir] || '_site'
|
16
16
|
@bucket_name = options[:bucket_name]
|
17
17
|
@access_key = options[:access_key_id] || ENV['AWS_ACCESS_KEY_ID']
|
18
18
|
@secret_key = options[:secret_access_key] || ENV['AWS_SECRET_ACCESS_KEY']
|
@@ -20,6 +20,7 @@ module Octopress
|
|
20
20
|
@remote_path = (options[:remote_path] || '/').sub(/^\//,'')
|
21
21
|
@verbose = options[:verbose] || true
|
22
22
|
@delete = options[:delete]
|
23
|
+
@headers = options[:headers] || []
|
23
24
|
@remote_path = @remote_path.sub(/^\//,'') # remove leading slash
|
24
25
|
@pull_dir = options[:dir]
|
25
26
|
connect
|
@@ -65,9 +66,12 @@ module Octopress
|
|
65
66
|
#
|
66
67
|
def write_files
|
67
68
|
puts "Writing #{pluralize('file', site_files.size)}:" if @verbose
|
68
|
-
site_files.each do |file|
|
69
|
-
|
70
|
-
o.
|
69
|
+
site_files.each do |file|
|
70
|
+
s3_filename = remote_path(file)
|
71
|
+
o = @bucket.objects[s3_filename]
|
72
|
+
file_with_options = get_file_with_metadata(file, s3_filename);
|
73
|
+
|
74
|
+
o.write(file_with_options)
|
71
75
|
if @verbose
|
72
76
|
puts "+ #{remote_path(file)}"
|
73
77
|
else
|
@@ -76,6 +80,48 @@ module Octopress
|
|
76
80
|
end
|
77
81
|
end
|
78
82
|
|
83
|
+
def get_file_with_metadata(file, s3_filename)
|
84
|
+
file_with_options = {:file => file }
|
85
|
+
|
86
|
+
@headers.each do |conf|
|
87
|
+
if conf.has_key? 'filename' and s3_filename.match(conf['filename'])
|
88
|
+
if @verbose
|
89
|
+
puts "+ #{remote_path(file)} matched pattern #{conf['filename']}"
|
90
|
+
end
|
91
|
+
|
92
|
+
if conf.has_key? 'expires'
|
93
|
+
expireDate = conf['expires']
|
94
|
+
|
95
|
+
relative_years = /^\+(\d+) year(s)?$/.match(conf['expires'])
|
96
|
+
if relative_years
|
97
|
+
expireDate = (Time.now + (60 * 60 * 24 * 365 * relative_years[1].to_i)).httpdate
|
98
|
+
end
|
99
|
+
|
100
|
+
relative_days = /^\+(\d+) day(s)?$/.match(conf['expires'])
|
101
|
+
if relative_days
|
102
|
+
expireDate = (Time.now + (60 * 60 * 24 * relative_days[1].to_i)).httpdate
|
103
|
+
end
|
104
|
+
|
105
|
+
file_with_options[:expires] = expireDate
|
106
|
+
end
|
107
|
+
|
108
|
+
if conf.has_key? 'content_type'
|
109
|
+
file_with_options[:content_type] = conf['content_type']
|
110
|
+
end
|
111
|
+
|
112
|
+
if conf.has_key? 'cache_control'
|
113
|
+
file_with_options[:cache_control] = conf['cache_control']
|
114
|
+
end
|
115
|
+
|
116
|
+
if conf.has_key? 'content_encoding'
|
117
|
+
file_with_options[:content_encoding] = conf['content_encoding']
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
return file_with_options
|
123
|
+
end
|
124
|
+
|
79
125
|
# Delete files from the bucket, to ensure a 1:1 match with site files
|
80
126
|
#
|
81
127
|
def delete_files
|
@@ -183,4 +229,3 @@ CONFIG
|
|
183
229
|
end
|
184
230
|
end
|
185
231
|
end
|
186
|
-
|
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.0.0.rc.
|
4
|
+
version: 1.0.0.rc.9
|
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-05-
|
11
|
+
date: 2014-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octopress
|