middleman-rackspace 0.1.0 → 0.2.0
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +26 -17
- data/lib/middleman-rackspace/cli.rb +9 -6
- data/lib/middleman-rackspace/deploy.rb +13 -5
- data/lib/middleman-rackspace/extension.rb +2 -1
- data/lib/middleman-rackspace/pkg-info.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: 9d2b3ba6bea685835c35fd38eb6abe198e0d9e96
|
4
|
+
data.tar.gz: 603e40a365c56cd9ea78fdca7dcf2667ba1c4322
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ae9639c5361faac4caa49dd7fd7d701cf9aada4cbf62907f5c618f19788c2910a75f3595b1ccbf0b08b7714c570920918168f4a18c0deecc830fa02a1b6c222
|
7
|
+
data.tar.gz: 1f7acb829b61b80a0ad3ebb4ebe70a87f521169cc10097690b5f1ed8c6b862a1c1d86b285b6dffa91eb82d2f2d5e40c879282829827e83d4f00d3bd7f3bf2084
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -10,13 +10,19 @@ Add the following to the `Gemfile` for you Middleman project and perform a `bund
|
|
10
10
|
gem 'middleman-rackspace'
|
11
11
|
```
|
12
12
|
|
13
|
-
After configuration, you can deploy to the
|
13
|
+
After configuration, you can deploy to the production container with:
|
14
14
|
|
15
15
|
```
|
16
|
-
$ middleman rackspace
|
16
|
+
$ middleman rackspace production
|
17
17
|
```
|
18
18
|
|
19
|
-
|
19
|
+
To deploy to the staging container, use:
|
20
|
+
|
21
|
+
```
|
22
|
+
$ middleman rackspace staging
|
23
|
+
```
|
24
|
+
|
25
|
+
An archive `build_ENVIRONMENT_TIMESTAMP.tar.gz` is created for your current build and pushed to Rackspace. A new container will automatically be configured on the specified region. If there is an existing container with the same name, **data will be overwritten**.
|
20
26
|
|
21
27
|
# Configuration
|
22
28
|
|
@@ -25,11 +31,12 @@ Activate and configure middleman-rackspace by adding an `activate :rackspace` bl
|
|
25
31
|
```ruby
|
26
32
|
# Example configuration
|
27
33
|
activate :rackspace do |config|
|
28
|
-
config.rackspace_username
|
29
|
-
config.rackspace_api_key
|
30
|
-
config.rackspace_region
|
31
|
-
config.
|
32
|
-
config.
|
34
|
+
config.rackspace_username = 'username'
|
35
|
+
config.rackspace_api_key = 'a99c75008c3f4ccd31ce67a0674db356'
|
36
|
+
config.rackspace_region = :syd
|
37
|
+
config.container_staging = 'example-container-staging'
|
38
|
+
config.container_production = 'example-container'
|
39
|
+
config.build_before = true
|
33
40
|
end
|
34
41
|
```
|
35
42
|
|
@@ -39,18 +46,20 @@ Here is a list of all configuration options available with their default values.
|
|
39
46
|
# Default configuration
|
40
47
|
activate :rackspace do |config|
|
41
48
|
# Rackspace credentials
|
42
|
-
config.rackspace_username
|
43
|
-
config.rackspace_api_key
|
49
|
+
config.rackspace_username = ENV['RACKSPACE_USERNAME']
|
50
|
+
config.rackspace_api_key = ENV['RACKSPACE_API_KEY']
|
44
51
|
# The Rackspace region to deploy to
|
45
|
-
config.rackspace_region
|
46
|
-
# The target container on Rackspace
|
47
|
-
config.
|
52
|
+
config.rackspace_region = :dfw
|
53
|
+
# The target container on Rackspace for staging
|
54
|
+
config.container_staging = nil
|
55
|
+
# The target container on Rackspace for production
|
56
|
+
config.container_production = nil
|
48
57
|
# Root page filename
|
49
|
-
config.index_file
|
58
|
+
config.index_file = 'index.html'
|
50
59
|
# Error page filename prefix, translates to 401.html and 404.html
|
51
|
-
config.error_file_prefix
|
60
|
+
config.error_file_prefix = '.html'
|
52
61
|
# Run `middleman build` before the deploy step
|
53
|
-
config.build_before
|
62
|
+
config.build_before = false
|
54
63
|
end
|
55
64
|
```
|
56
65
|
|
@@ -61,5 +70,5 @@ For a list of available regions see [http://www.rackspace.com/knowledge_center/a
|
|
61
70
|
* On deploy, delete files on the server that have been removed from the build.
|
62
71
|
* Invalidate cache after deploy.
|
63
72
|
* Integrate with git to deploy from a branch.
|
64
|
-
* Improve CLI to deploy from a pre-built `
|
73
|
+
* Improve CLI to deploy from a pre-built `build_ENVIRONMENT_TIMESTAMP.tar.gz`.
|
65
74
|
* Improve error handling.
|
@@ -2,13 +2,15 @@ require 'middleman-core/cli'
|
|
2
2
|
|
3
3
|
module Middleman
|
4
4
|
module Cli
|
5
|
-
class Rackspace < Thor
|
5
|
+
class Rackspace < Thor
|
6
6
|
include Thor::Actions
|
7
7
|
|
8
8
|
check_unknown_options!
|
9
9
|
|
10
10
|
namespace :rackspace
|
11
11
|
|
12
|
+
desc 'rackspace ENVIRONMENT [options]', 'Deploy to Rackspace container for ENVIRONMENT'
|
13
|
+
|
12
14
|
class_option :build_before,
|
13
15
|
aliases: '-b',
|
14
16
|
type: :boolean,
|
@@ -20,7 +22,11 @@ module Middleman
|
|
20
22
|
true
|
21
23
|
end
|
22
24
|
|
23
|
-
def rackspace
|
25
|
+
def rackspace(environment)
|
26
|
+
unless environment == 'staging' || environment == 'production'
|
27
|
+
raise Thor::Error, "Unknown environment '#{environment}'. Use 'staging' or 'production'."
|
28
|
+
end
|
29
|
+
|
24
30
|
# Instantiate Middleman and load config
|
25
31
|
app = Middleman::Application.server.inst
|
26
32
|
|
@@ -31,11 +37,8 @@ module Middleman
|
|
31
37
|
end
|
32
38
|
|
33
39
|
# Deploy the built website
|
34
|
-
Middleman::Rackspace.deploy(app)
|
40
|
+
Middleman::Rackspace.deploy(app, environment)
|
35
41
|
end
|
36
42
|
end
|
37
|
-
|
38
|
-
# Register 'rackspace' as a Middleman CLI extention
|
39
|
-
Base.register(Middleman::Cli::Rackspace, 'rackspace', 'rackspace [options]', Middleman::Rackspace::TAGLINE)
|
40
43
|
end
|
41
44
|
end
|
@@ -5,15 +5,23 @@ module Middleman
|
|
5
5
|
module Rackspace
|
6
6
|
module_function
|
7
7
|
|
8
|
-
def deploy(app)
|
8
|
+
def deploy(app, environment)
|
9
9
|
config = app.extensions[:rackspace].options
|
10
|
-
container_name = config.container_name
|
11
10
|
|
12
|
-
|
13
|
-
|
11
|
+
container_name = case environment
|
12
|
+
when 'staging'
|
13
|
+
config.container_staging
|
14
|
+
when 'production'
|
15
|
+
config.container_production
|
16
|
+
end
|
17
|
+
|
18
|
+
puts "Deploying for #{environment} to '#{container_name}'"
|
19
|
+
|
20
|
+
# build_ENVIRONMENT_TIMESTAMP.tar.gz
|
21
|
+
archive_name = "build_#{environment}_#{Time.now.strftime('%Y-%m-%d_%H-%M-%S')}.tar.gz"
|
14
22
|
puts "Creating archive: #{archive_name}"
|
15
23
|
|
16
|
-
# Compress /build directory into
|
24
|
+
# Compress /build directory into build_ENVIRONMENT_TIMESTAMP.tar.gz
|
17
25
|
system("cd ./build && tar -zcvf ../#{archive_name} .")
|
18
26
|
|
19
27
|
# Configure Fog
|
@@ -6,7 +6,8 @@ module Middleman
|
|
6
6
|
option :rackspace_username, ENV['RACKSPACE_USERNAME'], 'Rackspace username'
|
7
7
|
option :rackspace_api_key, ENV['RACKSPACE_API_KEY'], 'Rackspace API key'
|
8
8
|
option :rackspace_region, :dfw, 'Rackspace region'
|
9
|
-
option :
|
9
|
+
option :container_staging, nil, 'The target container on Rackspace for staging'
|
10
|
+
option :container_production, nil, 'The target container on Rackspace for production'
|
10
11
|
option :index_file, 'index.html', 'Index filename configuration'
|
11
12
|
option :error_file_prefix, '.html', 'Error filename configuration'
|
12
13
|
option :build_before, false, 'Run `middleman build` before the deploy step'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-rackspace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cristofaro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: middleman-core
|