middleman-deploy 0.2.4 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7f7a8dcc337bf2c7b6e6d058135dbe42a0858838
4
+ data.tar.gz: 7943c508b8d0afc9e653f3a953796e77867c2ed0
5
+ SHA512:
6
+ metadata.gz: 0da41a24664305c55608def5db06c7bb296d909c1a9d2bfeeb43142d4cd4150752ceaaaea8b39bc3bf1c2fd92bd58712507c405b7cd10169497df2695cd2dcc5
7
+ data.tar.gz: fa7800a9cc0e4d4d1e104d0e0289cb8e3d326a9a42e322afc26796a5e5805eca8d0068156c7c91f4d7aeaa992836404c04d6fa3c233cad9442bfbd99779abd86
@@ -0,0 +1,3 @@
1
+ LICENSE.md
2
+ README.md
3
+ lib/**/*.rb
data/.gitignore CHANGED
@@ -1,8 +1,18 @@
1
- # Ignore bundler lock file
2
- /Gemfile.lock
3
-
4
- # Ignore pkg folder
5
- /pkg
6
-
7
- # Ignore coverage folder
8
- /coverage
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ bin
@@ -0,0 +1,24 @@
1
+ AllCops:
2
+ Include:
3
+ - Rakefile
4
+ - Gemfile
5
+ Exclude:
6
+ - script/**/*
7
+ - vendor/**/*
8
+ - bin/**/*
9
+ LineLength:
10
+ Enabled: false
11
+ MethodLength:
12
+ Enabled: false
13
+ ClassLength:
14
+ Enabled: false
15
+ Documentation:
16
+ Enabled: false
17
+ Encoding:
18
+ Enabled: false
19
+ Blocks:
20
+ Enabled: false
21
+ AlignParameters:
22
+ Enabled: false
23
+ HashSyntax:
24
+ EnforcedStyle: ruby19
@@ -0,0 +1,24 @@
1
+ language: ruby
2
+ cache: bundler
3
+ bundler_args: --without development
4
+ rvm:
5
+ - ruby-head
6
+ - ruby
7
+ - jruby-head
8
+ - jruby
9
+ - 2.1.0
10
+ - 2.0.0
11
+ - 1.9.3
12
+ - rbx-2
13
+ matrix:
14
+ fast_finish: true
15
+ allow_failures:
16
+ - rvm: ruby-head
17
+ - rvm: ruby
18
+ - rvm: jruby-head
19
+ - rvm: jruby
20
+ - rvm: rbx-2
21
+ notifications:
22
+ email: false
23
+ env:
24
+ - CODECLIMATE_REPO_TOKEN=5eee8e8624962f963a52a1d2313dc7407e3b8006291e3704346c786642cc073b
@@ -0,0 +1,6 @@
1
+ --markup markdown
2
+ -
3
+ CHANGELOG.md
4
+ CONTRIBUTING.md
5
+ LICENSE.md
6
+ README.md
@@ -0,0 +1,44 @@
1
+ ## Contributing
2
+ In the spirit of [free software][free-sw], **everyone** is encouraged to help
3
+ improve this project.
4
+
5
+ [free-sw]: http://www.fsf.org/licensing/essays/free-sw.html
6
+
7
+ Here are some ways *you* can contribute:
8
+
9
+ * by using alpha, beta, and prerelease versions
10
+ * by reporting bugs
11
+ * by suggesting new features
12
+ * by writing or editing documentation
13
+ * by writing specifications
14
+ * by writing code (**no patch is too small**: fix typos, add comments, clean up
15
+ inconsistent whitespace)
16
+ * by refactoring code
17
+ * by closing [issues][]
18
+ * by reviewing patches
19
+
20
+ [issues]: https://github.com/karlfreeman/middleman-deploy/issues
21
+
22
+ ## Submitting an Issue
23
+ We use the [GitHub issue tracker][issues] to track bugs and features. Before
24
+ submitting a bug report or feature request, check to make sure it hasn't
25
+ already been submitted. When submitting a bug report, please include a [Gist][]
26
+ that includes a stack trace and any details that may be necessary to reproduce
27
+ the bug, including your gem version, Ruby version, and operating system.
28
+ Ideally, a bug report should include a pull request with failing specs.
29
+
30
+ [gist]: https://gist.github.com/
31
+
32
+ ## Submitting a Pull Request
33
+ 1. [Fork the repository.][fork]
34
+ 2. [Create a topic branch.][branch]
35
+ 3. Add specs for your unimplemented feature or bug fix.
36
+ 4. Run `bundle exec rake cucumber`. If your specs pass, return to step 3.
37
+ 5. Implement your feature or bug fix.
38
+ 6. Run `bundle exec rake cucumber`. If your specs fail, return to step 5.
39
+ 7. Add, commit, and push your changes.
40
+ 9. [Submit a pull request.][pr]
41
+
42
+ [fork]: http://help.github.com/fork-a-repo/
43
+ [branch]: http://learn.github.com/p/branching.html
44
+ [pr]: http://help.github.com/send-pull-requests/
data/Gemfile CHANGED
@@ -1,19 +1,11 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in middleman-deploy.gemspec
4
3
  gemspec
5
4
 
6
- group :development do
7
- gem "rake"
8
- gem "rdoc"
9
- gem "yard"
10
- end
11
-
12
5
  group :test do
