Skip to content

Commit

Permalink
add editorconfig and update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
miya0001 committed Oct 13, 2015
1 parent 2be12d7 commit 44bbaee
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 20 deletions.
41 changes: 23 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,39 @@ GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.2.5)
multi_json (1.10.1)
multi_json (1.11.2)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (2.9.2)
net-telnet (0.1.1)
rake (10.4.2)
rspec (3.1.0)
rspec-core (~> 3.1.0)
rspec-expectations (~> 3.1.0)
rspec-mocks (~> 3.1.0)
rspec-core (3.1.7)
rspec-support (~> 3.1.0)
rspec-expectations (3.1.2)
rspec (3.3.0)
rspec-core (~> 3.3.0)
rspec-expectations (~> 3.3.0)
rspec-mocks (~> 3.3.0)
rspec-core (3.3.2)
rspec-support (~> 3.3.0)
rspec-expectations (3.3.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.1.0)
rspec-its (1.1.0)
rspec-support (~> 3.3.0)
rspec-its (1.2.0)
rspec-core (>= 3.0.0)
rspec-expectations (>= 3.0.0)
rspec-mocks (3.1.3)
rspec-support (~> 3.1.0)
rspec-support (3.1.2)
serverspec (2.7.2)
rspec-mocks (3.3.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.3.0)
rspec-support (3.3.0)
serverspec (2.24.1)
multi_json
rspec (~> 3.0)
rspec-its
specinfra (~> 2.10)
specinfra (2.11.8)
specinfra (~> 2.43)
sfl (2.2)
specinfra (2.44.0)
net-scp
net-ssh
net-ssh (~> 2.7)
net-telnet
sfl

PLATFORMS
ruby
Expand All @@ -39,4 +44,4 @@ DEPENDENCIES
serverspec

BUNDLED WITH
1.10.3
1.10.6
8 changes: 8 additions & 0 deletions provision/site-cookbooks/wpcli/recipes/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,11 @@
EOH
notifies :restart, "service[apache2]"
end

template File.join( node[:wpcli][:wp_docroot], ".editorconfig" ) do
source "editorconfig.erb"
owner node[:wpcli][:user]
group node[:wpcli][:group]
mode "0644"
action :create_if_missing
end
21 changes: 21 additions & 0 deletions provision/site-cookbooks/wpcli/templates/default/editorconfig.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[{.jshintrc,*.json,*.yml}]
indent_style = space
indent_size = 2

[{*.txt,wp-config-sample.php}]
end_of_line = crlf
6 changes: 6 additions & 0 deletions spec/default/wp-cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,9 @@
it { should be_file }
it { should be_owned_by $conf['user'] }
end

describe file(File.join($conf['document_root'], '.editorconfig')) do
let(:disable_sudo) { true }
it { should be_file }
it { should be_owned_by $conf['user'] }
end
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
host = $conf['hostname']

config = Tempfile.new('', Dir.tmpdir)
`vagrant ssh-config #{host} > #{config.path}`
`unset RUBYLIB; vagrant ssh-config #{host} > #{config.path}`

options = Net::SSH::Config.for(host, [config.path])

puts options.to_s
set :host, host
set :ssh_options, options

0 comments on commit 44bbaee

Please sign in to comment.