Skip to content

Commit

Permalink
Merge pull request #424 from welaika/movefile_dot_yaml
Browse files Browse the repository at this point in the history
rename Movefile to movefile.yml by default
  • Loading branch information
alessandro-fazzi authored Nov 16, 2017
2 parents ac05729 + c474eb0 commit 67a8ac6
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 23 deletions.
15 changes: 9 additions & 6 deletions README.mdown
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ Wordmove just acts as automation glue bewtween tools you already have and love.
> wordmove help
Tasks:
wordmove help [TASK] # Describe available tasks or one specific task
wordmove init # Generates a brand new Movefile
wordmove init # Generates a brand new movefile.yml
wordmove pull # Pulls WP data from remote host to the local machine
wordmove push # Pushes WP data from local machine to remote host
```

Move inside the Wordpress folder and use `wordmove init` to generate a new `Movefile` and edit it with your settings. Read the next paragraph for more info.
Move inside the Wordpress folder and use `wordmove init` to generate a new `movefile.yml` and edit it with your settings. Read the next paragraph for more info.

**See the wiki article: [Usage and flags explained](https://github.com/welaika/wordmove/wiki/Usage-and-flags-explained) for more info.**

Expand All @@ -56,9 +56,9 @@ Move inside the Wordpress folder and use `wordmove init` to generate a new `Move
* Pull database and uploads, adapting paths and urls: http://vimeo.com/74646861
* Push only theme, transfer only modified files: http://vimeo.com/74647529

## Movefile
## movefile.yml

You can configure Wordmove creating a `Movefile`. That's just a YAML file with local and remote host infos:
You can configure Wordmove creating a `movefile.yml`. That's just a YAML file with local and remote host infos:

```yaml
global:
Expand Down Expand Up @@ -101,6 +101,9 @@ production:
- "tmp/*"
- "Gemfile*"
- "Movefile"
- "movefile"
- "movefile.yml"
- "movefile.yaml"
- "wp-config.php"
- "wp-content/*.sql"

Expand All @@ -123,7 +126,7 @@ See the [Windows (un)support disclaimer](https://github.com/welaika/wordmove/wik
### SSH
* You need `rsync` on your machine; as far as we know it's already installed on OS X and Linux.
* if you want to use your SSH public key for authentication,just delete the `production.ssh.password` field in your `Movefile`. Easy peasy.
* if you want to use your SSH public key for authentication,just delete the `production.ssh.password` field in your `movefile.yml`. Easy peasy.
* writing the password inside the move file was and is somewhat supported, but **we discourage this practice** in favor of password-less authentication with pub key. Read [here](https://github.com/welaika/wordmove/wiki/%5Bdeprecated%5D-SSH-password-inside-Movefile) for old informations.

### FTP
Expand All @@ -137,7 +140,7 @@ FTP support is [planned to be discontinued](https://github.com/welaika/wordmove/

### Multistage

You can define multiple environments in your `Movefile`, such as production, staging, etc.
You can define multiple environments in your `movefile.yml`, such as production, staging, etc.
Use `-e` with `pull` or `push` to run the command on the specified environment.

For example:
Expand Down
2 changes: 1 addition & 1 deletion lib/wordmove/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def __print_version
puts Wordmove::VERSION
end

desc "init", "Generates a brand new Movefile"
desc "init", "Generates a brand new movefile.yml"
def init
Wordmove::Generators::Movefile.start
end
Expand Down
7 changes: 5 additions & 2 deletions lib/wordmove/deployer/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ def extract_available_envs(options)
end

def fetch_movefile(name = nil, start_dir = current_dir)
name ||= "Movefile"
entries = Dir["#{File.join(start_dir, name)}{,.yml}"]
entries = if name.nil?
Dir["#{File.join(start_dir, '{M,m}ovefile')}{,.yml,.yaml}"]
else
Dir["#{File.join(start_dir, name)}{,.yml,.yaml}"]
end

if entries.empty?
raise MovefileNotFound, "Could not find a valid Movefile" if last_dir?(start_dir)
Expand Down
2 changes: 1 addition & 1 deletion lib/wordmove/generators/movefile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def self.source_root
end

def copy_movefile
template "Movefile"
template "movefile.yml"
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ production:
- "tmp/*"
- "Gemfile*"
- "Movefile"
- "movefile"
- "movefile.yml"
- "movefile.yaml"
- "wp-config.php"
- "wp-content/*.sql.gz"

Expand Down
2 changes: 1 addition & 1 deletion lib/wordmove/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Wordmove
VERSION = "2.1.4".freeze
VERSION = "2.2.0".freeze
end
26 changes: 23 additions & 3 deletions spec/deployer/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
context ".fetch_movefile" do
TMPDIR = "/tmp/wordmove".freeze

let(:path) { File.join(TMPDIR, 'Movefile') }
let(:path) { File.join(TMPDIR, 'movefile.yml') }
let(:yaml) { "name: Waldo\njob: Hider" }

before do
Expand Down Expand Up @@ -78,8 +78,28 @@
expect(result['job']).to eq('Hider')
end

context "when Movefile has extensions" do
let(:path) { File.join(TMPDIR, 'Movefile.yml') }
context "when movefile has no extensions" do
let(:path) { File.join(TMPDIR, 'movefile') }

it 'finds it aswell' do
result = described_class.fetch_movefile
expect(result['name']).to eq('Waldo')
expect(result['job']).to eq('Hider')
end
end

context "when Movefile has no extensions and has first capital" do
let(:path) { File.join(TMPDIR, 'Movefile') }

it 'finds it aswell' do
result = described_class.fetch_movefile
expect(result['name']).to eq('Waldo')
expect(result['job']).to eq('Hider')
end
end

context "when movefile.yaml has long extension" do
let(:path) { File.join(TMPDIR, 'movefile.yaml') }

it 'finds it aswell' do
result = described_class.fetch_movefile
Expand Down
2 changes: 1 addition & 1 deletion spec/features/movefile_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe Wordmove::Generators::Movefile do
let(:movefile) { 'Movefile' }
let(:movefile) { 'movefile.yml' }
let(:tmpdir) { "/tmp/wordmove" }

before do
Expand Down
2 changes: 0 additions & 2 deletions spec/fixtures/Movefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@ remote:
password: "password"
host: "host"
port: 30000


10 changes: 4 additions & 6 deletions wordmove.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = "~> 2.4.0"

spec.add_development_dependency "bundler", ">= 1.14.6"
spec.add_development_dependency "bundler", "~> 1.14", ">= 1.14.6"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.3"
spec.add_development_dependency "simplecov", "~> 0.9"
Expand All @@ -45,13 +45,11 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rubocop", "~> 0.49.0"

spec.post_install_message = <<-RAINBOW
Starting from 2.0.0 Wordmove will compress SQL dumps both in remote and locale environments.
If something will broke, please check if gzip executable is present locally and
remotely. We are considering obvious it's installed in any web environment.
Starting from 2.1.0 you'll need to add the global section in your Movefile:
Starting from 2.1.0 you'll need to add the global section in your movefile.yaml:
global:
sql_adapter: "default"
Or you can spawn a new one with `wordmove init` (backup the old one!)
Starting from 2.2.0 the default name of the config file is `movefile.yaml`.
RAINBOW
end

0 comments on commit 67a8ac6

Please sign in to comment.