13
- gem "compass"
14
- gem "cucumber"
15
- gem "fivemat"
16
- gem "aruba"
17
- gem "rspec"
18
- gem "simplecov"
6
+ gem 'rake', '~> 10.0'
7
+ gem 'cucumber', '~> 1.3'
8
+ gem 'aruba', '~> 0.5'
9
+ gem 'fivemat'
10
+ gem 'codeclimate-test-reporter'
19
11
  end
@@ -1,4 +1,6 @@
1
- Copyright (c) 2012 Tom Vaughan <thomas.david.vaughan@gmail.com>
1
+ Copyright (c) 2012-2014 Tom Vaughan, Karl Freeman
2
+
3
+ MIT License
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining
4
6
  a copy of this software and associated documentation files (the
@@ -8,13 +10,13 @@ distribute, sublicense, and/or sell copies of the Software, and to
8
10
  permit persons to whom the Software is furnished to do so, subject to
9
11
  the following conditions:
10
12
 
11
- The above copyright notice and this permission notice shall be included
12
- in all copies or substantial portions of the Software.
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
13
15
 
14
16
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
17
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,22 +1,13 @@
1
- # middleman-deploy [![Gem Version](https://badge.fury.io/rb/middleman-deploy.png)](http://badge.fury.io/rb/middleman-deploy)
1
+ # Middleman Deploy
2
2
 
3
- Deploys a [middleman](http://middlemanapp.com/) built site via **rsync**,
4
- **ftp**, **sftp**, or **git** (e.g. gh-pages on github).
5
-
6
- ## Help!
7
-
8
- middleman-deploy needs a new maintainer. Please [create a GitHub issue](https://github.com/tvaughan/middleman-deploy/issues/new) if you're interested. Thanks!
3
+ Deploy your [Middleman](http://middlemanapp.com/) build via **rsync**, **ftp**, **sftp**, or **git** (e.g. [gh-pages on github](https://help.github.com/articles/creating-project-pages-manually)).
9
4
 
10
5
  ## Installation
11
6
 
12
- Add this to the Gemfile of the repository of your middleman site:
13
-
14
7
  ```ruby
15
- gem "middleman-deploy"
8
+ gem 'middleman-deploy', '~> 3.0'
16
9
  ```
17
10
 
18
- and run `bundle install`.
19
-
20
11
  ## Usage
21
12
 
22
13
  ```
@@ -24,23 +15,11 @@ $ middleman build [--clean]
24
15
  $ middleman deploy [--build-before]
25
16
  ```
26
17
 
27
- To automatically run `middleman build` during `middleman deploy`, turn on the
28
- `build_before` option while activating the deploy extension:
29
-
30
- ```ruby
31
- activate :deploy do |deploy|
32
- # ...
33
- deploy.build_before = true # default: false
34
- end
35
- ```
36
-
37
18
  ## Possible Configurations
38
19
 
39
- Middleman-deploy can deploy a site via rsync, ftp, sftp, or git.
40
-
41
- Checkout [the wiki](https://github.com/tvaughan/middleman-deploy/wiki/_pages) for advanced set-up options.
20
+ Middleman-deploy can deploy a site via rsync, ftp, sftp, or git. Checkout [the wiki](https://github.com/tvaughan/middleman-deploy/wiki/_pages) for advanced set-up options.
42
21
 
43
- ### rsync
22
+ ### Rsync
44
23
 
45
24
  Make sure that `rsync` is installed, and activate the extension by adding the
46
25
  following to `config.rb`:
@@ -48,13 +27,13 @@ following to `config.rb`:
48
27
  ```ruby
49
28
  activate :deploy do |deploy|
50
29
  deploy.method = :rsync
51
- deploy.host = "www.example.com"
52
- deploy.path = "/srv/www/site"
30
+ deploy.host = 'www.example.com'
31
+ deploy.path = '/srv/www/site'
53
32
  # Optional Settings
54
- # deploy.user = "tvaughan" # no default
33
+ # deploy.user = 'tvaughan' # no default
55
34
  # deploy.port = 5309 # ssh port, default: 22
56
35
  # deploy.clean = true # remove orphaned files on remote host, default: false
57
- # deploy.flags = "-rltgoDvzO --no-p --del" # add custom flags, default: -avz
36
+ # deploy.flags = '-rltgoDvzO --no-p --del' # add custom flags, default: -avz
58
37
  end
59
38
  ```
60
39
 
@@ -67,10 +46,10 @@ following to `config.rb`:
67
46
  activate :deploy do |deploy|
68
47
  deploy.method = :git
69
48
  # Optional Settings
70
- # deploy.remote = "custom-remote" # remote name or git url, default: origin
71
- # deploy.branch = "custom-branch" # default: gh-pages
49
+ # deploy.remote = 'custom-remote' # remote name or git url, default: origin
50
+ # deploy.branch = 'custom-branch' # default: gh-pages
72
51
  # deploy.strategy = :submodule # commit strategy: can be :force_push or :submodule, default: :force_push
73
- # deploy.commit_message = "custom-message" # commit message (can be empty), default: Automated commit at `timestamp` by middleman-deploy `version`
52
+ # deploy.commit_message = 'custom-message' # commit message (can be empty), default: Automated commit at `timestamp` by middleman-deploy `version`
74
53
  end
75
54
  ```
76
55
 
@@ -92,10 +71,10 @@ Activate the extension by adding the following to `config.rb`:
92
71
  ```ruby
93
72
  activate :deploy do |deploy|
94
73
  deploy.method = :ftp
95
- deploy.host = "ftp.example.com"
96
- deploy.path = "/srv/www/site"
97
- deploy.user = "tvaughan"
98
- deploy.password = "secret"
74
+ deploy.host = 'ftp.example.com'
75
+ deploy.path = '/srv/www/site'
76
+ deploy.user = 'tvaughan'
77
+ deploy.password = 'secret'
99
78
  end
100
79
  ```
101
80
 
@@ -106,12 +85,24 @@ Activate the extension by adding the following to `config.rb`:
106
85
  ```ruby
107
86
  activate :deploy do |deploy|
108
87
  deploy.method = :sftp
109
- deploy.host = "sftp.example.com"
88
+ deploy.host = 'sftp.example.com'
110
89
  deploy.port = 22
111
- deploy.path = "/srv/www/site"
90
+ deploy.path = '/srv/www/site'
112
91
  # Optional Settings
113
- # deploy.user = "tvaughan" # no default
114
- # deploy.password = "secret" # no default
92
+ # deploy.user = 'tvaughan' # no default
93
+ # deploy.password = 'secret' # no default
94
+ end
95
+ ```
96
+
97
+ ### Run Automatically
98
+
99
+ To automatically run `middleman build` during `middleman deploy`, turn on the
100
+ `build_before` option while activating the deploy extension:
101
+
102
+ ```ruby
103
+ activate :deploy do |deploy|
104
+ # ...
105
+ deploy.build_before = true # default: false
115
106
  end
116
107
  ```
117
108
 
@@ -125,14 +116,14 @@ case ENV['TARGET'].to_s.downcase
125
116
  when 'production'
126
117
  activate :deploy do |deploy|
127
118
  deploy.method = :rsync
128
- deploy.host = "www.example.com"
129
- deploy.path = "/srv/www/production-site"
119
+ deploy.host = 'www.example.com'
120
+ deploy.path = '/srv/www/production-site'
130
121
  end
131
122
  else
132
123
  activate :deploy do |deploy|
133
124
  deploy.method = :rsync
134
- deploy.host = "staging.example.com"
135
- deploy.path = "/srv/www/staging-site"
125
+ deploy.host = 'staging.example.com'
126
+ deploy.path = '/srv/www/staging-site'
136
127
  end
137
128
  end
138
129
  ```
@@ -170,13 +161,38 @@ end
170
161
  sense. `deploy` was added to the `after_build` hook simply because it
171
162
  was available.
172
163
 
164
+ ## Badges
165
+
166
+ [![Gem Version](http://img.shields.io/gem/v/middleman-deploy.svg)][gem]
167
+ [![Build Status](http://img.shields.io/travis/karlfreeman/middleman-deploy.svg)][travis]
168
+ [![Code Quality](http://img.shields.io/codeclimate/github/karlfreeman/middleman-deploy.svg)][codeclimate]
169
+ [![Code Coverage](http://img.shields.io/codeclimate/coverage/github/karlfreeman/middleman-deploy.svg)][codeclimate]
170
+ [![Gittip](http://img.shields.io/gittip/karlfreeman.svg)][gittip]
171
+
172
+ ## Supported Ruby Versions
173
+
174
+ This library aims to support and is [tested against][travis] the following Ruby
175
+ implementations:
176
+
177
+ - Ruby 2.1.0
178
+ - Ruby 2.0.0
179
+ - Ruby 1.9.3
180
+ - [JRuby][jruby]
181
+ - [Rubinius][rubinius]
182
+
173
183
  ## Thanks!
174
184
 
175
- A **BIG** thanks to
176
- [everyone who has contributed](https://github.com/tvaughan/middleman-deploy/graphs/contributors)!
177
- Almost all pull requests are accepted.
185
+ A **BIG** thanks to [everyone who has contributed](https://github.com/tvaughan/middleman-deploy/graphs/contributors)! Almost all pull requests are accepted.
186
+
187
+ # Credits
188
+
189
+ Inspiration:
178
190
 
179
- ## Other
191
+ - The rsync task in [Octopress](https://github.com/imathis/octopress)
180
192
 
181
- Inspired by the rsync task in
182
- [Octopress](https://github.com/imathis/octopress).
193
+ [gem]: https://rubygems.org/gems/middleman-deploy
194
+ [travis]: http://travis-ci.org/karlfreeman/middleman-deploy
195
+ [codeclimate]: https://codeclimate.com/github/karlfreeman/middleman-deploy
196
+ [gittip]: https://www.gittip.com/karlfreeman
197
+ [jruby]: http://www.jruby.org
198
+ [rubinius]: http://rubini.us
data/Rakefile CHANGED
@@ -1,14 +1,25 @@
1
1
  require 'bundler'
2
+ Bundler.setup
2
3
  Bundler::GemHelper.install_tasks
3
4
 
4
5
  require 'cucumber/rake/task'
5
-
6
6
  Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
7
- t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}"
7
+ exempt_tags = ['--tags ~@wip']
8
+ t.cucumber_opts = "--color #{exempt_tags.join(' ')} --strict --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}"
8
9
  end
9
10
 
10
- require 'rake/clean'
11
+ begin
12
+ require 'yard'
13
+ YARD::Rake::YardocTask.new
14
+ rescue LoadError
15
+ end
11
16
 
12
- task :test => ["cucumber"]
17
+ begin
18
+ require 'rubocop/rake_task'
19
+ desc 'Run rubocop'
20
+ Rubocop::RakeTask.new(:rubocop)
21
+ rescue LoadError
22
+ end
13
23
 
14
- task :default => :test
24
+ task default: :cucumber
25
+ task test: :cucumber
@@ -1,6 +1,8 @@
1
- require "simplecov"
2
- SimpleCov.start
3
1
  PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
4
- require "middleman-core"
5
- require "middleman-core/step_definitions"
2
+ require 'middleman-core'
3
+ require 'middleman-core/step_definitions'
4
+
5
+ require 'codeclimate-test-reporter'
6
+ CodeClimate::TestReporter.start
7
+
6
8
  require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-deploy')
@@ -0,0 +1,6 @@
1
+ Feature: test
2
+
3
+ Scenario: whilst testing
4
+ Given the Server is running at "test-app"
5
+ When I go to "/index.html"
6
+ Then I should see "<h1>Test</h1>"
File without changes
@@ -0,0 +1 @@
1
+ <h1>Test</h1>
@@ -1,8 +1,8 @@
1
- require "middleman-core"
1
+ require 'middleman-core'
2
2
 
3
- require "middleman-deploy/commands"
3
+ require 'middleman-deploy/commands'
4
4
 
5
5
  ::Middleman::Extensions.register(:deploy) do
6
- require "middleman-deploy/extension"
6
+ require 'middleman-deploy/extension'
7
7
  ::Middleman::Deploy
8
8
  end
@@ -1,13 +1,12 @@
1
- require "middleman-core/cli"
1
+ require 'middleman-core/cli'
2
2
 
3
- require "middleman-deploy/extension"
4
- require "middleman-deploy/methods"
5
- require "middleman-deploy/strategies"
6
- require "middleman-deploy/pkg-info"
3
+ require 'middleman-deploy/pkg-info'
4
+ require 'middleman-deploy/extension'
5
+ require 'middleman-deploy/methods'
6
+ require 'middleman-deploy/strategies'
7
7
 
8
8
  module Middleman
9
9
  module Cli
10
-
11
10
  # This class provides a "deploy" command for the middleman CLI.
12
11
  class Deploy < Thor
13
12
  include Thor::Actions
@@ -21,11 +20,11 @@ module Middleman
21
20
  true
22
21
  end
23
22
 
24
- desc "deploy [options]", Middleman::Deploy::TAGLINE
25
- method_option "build_before",
26
- :type => :boolean,
27
- :aliases => "-b",
28
- :desc => "Run `middleman build` before the deploy step"
23
+ desc 'deploy [options]', Middleman::Deploy::TAGLINE
24
+ method_option 'build_before',
25
+ type: :boolean,
26
+ aliases: '-b',
27
+ desc: 'Run `middleman build` before the deploy step'
29
28
  def deploy
30
29
  build_before(options)
31
30
  process
@@ -33,7 +32,7 @@ module Middleman
33
32
 
34
33
  protected
35
34
 
36
- def build_before(options={})
35
+ def build_before(options = {})
37
36
  build_enabled = options.fetch('build_before', self.deploy_options.build_before)
38
37
 
39
38
  if build_enabled
@@ -43,10 +42,7 @@ module Middleman
43
42
  end
44
43
 
45
44
  def print_usage_and_die(message)
46
- usage_path = File.join(File.dirname(__FILE__), '..', '..', 'USAGE')
47
- usage_message = File.read(usage_path)
48
-
49
- raise Error, "ERROR: #{message}\n#{usage_message}"
45
+ raise Error, "ERROR: #{message}\n#{Middleman::Deploy::README}"
50
46
  end
51
47
 
52
48
  def process
@@ -65,11 +61,11 @@ module Middleman
65
61
  begin
66
62
  options = ::Middleman::Application.server.inst.options
67
63
  rescue NoMethodError
68
- print_usage_and_die "You need to activate the deploy extension in config.rb."
64
+ print_usage_and_die 'You need to activate the deploy extension in config.rb.'
69
65
  end
70
66
 
71
67
  unless options.method
72
- print_usage_and_die "The deploy extension requires you to set a method."
68
+ print_usage_and_die 'The deploy extension requires you to set a method.'
73
69
  end
74
70
 
75
71
  case options.method
@@ -79,7 +75,7 @@ module Middleman
79
75
  end
80
76
  when :ftp
81
77
  unless options.host && options.user && options.password && options.path
82
- print_usage_and_die "The ftp deploy method requires host, path, user, and password to be set."
78
+ print_usage_and_die 'The ftp deploy method requires host, path, user, and password to be set.'
83
79
  end
84
80
  end
85
81
 
@@ -88,6 +84,6 @@ module Middleman
88
84
  end
89
85
 
90
86
  # Alias "d" to "deploy"
91
- Base.map({ "d" => "deploy" })
87
+ Base.map('d' => 'deploy')
92
88
  end
93
89
  end
@@ -1,19 +1,17 @@
1
1
  # Require core library
2
- require "middleman-core"
2
+ require 'middleman-core'
3
3
 
4
4
  # Extension namespace
5
5
  module Middleman
6
6
  module Deploy
7
-
8
- class Options < Struct.new(:whatisthis, :method, :host, :port, :user, :password, :path, :clean, :remote, :branch, :strategy, :build_before, :flags, :commit_message); end
7
+ class Options < Struct.new(:method, :host, :port, :user, :password, :path, :clean, :remote, :branch, :strategy, :build_before, :flags, :commit_message); end
9
8
 
10
9
  class << self
11
-
12
10
  def options
13
11
  @@options
14
12
  end
15
13
 
16
- def registered(app, options_hash={}, &block)
14
+ def registered(app, options_hash = {}, &block)
17
15
  options = Options.new(options_hash)
18
16
  yield options if block_given?
19
17
 
@@ -22,9 +20,9 @@ module Middleman
22
20
  options.clean ||= false
23
21
 
24
22
  # Default options for the git method.
25
- options.remote ||= "origin"
26
- options.branch ||= "gh-pages"
27
- options.strategy ||= :force_push
23
+ options.remote ||= 'origin'
24
+ options.branch ||= 'gh-pages'
25
+ options.strategy ||= :force_push
28
26
  options.commit_message ||= nil
29
27
 
30
28
  options.build_before ||= false
@@ -34,8 +32,7 @@ module Middleman
34
32
  app.send :include, Helpers
35
33
  end
36
34
 
37
- alias :included :registered
38
-
35
+ alias_method :included, :registered
39
36
  end
40
37
 
41
38
  module Helpers
@@ -43,6 +40,5 @@ module Middleman
43
40
  ::Middleman::Deploy.options
44
41
  end
45
42
  end
46
-
47
43
  end
48
44
  end
@@ -4,7 +4,7 @@ module Middleman
4
4
  class Base
5
5
  attr_reader :options, :server_instance
6
6
 
7
- def initialize(server_instance, options={})
7
+ def initialize(server_instance, options = {})
8
8
  @options = options
9
9
  @server_instance = server_instance
10
10
  end
@@ -12,7 +12,6 @@ module Middleman
12
12
  def process
13
13
  raise NotImplementedError
14
14
  end
15
-
16
15
  end
17
16
  end
18
17
  end
@@ -5,10 +5,9 @@ module Middleman
5
5
  module Deploy
6
6
  module Methods
7
7
  class Ftp < Base
8
-
9
8
  attr_reader :host, :port, :pass, :path, :user
10
9
 
11
- def initialize(server_instance, options={})
10
+ def initialize(server_instance, options = {})
12
11
  super(server_instance, options)
13
12
 
14
13
  @host = self.options.host
@@ -27,7 +26,7 @@ module Middleman
27
26
  filtered_files.each do |filename|
28
27
  if File.directory?(filename)
29
28
  upload_directory(ftp, filename)
30
- else
29
+ else
31
30
  upload_binary(ftp, filename)
32
31
  end
33
32
  end
@@ -36,7 +35,7 @@ module Middleman
36
35
  ftp.close
37
36
  end
38
37
 
39
- protected
38
+ protected
40
39
 
41
40
  def filtered_files
42
41
  files = Dir.glob('**/*', File::FNM_DOTMATCH)
@@ -46,7 +45,7 @@ module Middleman
46
45
 
47
46
  def handle_exception(exception, ftp, filename)
48
47
  reply = exception.message
49
- err_code = reply[0,3].to_i
48
+ err_code = reply[0, 3].to_i
50
49
 
51
50
  if err_code == 550
52
51
  if File.binary?(filename)
@@ -83,8 +82,6 @@ module Middleman
83
82
  rescue
84
83
  end
85
84
  end
86
-
87
-
88
85
  end
89
86
  end
90
87
  end
@@ -2,7 +2,6 @@ module Middleman
2
2
  module Deploy
3
3
  module Methods
4
4
  class Git < Base
5
-
6
5
  def process
7
6
  puts "## Deploying via git to remote=\"#{self.options.remote}\" and branch=\"#{self.options.branch}\""
8
7
 
@@ -12,7 +11,6 @@ module Middleman
12
11
 
13
12
  strategy_instance.process
14
13
  end
15
-
16
14
  end
17
15
  end
18
16
  end
@@ -2,10 +2,9 @@ module Middleman
2
2
  module Deploy
3
3
  module Methods
4
4
  class Rsync < Base
5
-
6
5
  attr_reader :clean, :flags, :host, :path, :port, :user
7
6
 
8
- def initialize(server_instance, options={})
7
+ def initialize(server_instance, options = {})
9
8
  super(server_instance, options)
10
9
 
11
10
  @clean = self.options.clean
@@ -25,13 +24,12 @@ module Middleman
25
24
  command = "rsync #{flags} '-e ssh -p #{self.port}' #{self.server_instance.build_dir}/ #{dest_url}"
26
25
 
27
26
  if self.clean
28
- command += " --delete"
27
+ command += ' --delete'
29
28
  end
30
29
 
31
30
  puts "## Deploying via rsync to #{dest_url} port=#{self.port}"
32
31
  exec command
33
32
  end
34
-
35
33
  end
36
34
  end
37
35
  end
@@ -5,12 +5,11 @@ module Middleman
5
5
  module Deploy
6
6
  module Methods
7
7
  class Sftp < Ftp
8
-
9
8
  def process
10
9
  puts "## Deploying via sftp to #{self.user}@#{self.host}:#{path}"
11
10
 
12
11
  # `nil` is a valid value for user and/or pass.
13
- Net::SFTP.start(self.host, self.user, :password => self.pass, :port => self.port) do |sftp|
12
+ Net::SFTP.start(self.host, self.user, password: self.pass, port: self.port) do |sftp|
14
13
  sftp.mkdir(self.path)
15
14
 
16
15
  Dir.chdir(self.server_instance.build_dir) do
@@ -25,11 +24,11 @@ module Middleman
25
24
  end
26
25
  end
27
26
 
28
- protected
27
+ protected
29
28
 
30
- def handle_exception(exception)
29
+ def handle_exception(exception,filename, file_path)
31
30
  reply = exception.message
32
- err_code = reply[0,3].to_i
31
+ err_code = reply[0, 3].to_i
33
32
 
34
33
  if err_code == 550
35
34
  sftp.upload(filename, file_path)
@@ -52,14 +51,12 @@ module Middleman
52
51
  begin
53
52
  sftp.upload(filename, file_path)
54
53
  rescue Exception => exception
55
- handle_exception(exception, file_path)
54
+ handle_exception(exception, filename, file_path)
56
55
  end
57
56
 
58
57
  puts "Copied #{filename}"
59
58
  end
60
-
61
59
  end
62
60
  end
63
61
  end
64
62
  end
65
-
@@ -1,7 +1,64 @@
1
1
  module Middleman
2
2
  module Deploy
3
- PACKAGE = "middleman-deploy"
4
- VERSION = "0.2.4"
5
- TAGLINE = "Deploy a middleman built site over rsync, ftp, sftp, or git (e.g. gh-pages on github)."
6
- end
3
+ PACKAGE = 'middleman-deploy'
4
+ VERSION = '0.3.0'
5
+ TAGLINE = 'Deploy a middleman built site over rsync, ftp, sftp, or git (e.g. gh-pages on github).'
6
+ README = %Q{
7
+ You should follow one of the four examples below to setup the deploy
8
+ extension in config.rb.
9
+
10
+ # To deploy the build directory to a remote host via rsync:
11
+ activate :deploy do |deploy|
12
+ deploy.method = :rsync
13
+ # host and path *must* be set
14
+ deploy.host = "www.example.com"
15
+ deploy.path = "/srv/www/site"
16
+ # user is optional (no default)
17
+ deploy.user = "tvaughan"
18
+ # port is optional (default is 22)
19
+ deploy.port = 5309
20
+ # clean is optional (default is false)
21
+ deploy.clean = true
22
+ # flags is optional (default is -avze)
23
+ deploy.flags = "-rltgoDvzO --no-p --del -e"
24
+ end
25
+
26
+ # To deploy to a remote branch via git (e.g. gh-pages on github):
27
+ activate :deploy do |deploy|
28
+ deploy.method = :git
29
+ # remote is optional (default is "origin")
30
+ # run `git remote -v` to see a list of possible remotes
31
+ deploy.remote = "some-other-remote-name"
32
+
33
+ # branch is optional (default is "gh-pages")
34
+ # run `git branch -a` to see a list of possible branches
35
+ deploy.branch = "some-other-branch-name"
36
+
37
+ # strategy is optional (default is :force_push)
38
+ deploy.strategy = :submodule
7
39
  end
40
+
41
+ # To deploy the build directory to a remote host via ftp:
42
+ activate :deploy do |deploy|
43
+ deploy.method = :ftp
44
+ # host, user, passwword and path *must* be set
45
+ deploy.host = "ftp.example.com"
46
+ deploy.path = "/srv/www/site"
47
+ deploy.user = "tvaughan"
48
+ deploy.password = "secret"
49
+ end
50
+
51
+ # To deploy the build directory to a remote host via sftp:
52
+ activate :deploy do |deploy|
53
+ deploy.method = :sftp
54
+ # host, user, passwword and path *must* be set
55
+ deploy.host = "sftp.example.com"
56
+ deploy.port = 22
57
+ deploy.path = "/srv/www/site"
58
+ # user is optional (no default)
59
+ deploy.user = "tvaughan"
60
+ # password is optional (no default)
61
+ deploy.password = "secret"
62
+ end}
63
+ end
64
+ end
@@ -16,7 +16,7 @@ module Middleman
16
16
  raise NotImplementedError
17
17
  end
18
18
 
19
- protected
19
+ protected
20
20
 
21
21
  def add_signature_to_commit_message(base_message)
22
22
  signature = "#{Middleman::Deploy::PACKAGE} #{Middleman::Deploy::VERSION}"
@@ -34,14 +34,13 @@ module Middleman
34
34
  end
35
35
  end
36
36
 
37
- def commit_branch(options='')
37
+ def commit_branch(options = '')
38
38
  message = self.commit_message ? self.commit_message : add_signature_to_commit_message('Automated commit')
39
39
 
40
40
  `git add -A`
41
41
  `git commit --allow-empty -am "#{message}"`
42
42
  `git push #{options} origin #{self.branch}`
43
43
  end
44
-
45
44
  end
46
45
  end
47
46
  end
@@ -3,7 +3,6 @@ module Middleman
3
3
  module Strategies
4
4
  module Git
5
5
  class ForcePush < Base
6
-
7
6
  def process
8
7
  Dir.chdir(self.build_dir) do
9
8
  add_remote_url
@@ -12,12 +11,12 @@ module Middleman
12
11
  end
13
12
  end
14
13
 
15
- private
14
+ private
16
15
 
17
16
  def add_remote_url
18
17
  url = get_remote_url
19
18
 
20
- unless File.exists?('.git')
19
+ unless File.exist?('.git')
21
20
  `git init`
22
21
  `git remote add origin #{url}`
23
22
  else
@@ -46,7 +45,6 @@ module Middleman
46
45
 
47
46
  url
48
47
  end
49
-
50
48
  end
51
49
  end
52
50
  end
@@ -3,7 +3,6 @@ module Middleman
3
3
  module Strategies
4
4
  module Git
5
5
  class Submodule < Base
6
-
7
6
  def process
8
7
  Dir.chdir(self.build_dir) do
9
8
  checkout_branch
@@ -14,7 +13,7 @@ module Middleman
14
13
  commit_submodule
15
14
  end
16
15
 
17
- private
16
+ private
18
17
 
19
18
  def commit_submodule
20
19
  current_branch = `git rev-parse --abbrev-ref HEAD`
@@ -36,7 +35,6 @@ module Middleman
36
35
  exit
37
36
  end
38
37
  end
39
-
40
38
  end
41
39
  end
42
40
  end
@@ -1 +1 @@
1
- require "middleman-deploy"
1
+ require 'middleman-deploy'
@@ -1,27 +1,32 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "middleman-deploy/pkg-info"
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'middleman-deploy/pkg-info'
4
5
 
5
- Gem::Specification.new do |s|
6
- s.name = Middleman::Deploy::PACKAGE
7
- s.version = Middleman::Deploy::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ["Tom Vaughan"]
10
- s.email = ["thomas.david.vaughan@gmail.com"]
11
- s.homepage = "http://github.com/tvaughan/middleman-deploy"
12
- s.summary = Middleman::Deploy::TAGLINE
13
- s.description = Middleman::Deploy::TAGLINE
14
- s.license = "MIT"
6
+ Gem::Specification.new do |spec|
7
+ spec.name = Middleman::Deploy::PACKAGE
8
+ spec.version = Middleman::Deploy::VERSION
9
+ spec.authors = ['Tom Vaughan', 'Karl Freeman']
10
+ spec.email = ['thomas.david.vaughan@gmail.com', 'karlfreeman@gmail.com']
11
+ spec.summary = Middleman::Deploy::TAGLINE
12
+ spec.description = Middleman::Deploy::TAGLINE
13
+ spec.homepage = 'https://github.com/karlfreeman/middleman-deploy'
14
+ spec.license = 'MIT'
15
15
 
16
- s.files = `git ls-files`.split("\n")
17
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib"]
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+ spec.required_ruby_version = '>= 1.9.3'
20
21
 
21
- # The version of middleman-core your extension depends on
22
- s.add_runtime_dependency("middleman-core", [">= 3.0.0"])
22
+ spec.add_dependency 'middleman-core', '>= 3.2'
23
+ spec.add_dependency 'ptools'
24
+ spec.add_dependency 'net-sftp'
23
25
 
24
- # Additional dependencies
25
- s.add_runtime_dependency("ptools")
26
- s.add_runtime_dependency("net-sftp")
26
+ spec.add_development_dependency 'bundler', '~> 1.5'
27
+ spec.add_development_dependency 'rake', '~> 10.0'
28
+ spec.add_development_dependency 'kramdown', '>= 0.14'
29
+ spec.add_development_dependency 'rubocop', '~> 0.19'
30
+ spec.add_development_dependency 'pry'
31
+ spec.add_development_dependency 'yard'
27
32
  end
metadata CHANGED
@@ -1,79 +1,165 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
5
- prerelease:
4
+ version: 0.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tom Vaughan
8
+ - Karl Freeman
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-27 00:00:00.000000000 Z
12
+ date: 2014-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: middleman-core
16
16
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
17
  requirements:
19
- - - ! '>='
18
+ - - ">="
20
19
  - !ruby/object:Gem::Version
21
- version: 3.0.0
20
+ version: '3.2'
22
21
  type: :runtime
23
22
  prerelease: false
24
23
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
- - - ! '>='
25
+ - - ">="
28
26
  - !ruby/object:Gem::Version
29
- version: 3.0.0
27
+ version: '3.2'
30
28
  - !ruby/object:Gem::Dependency
31
29
  name: ptools
32
30
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
31
  requirements:
35
- - - ! '>='
32
+ - - ">="
36
33
  - !ruby/object:Gem::Version
37
34
  version: '0'
38
35
  type: :runtime
39
36
  prerelease: false
40
37
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
38
  requirements:
43
- - - ! '>='
39
+ - - ">="
44
40
  - !ruby/object:Gem::Version
45
41
  version: '0'
46
42
  - !ruby/object:Gem::Dependency
47
43
  name: net-sftp
48
44
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
45
  requirements:
51
- - - ! '>='
46
+ - - ">="
52
47
  - !ruby/object:Gem::Version
53
48
  version: '0'
54
49
  type: :runtime
55
50
  prerelease: false
56
51
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
52
  requirements:
59
- - - ! '>='
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: bundler
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '1.5'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '1.5'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rake
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '10.0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '10.0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: kramdown
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0.14'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0.14'
98
+ - !ruby/object:Gem::Dependency
99
+ name: rubocop
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '0.19'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '0.19'
112
+ - !ruby/object:Gem::Dependency
113
+ name: pry
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: yard
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
60
138
  - !ruby/object:Gem::Version
61
139
  version: '0'
62
140
  description: Deploy a middleman built site over rsync, ftp, sftp, or git (e.g. gh-pages
63
141
  on github).
64
142
  email:
65
143
  - thomas.david.vaughan@gmail.com
144
+ - karlfreeman@gmail.com
66
145
  executables: []
67
146
  extensions: []
68
147
  extra_rdoc_files: []
69
148
  files:
70
- - .gitignore
71
- - COPYING
149
+ - ".document"
150
+ - ".gitignore"
151
+ - ".rubocop.yml"
152
+ - ".travis.yml"
153
+ - ".yardopts"
154
+ - CONTRIBUTING.md
72
155
  - Gemfile
156
+ - LICENSE.md
73
157
  - README.md
74
158
  - Rakefile
75
- - USAGE
76
159
  - features/support/env.rb
160
+ - features/test.feature
161
+ - fixtures/test-app/config.rb
162
+ - fixtures/test-app/source/index.html.erb
77
163
  - lib/middleman-deploy.rb
78
164
  - lib/middleman-deploy/commands.rb
79
165
  - lib/middleman-deploy/extension.rb
@@ -90,31 +176,32 @@ files:
90
176
  - lib/middleman-deploy/strategies/git/submodule.rb
91
177
  - lib/middleman_extension.rb
92
178
  - middleman-deploy.gemspec
93
- homepage: http://github.com/tvaughan/middleman-deploy
179
+ homepage: https://github.com/karlfreeman/middleman-deploy
94
180
  licenses:
95
181
  - MIT
182
+ metadata: {}
96
183
  post_install_message:
97
184
  rdoc_options: []
98
185
  require_paths:
99
186
  - lib
100
187
  required_ruby_version: !ruby/object:Gem::Requirement
101
- none: false
102
188
  requirements:
103
- - - ! '>='
189
+ - - ">="
104
190
  - !ruby/object:Gem::Version
105
- version: '0'
191
+ version: 1.9.3
106
192
  required_rubygems_version: !ruby/object:Gem::Requirement
107
- none: false
108
193
  requirements:
109
- - - ! '>='
194
+ - - ">="
110
195
  - !ruby/object:Gem::Version
111
196
  version: '0'
112
197
  requirements: []
113
198
  rubyforge_project:
114
- rubygems_version: 1.8.23
199
+ rubygems_version: 2.2.2
115
200
  signing_key:
116
- specification_version: 3
201
+ specification_version: 4
117
202
  summary: Deploy a middleman built site over rsync, ftp, sftp, or git (e.g. gh-pages
118
203
  on github).
119
- test_files: []
204
+ test_files:
205
+ - features/support/env.rb
206
+ - features/test.feature
120
207
  has_rdoc:
data/USAGE DELETED
@@ -1,56 +0,0 @@
1
- You should follow one of the four examples below to setup the deploy
2
- extension in config.rb.
3
-
4
- # To deploy the build directory to a remote host via rsync:
5
- activate :deploy do |deploy|
6
- deploy.method = :rsync
7
- # host and path *must* be set
8
- deploy.host = "www.example.com"
9
- deploy.path = "/srv/www/site"
10
- # user is optional (no default)
11
- deploy.user = "tvaughan"
12
- # port is optional (default is 22)
13
- deploy.port = 5309
14
- # clean is optional (default is false)
15
- deploy.clean = true
16
- # flags is optional (default is -avze)
17
- deploy.flags = "-rltgoDvzO --no-p --del -e"
18
- end
19
-
20
- # To deploy to a remote branch via git (e.g. gh-pages on github):
21
- activate :deploy do |deploy|
22
- deploy.method = :git
23
- # remote is optional (default is "origin")
24
- # run `git remote -v` to see a list of possible remotes
25
- deploy.remote = "some-other-remote-name"
26
-
27
- # branch is optional (default is "gh-pages")
28
- # run `git branch -a` to see a list of possible branches
29
- deploy.branch = "some-other-branch-name"
30
-
31
- # strategy is optional (default is :force_push)
32
- deploy.strategy = :submodule
33
- end
34
-
35
- # To deploy the build directory to a remote host via ftp:
36
- activate :deploy do |deploy|
37
- deploy.method = :ftp
38
- # host, user, passwword and path *must* be set
39
- deploy.host = "ftp.example.com"
40
- deploy.path = "/srv/www/site"
41
- deploy.user = "tvaughan"
42
- deploy.password = "secret"
43
- end
44
-
45
- # To deploy the build directory to a remote host via sftp:
46
- activate :deploy do |deploy|
47
- deploy.method = :sftp
48
- # host, user, passwword and path *must* be set
49
- deploy.host = "sftp.example.com"
50
- deploy.port = 22
51
- deploy.path = "/srv/www/site"
52
- # user is optional (no default)
53
- deploy.user = "tvaughan"
54
- # password is optional (no default)
55
- deploy.password = "secret"
56
- end