middleman-sync 3.0.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.
- data/.gitignore +20 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +69 -0
- data/README.md +86 -0
- data/Rakefile +2 -0
- data/lib/middleman-sync.rb +7 -0
- data/lib/middleman-sync/commands.rb +37 -0
- data/lib/middleman-sync/extension.rb +70 -0
- data/lib/middleman-sync/version.rb +7 -0
- data/lib/middleman_extension.rb +1 -0
- data/middleman-sync.gemspec +24 -0
- metadata +89 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
middleman-sync (3.0.0)
|
5
|
+
asset_sync (~> 0.5.0)
|
6
|
+
middleman-core (>= 3.0.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activemodel (3.2.8)
|
12
|
+
activesupport (= 3.2.8)
|
13
|
+
builder (~> 3.0.0)
|
14
|
+
activesupport (3.2.8)
|
15
|
+
i18n (~> 0.6)
|
16
|
+
multi_json (~> 1.0)
|
17
|
+
asset_sync (0.5.0)
|
18
|
+
activemodel
|
19
|
+
fog
|
20
|
+
builder (3.0.0)
|
21
|
+
excon (0.16.2)
|
22
|
+
ffi (1.1.5)
|
23
|
+
fog (1.5.0)
|
24
|
+
builder
|
25
|
+
excon (~> 0.14)
|
26
|
+
formatador (~> 0.2.0)
|
27
|
+
mime-types
|
28
|
+
multi_json (~> 1.0)
|
29
|
+
net-scp (~> 1.0.4)
|
30
|
+
net-ssh (>= 2.1.3)
|
31
|
+
nokogiri (~> 1.5.0)
|
32
|
+
ruby-hmac
|
33
|
+
formatador (0.2.3)
|
34
|
+
i18n (0.6.0)
|
35
|
+
listen (0.4.7)
|
36
|
+
rb-fchange (~> 0.0.5)
|
37
|
+
rb-fsevent (~> 0.9.1)
|
38
|
+
rb-inotify (~> 0.8.8)
|
39
|
+
middleman-core (3.0.0)
|
40
|
+
activesupport (~> 3.2.6)
|
41
|
+
bundler (~> 1.1)
|
42
|
+
listen (~> 0.4.7)
|
43
|
+
rack (~> 1.4.1)
|
44
|
+
rack-test (~> 0.6.1)
|
45
|
+
thor (~> 0.15.4)
|
46
|
+
tilt (~> 1.3.1)
|
47
|
+
mime-types (1.19)
|
48
|
+
multi_json (1.3.6)
|
49
|
+
net-scp (1.0.4)
|
50
|
+
net-ssh (>= 1.99.1)
|
51
|
+
net-ssh (2.5.2)
|
52
|
+
nokogiri (1.5.5)
|
53
|
+
rack (1.4.1)
|
54
|
+
rack-test (0.6.1)
|
55
|
+
rack (>= 1.0)
|
56
|
+
rb-fchange (0.0.5)
|
57
|
+
ffi
|
58
|
+
rb-fsevent (0.9.1)
|
59
|
+
rb-inotify (0.8.8)
|
60
|
+
ffi (>= 0.5.0)
|
61
|
+
ruby-hmac (0.4.0)
|
62
|
+
thor (0.15.4)
|
63
|
+
tilt (1.3.3)
|
64
|
+
|
65
|
+
PLATFORMS
|
66
|
+
ruby
|
67
|
+
|
68
|
+
DEPENDENCIES
|
69
|
+
middleman-sync!
|
data/README.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# Middleman Sync
|
2
|
+
|
3
|
+
Synchronise your Middleman build to S3 and more
|
4
|
+
|
5
|
+
Middleman Sync is post build hook and cli for Middleman to allow you to use [Asset Sync](https://raw.github.com/rumblelabs/asset_sync) for your static build deployments.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
If you already have a Middleman project:
|
10
|
+
|
11
|
+
Add `middleman-sync` to your `Gemfile` then open up your `config.rb` and add:
|
12
|
+
|
13
|
+
### AWS
|
14
|
+
|
15
|
+
``` ruby
|
16
|
+
# Activate sync extension
|
17
|
+
activate :sync do |sync|
|
18
|
+
sync.fog_provider = 'AWS' # Your storage provider
|
19
|
+
sync.fog_directory = 'bucket-name' # Your bucket name
|
20
|
+
sync.fog_region = 'bucket-region-name' # The region your storage bucket is in
|
21
|
+
sync.aws_access_key_id = 'super' # Your Amazon S3 access key
|
22
|
+
sync.aws_secret_access_key = 'secret' # Your Amazon S3 access secret
|
23
|
+
# sync.after_build = true # Run sync after build
|
24
|
+
# sync.existing_remote_files = 'keep' # What to do with your existing remote files? (keep or delete)
|
25
|
+
end
|
26
|
+
```
|
27
|
+
|
28
|
+
### Rackspace
|
29
|
+
|
30
|
+
``` ruby
|
31
|
+
# Activate sync extension
|
32
|
+
activate :sync do |sync|
|
33
|
+
sync.fog_provider = 'Rackspace' # Your storage provider
|
34
|
+
sync.fog_directory = 'bucket-name' # Your bucket name
|
35
|
+
sync.fog_region = 'bucket-region-name' # The region your storage bucket is in
|
36
|
+
sync.rackspace_username = 'karlfreeman' # Your Rackspace username
|
37
|
+
sync.rackspace_api_key = 'secret' # Your Rackspace API Key
|
38
|
+
# sync.rackspace_auth_url = 'domain' # Your Rackspace auth URL
|
39
|
+
# sync.after_build = true # Run sync after build
|
40
|
+
# sync.existing_remote_files = 'keep' # What to do with your existing remote files? (keep or delete)
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
### Google Storage
|
45
|
+
|
46
|
+
``` ruby
|
47
|
+
# Activate sync extension
|
48
|
+
activate :sync do |sync|
|
49
|
+
sync.fog_provider = 'Google' # Your storage provider
|
50
|
+
sync.fog_directory = 'bucket-name' # Your bucket name
|
51
|
+
sync.fog_region = 'bucket-region-name' # The region your storage bucket is in
|
52
|
+
sync.google_storage_access_key_id = 'super' # Your Google Storage access key
|
53
|
+
sync.google_storage_secret_access_key = 'secret' # Your Google Storage access secret
|
54
|
+
# sync.after_build = true # Run sync after build
|
55
|
+
# sync.existing_remote_files = 'keep' # What to do with your existing remote files? (keep or delete)
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
59
|
+
## Usage
|
60
|
+
|
61
|
+
Once you've bundled you should be able to run:
|
62
|
+
|
63
|
+
``` ruby
|
64
|
+
# Sync your current build directory
|
65
|
+
middleman sync
|
66
|
+
```
|
67
|
+
|
68
|
+
``` ruby
|
69
|
+
# Turn on after_build in your sync config to run middleman sync after each build
|
70
|
+
middleman build
|
71
|
+
```
|
72
|
+
|
73
|
+
## Todo
|
74
|
+
|
75
|
+
1. Replace AssetSync's logger to use Middleman's Thor builder.say_status
|
76
|
+
|
77
|
+
## Credits
|
78
|
+
|
79
|
+
Is essentially :
|
80
|
+
|
81
|
+
- [https://github.com/rumblelabs/asset_sync](https://github.com/rumblelabs/asset_sync)
|
82
|
+
|
83
|
+
Cribbed :
|
84
|
+
|
85
|
+
- [https://github.com/tvaughan/middleman-deploy](https://github.com/tvaughan/middleman-deploy)
|
86
|
+
- [https://github.com/middleman/middleman-smusher](https://github.com/middleman/middleman-smusher)
|
data/Rakefile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require "middleman-core/cli"
|
2
|
+
require "middleman-sync/extension"
|
3
|
+
|
4
|
+
module Middleman
|
5
|
+
|
6
|
+
module Cli
|
7
|
+
|
8
|
+
class Sync < Thor
|
9
|
+
include Thor::Actions
|
10
|
+
|
11
|
+
check_unknown_options!
|
12
|
+
|
13
|
+
namespace :sync
|
14
|
+
|
15
|
+
def self.exit_on_failure?
|
16
|
+
true
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "sync", "Synchronise your Middleman build to S3 and more"
|
20
|
+
def sync
|
21
|
+
|
22
|
+
shared_inst = ::Middleman::Application.server.inst
|
23
|
+
|
24
|
+
enabled = shared_inst.options.enabled
|
25
|
+
if (!enabled)
|
26
|
+
raise Thor::Error.new "You need to activate the sync extension in config.rb"
|
27
|
+
end
|
28
|
+
|
29
|
+
::AssetSync.sync
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require "middleman-core"
|
2
|
+
|
3
|
+
module Middleman
|
4
|
+
|
5
|
+
module Sync
|
6
|
+
|
7
|
+
class Options < Struct.new(:after_build, :existing_remote_files, :prefix, :public_path, :fog_provider, :fog_directory, :fog_region, :aws_access_key_id, :aws_secret_access_key, :rackspace_username, :rackspace_api_key, :rackspace_auth_url, :google_storage_secret_access_key, :google_storage_access_key_id); end
|
8
|
+
|
9
|
+
class << self
|
10
|
+
|
11
|
+
def options
|
12
|
+
@@options
|
13
|
+
end
|
14
|
+
|
15
|
+
def registered(app, options_hash={}, &block)
|
16
|
+
require 'asset_sync'
|
17
|
+
ENV["RAILS_GROUPS"] = "assets"
|
18
|
+
|
19
|
+
options = Options.new(options_hash)
|
20
|
+
yield options if block_given?
|
21
|
+
|
22
|
+
@@options = options
|
23
|
+
|
24
|
+
app.send :include, Helpers
|
25
|
+
|
26
|
+
app.after_configuration do
|
27
|
+
|
28
|
+
options.after_build ||= false
|
29
|
+
options.prefix ||= build_dir
|
30
|
+
options.public_path = Pathname(".")
|
31
|
+
|
32
|
+
AssetSync.configure do |config|
|
33
|
+
config.enabled = true
|
34
|
+
config.prefix = options.prefix
|
35
|
+
config.public_path = options.public_path
|
36
|
+
config.fog_region = options.fog_region
|
37
|
+
config.fog_provider = options.fog_provider
|
38
|
+
config.fog_directory = options.fog_directory
|
39
|
+
config.aws_access_key_id = options.aws_access_key_id
|
40
|
+
config.aws_secret_access_key = options.aws_secret_access_key
|
41
|
+
config.rackspace_username = options.rackspace_username
|
42
|
+
config.rackspace_api_key = options.rackspace_api_key
|
43
|
+
config.rackspace_auth_url = options.rackspace_auth_url
|
44
|
+
config.google_storage_secret_access_key = options.google_storage_secret_access_key
|
45
|
+
config.google_storage_access_key_id = options.google_storage_access_key_id
|
46
|
+
end
|
47
|
+
|
48
|
+
after_build do |builder|
|
49
|
+
::AssetSync.sync if options.after_build
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
alias :included :registered
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
module Helpers
|
61
|
+
|
62
|
+
def options
|
63
|
+
::Middleman::Sync.options
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "middleman-sync"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "middleman-sync/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "middleman-sync"
|
7
|
+
s.version = Middleman::Sync::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Karl Freeman"]
|
10
|
+
s.email = ["karlfreeman@gmail.com"]
|
11
|
+
s.homepage = "https://github.com/karlfreeman/middleman-sync"
|
12
|
+
s.summary = %q{Synchronise your Middleman build to S3 and more}
|
13
|
+
s.description = %q{Middleman-Sync is a Middleman extension that wraps the excellant AssetSync to allow for both a CLI and after_build hook to your Middleman build's}
|
14
|
+
|
15
|
+
s.rubyforge_project = "middleman-sync"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_runtime_dependency("middleman-core", [">= 3.0.0"])
|
23
|
+
s.add_runtime_dependency("asset_sync", ["~> 0.5.0"])
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: middleman-sync
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Karl Freeman
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-08-29 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: middleman-core
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.0.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: asset_sync
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.5.0
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.5.0
|
46
|
+
description: Middleman-Sync is a Middleman extension that wraps the excellant AssetSync
|
47
|
+
to allow for both a CLI and after_build hook to your Middleman build's
|
48
|
+
email:
|
49
|
+
- karlfreeman@gmail.com
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- .gitignore
|
55
|
+
- Gemfile
|
56
|
+
- Gemfile.lock
|
57
|
+
- README.md
|
58
|
+
- Rakefile
|
59
|
+
- lib/middleman-sync.rb
|
60
|
+
- lib/middleman-sync/commands.rb
|
61
|
+
- lib/middleman-sync/extension.rb
|
62
|
+
- lib/middleman-sync/version.rb
|
63
|
+
- lib/middleman_extension.rb
|
64
|
+
- middleman-sync.gemspec
|
65
|
+
homepage: https://github.com/karlfreeman/middleman-sync
|
66
|
+
licenses: []
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project: middleman-sync
|
85
|
+
rubygems_version: 1.8.23
|
86
|
+
signing_key:
|
87
|
+
specification_version: 3
|
88
|
+
summary: Synchronise your Middleman build to S3 and more
|
89
|
+
test_files: []
|