From 4d0a0b1add393b54059c10318b678eae309b9d27 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sat, 20 Apr 2019 14:23:40 +0800 Subject: [PATCH 2/4] Change the grep option/arguments to list up all the markdown files. --- tasks/build.rake | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tasks/build.rake b/tasks/build.rake index 481e3b1..c0db831 100644 --- a/tasks/build.rake +++ b/tasks/build.rake @@ -20,16 +20,16 @@ end desc 'Generate the HTML pages' task :build do - cd 'content/post' do + cd 'content/' do if os == :linux - sh 'grep -l ecx.images-amazon.com *.md | sort | uniq | xargs --no-run-if-empty sed -ie "s/http:\/\/ecx.images-amazon.com/https:\/\/images-na.ssl-images-amazon.com/g"' - sh 'grep -l "http://www.amazon.co.jp/exec" *.md | sort | uniq | xargs --no-run-if-empty sed -i -e "s/http:\/\/www.amazon.co.jp\/exec/https:\/\/www.amazon.co.jp\/exec/g"' + sh 'grep -l -r ecx.images-amazon.com | sort | uniq | xargs --no-run-if-empty sed -ie "s/http:\/\/ecx.images-amazon.com/https:\/\/images-na.ssl-images-amazon.com/g"' + sh 'grep -l -r "http://www.amazon.co.jp/exec" | sort | uniq | xargs --no-run-if-empty sed -i -e "s/http:\/\/www.amazon.co.jp\/exec/https:\/\/www.amazon.co.jp\/exec/g"' else - sh 'grep -l ecx.images-amazon.com *.md | sort | uniq | xargs d -ie "s/http:\/\/ecx.images-amazon.com/https:\/\/images-na.ssl-images-amazon.com/g"' - sh 'grep -l "http://www.amazon.co.jp/exec" *.md | sort | uniq | xargs sed -i -e "s/http:\/\/www.amazon.co.jp\/exec/https:\/\/www.amazon.co.jp\/exec/g"' + sh 'grep -l -r ecx.images-amazon.com | sort | uniq | xargs d -ie "s/http:\/\/ecx.images-amazon.com/https:\/\/images-na.ssl-images-amazon.com/g"' + sh 'grep -l -r "http://www.amazon.co.jp/exec" | sort | uniq | xargs sed -i -e "s/http:\/\/www.amazon.co.jp\/exec/https:\/\/www.amazon.co.jp\/exec/g"' end - sh 'rm *.mde || true' - sh 'rm *.md-e || true' + sh 'find . -type f -name "*.mde" | xargs --no-run-if-empty rm || true' + sh 'find . -type f -name "*.md-e" | xargs --no-run-if-empty rm || true' end cd 'public' do From 82dffcdc730a5f28f5d02757bcb2403c76726600 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sat, 20 Apr 2019 14:26:46 +0800 Subject: [PATCH 3/4] Create the new artcle markdown to be generated under content directory ``` --- a/tasks/new.rake +++ b/tasks/new.rake @@ -6,7 +6,7 @@ task :new do day = Time.now title = ARGV.last.downcase - postname = "post/#{day.year}-#{day.strftime("%m")}-#{day.strftime("%d")}-#{title}.md" + postname = "#{day.year}-#{day.strftime("%m")}-#{day.strftime("%d")}-#{title}.md" # generate the post md file: sh "hugo new #{postname}" ``` --- tasks/new.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/new.rake b/tasks/new.rake index 15d4ed1..4fd0f84 100755 --- a/tasks/new.rake +++ b/tasks/new.rake @@ -6,7 +6,7 @@ task :new do day = Time.now title = ARGV.last.downcase - postname = "post/#{day.year}-#{day.strftime("%m")}-#{day.strftime("%d")}-#{title}.md" + postname = "#{day.year}-#{day.strftime("%m")}-#{day.strftime("%d")}-#{title}.md" # generate the post md file: sh "hugo new #{postname}" From 5b797ab092577dab24a2134abb0285d8ae586024 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sat, 20 Apr 2019 14:27:18 +0800 Subject: [PATCH 4/4] Delete `test.rake` file. --- tasks/test.rake | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 tasks/test.rake diff --git a/tasks/test.rake b/tasks/test.rake deleted file mode 100644 index 2d8d532..0000000 --- a/tasks/test.rake +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env rake - -desc 'test' -task :test do - cd 'content/post' do - sh 'grep -l ecx.images-amazon.com *.md | sort | uniq | xargs sed -ie "s/http:\/\/ecx.images-amazon.com/https:\/\/images-na.ssl-images-amazon.com/g"' - sh 'grep -l "http://www.amazon.co.jp/exec" *.md | sort | uniq | xargs sed -i -e "s/http:\/\/www.amazon.co.jp\/exec/https:\/\/www.amazon.co.jp\/exec/g"' - sh 'rm *.mde || true' - sh 'rm *.md-e || true' - end -end