You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@whimsical.apache.org by Sam Ruby <ru...@intertwingly.net> on 2019/11/30 18:24:06 UTC
Re: [whimsy] branch master updated: Add conditional mkdir method
Consider using:
https://docs.ruby-lang.org/en/2.6.0/FileUtils.html#method-i-mkdir_p
- Sam Ruby
On Sat, Nov 30, 2019 at 1:09 PM <se...@apache.org> wrote:
>
> This is an automated email from the ASF dual-hosted git repository.
>
> sebb pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/whimsy.git
>
>
> The following commit(s) were added to refs/heads/master by this push:
> new 9a498da Add conditional mkdir method
> 9a498da is described below
>
> commit 9a498daad2fea57a489c1637854fa9cd694fa7ce
> Author: Sebb <se...@apache.org>
> AuthorDate: Sat Nov 30 18:08:59 2019 +0000
>
> Add conditional mkdir method
> ---
> Rakefile | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/Rakefile b/Rakefile
> index 4eb9845..b9e1437 100644
> --- a/Rakefile
> +++ b/Rakefile
> @@ -6,6 +6,10 @@ Gem::PackageTask.new(spec) do |pkg|
> pkg.gem_spec = spec
> end
>
> +def mkdir_p?(path)
> + mkdir_p path unless Dir.exist? path
> +end
> +
> # update gems and restart applications as needed
> task :update, [:command] do |task, args|
> # determine last update time of library sources
> @@ -93,7 +97,7 @@ namespace :svn do
> svn = ASF::Config.get(:svn)
> svn = Array(svn).find {|path| String === path and path.end_with? '/*'}
> if svn.instance_of? String and svn.end_with? '/*'
> - mkdir_p File.dirname(svn) unless Dir.exists? File.dirname(svn)
> + mkdir_p? File.dirname(svn)
> Dir.chdir File.dirname(svn) do
> svnrepos.each do |name, description|
> puts
> @@ -231,7 +235,7 @@ namespace :git do
> # clone/pull git repositories
> git = ASF::Config.get(:git)
> if git.instance_of? String and git.end_with? '/*'
> - mkdir_p File.dirname(git) unless Dir.exists? File.dirname(git)
> + mkdir_p File.dirname(git)
> Dir.chdir File.dirname(git) do
> require 'uri'
> base = URI.parse('git://git.apache.org/')
> @@ -330,8 +334,11 @@ namespace :docker do
> end
> end
>
> - mkdir_p '/srv/whimsy/www' unless Dir.exist? '/srv/whimsy/www'
> - mkdir_p '/srv/whimsy/members' unless Dir.exist? '/srv/whimsy/members'
> + mkdir_p? '/srv/whimsy/www'
> + mkdir_p? '/srv/whimsy/members'
> +
> + mkdir_p? '/srv/cache'
> + mkdir_p? '/srv/mail/secretary'
>
> unless File.exist? '/srv/whimsy/www/members/log'
> ln_s '/var/log/apache2', '/srv/whimsy/www/members/log'
>