From 664160828319e4d80e1ae15bfa976af2b46be027 Mon Sep 17 00:00:00 2001 From: rcmdnk Date: Sun, 17 Sep 2023 06:38:14 +0000 Subject: [PATCH] fix patches, config --- _config.yml | 4 +- patches/Gemfile.patch | 2 +- patches/Rakefile.patch | 93 +++++++++++++++++++------------------ patches/_config.yml.patch | 7 ++- source/_includes/async.html | 8 ---- 5 files changed, 54 insertions(+), 60 deletions(-) diff --git a/_config.yml b/_config.yml index 7074c5f..26d3572 100644 --- a/_config.yml +++ b/_config.yml @@ -50,7 +50,6 @@ aboutme_marks: false # jQuery jquery_version: 3.7.0 -jquery_ie8_version: 1.9.1 # Font Awesome fontawesome_version: 4.7.0 @@ -316,8 +315,7 @@ userlocal: # page-view settings (need service account private key file (key_file). ref: https://github.com/developmentseed/jekyll-ga) page-view: - credential: - key_file: # service account private key file (Analytics-XXXXXXXXXXXX.p12) + credential: # service account credential json file property_id: # Analytics property id (XXXXXXXX) start: # Beginning of report - 30daysAgo diff --git a/patches/Gemfile.patch b/patches/Gemfile.patch index ceb130d..f1da4dc 100644 --- a/patches/Gemfile.patch +++ b/patches/Gemfile.patch @@ -1,5 +1,5 @@ diff --git a/Gemfile b/Gemfile -index 5683812..066ef1f 100644 +index 5683812..5d6ceb3 100644 --- a/Gemfile +++ b/Gemfile @@ -1,18 +1,25 @@ diff --git a/patches/Rakefile.patch b/patches/Rakefile.patch index 49c5860..046773f 100644 --- a/patches/Rakefile.patch +++ b/patches/Rakefile.patch @@ -1,5 +1,7 @@ ---- Rakefile.orig 2022-08-06 01:52:04.902606200 +0900 -+++ Rakefile 2022-08-06 02:06:44.542606200 +0900 +diff --git a/Rakefile b/Rakefile +index 9367ea1..bd0ca80 100644 +--- a/Rakefile ++++ b/Rakefile @@ -1,6 +1,8 @@ require "rubygems" require "bundler/setup" @@ -9,7 +11,7 @@ ## -- Rsync Deploy config -- ## # Be sure your public key is listed in your server's ~/.ssh/authorized_keys file -@@ -9,27 +11,45 @@ +@@ -9,27 +11,45 @@ ssh_port = "22" document_root = "~/website.com/" rsync_delete = false rsync_args = "" # Any extra arguments to pass to rsync @@ -60,13 +62,15 @@ end desc "Initial setup for Octopress: copies the default theme into the path of Jekyll's generator. Rake install defaults to rake install[classic] to install a different theme run rake install[some_theme_name]" -@@ -52,47 +72,192 @@ +@@ -52,47 +72,192 @@ end # Working with Jekyll # ####################### +-desc "Generate jekyll site" +-task :generate do +desc "Update stylesheets. Give an argument as nested, expanded, compact or compressed (default) to the output style." +task :css, :style do |t, args| -+ raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir) + raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir) + puts "## Update stylesheets" + style = minify ? "-s compressed" : "-s nested" + if args.style @@ -76,10 +80,9 @@ + cp_r "#{source_dir}/stylesheets/.", "#{public_dir}/stylesheets/" +end + - desc "Generate jekyll site" --task :generate do ++desc "Generate jekyll site" +task :generate, :opt do |t, args| - raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir) ++ raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir) + + opt = args.opt ? args.opt : "" + @@ -262,7 +265,7 @@ # usage rake new_post[my-new-post] or rake new_post['my new post'] or rake new_post (defaults to "new-post") desc "Begin a new post in #{source_dir}/#{posts_dir}" task :new_post, :title do |t, args| -@@ -102,20 +267,39 @@ +@@ -102,20 +267,39 @@ task :new_post, :title do |t, args| title = get_stdin("Enter a title for your post: ") end raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir) @@ -305,7 +308,7 @@ end end -@@ -125,8 +309,10 @@ +@@ -125,8 +309,10 @@ task :new_page, :filename do |t, args| raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir) args.with_defaults(:filename => 'new-page') page_dir = [source_dir] @@ -317,7 +320,7 @@ title = filename page_dir.concat($1.downcase.sub(/^\//, '').split('/')) unless $1.nil? # Add path to page_dir Array if extension.nil? -@@ -147,10 +333,13 @@ +@@ -147,10 +333,13 @@ task :new_page, :filename do |t, args| page.puts "---" page.puts "layout: page" page.puts "title: \"#{title}\"" @@ -332,7 +335,7 @@ page.puts "---" end else -@@ -161,21 +350,49 @@ +@@ -161,21 +350,49 @@ end # usage rake isolate[my-post] desc "Move all other posts than the one currently being worked on to a temporary stash location (stash) so regenerating the site happens much more quickly." task :isolate, :filename do |t, args| @@ -344,12 +347,12 @@ + filename = args.filename + else + filename = Dir.glob("#{source_dir}/#{posts_dir}/*.#{new_post_ext}").sort_by{|f| File.mtime(f)}.last -+ end + end + if filename == nil + puts "## Stashing all posts" + else + puts "## Stashing other posts than #{filename}" - end ++ end + FileUtils.mkdir(full_stash_dir) unless File.exist?(full_stash_dir) + Dir.glob("#{source_dir}/#{posts_dir}/*") do |post| + if filename != nil && post.include?(filename) @@ -389,7 +392,7 @@ end desc "Move sass to sass.old, install sass theme updates, replace sass/custom with sass.old/custom" -@@ -215,8 +432,14 @@ +@@ -215,8 +432,14 @@ end ############## desc "Default deploy task" @@ -406,7 +409,7 @@ if File.exists?(".preview-mode") puts "## Found posts in preview mode, regenerating files ..." File.delete(".preview-mode") -@@ -224,11 +447,32 @@ +@@ -224,11 +447,32 @@ task :deploy do end Rake::Task[:copydot].invoke(source_dir, public_dir) @@ -441,7 +444,7 @@ end desc "copy dot files for deployment" -@@ -245,74 +489,105 @@ +@@ -245,74 +489,105 @@ task :rsync do exclude = "--exclude-from '#{File.expand_path('./rsync-exclude')}'" end puts "## Deploying website via Rsync" @@ -469,7 +472,8 @@ puts "\n## Committing: #{message}" - system "git commit -m \"#{message}\"" + ok_failed("git commit -m \"#{message}\"") -+ puts "\n## Pushing generated #{deploy_dir} website" + puts "\n## Pushing generated #{deploy_dir} website" +- Bundler.with_clean_env { system "git push origin #{deploy_branch}" } + output = (use_token)? " >/dev/null 2>&1":"" + Bundler.with_original_env { ok_failed("git push origin #{deploy_branch} #{output}") } + puts "\n## Github Pages deploy complete" @@ -500,8 +504,7 @@ + message = "Site updated at #{Time.now.utc}" + ok_failed("git commit -m \"#{message}\" >/dev/null") + ok_failed("git branch -m #{deploy_branch}") - puts "\n## Pushing generated #{deploy_dir} website" -- Bundler.with_clean_env { system "git push origin #{deploy_branch}" } ++ puts "\n## Pushing generated #{deploy_dir} website" + output = (use_token) ? " >/dev/null 2>&1" : "" + Bundler.with_unbundled_env { ok_failed("git push -u -f origin #{deploy_branch} #{output}") } puts "\n## Github Pages deploy complete" @@ -570,7 +573,7 @@ repo_url = get_stdin("Repository url: ") end protocol = (repo_url.match(/(^git)@/).nil?) ? 'https' : 'git' -@@ -322,23 +597,25 @@ +@@ -322,23 +597,25 @@ task :setup_github_pages, :repo do |t, args| user = repo_url.match(/github\.com\/([^\/]+)/)[1] end branch = (repo_url.match(/\/[\w-]+\.github\.(?:io|com)/).nil?) ? 'gh-pages' : 'master' @@ -588,25 +591,26 @@ - system "git remote add origin #{repo_url}" - puts "Added remote #{repo_url} as origin" - system "git config branch.master.remote origin" +- puts "Set origin as default remote" +- system "git branch -m master source" +- puts "Master branch renamed to 'source' for committing your blog source files" +- else +- unless !public_dir.match("#{project}").nil? +- system "rake set_root_dir[#{project}]" + ok_failed("git remote add origin #{repo_url}") + if use_token + puts "Added given remote as origin" + else + puts "Added remote #{repo_url} as origin" -+ end + end + ok_failed("git config branch.master.remote origin") - puts "Set origin as default remote" -- system "git branch -m master source" ++ puts "Set origin as default remote" + ok_failed("git branch -m master source") - puts "Master branch renamed to 'source' for committing your blog source files" -- else -- unless !public_dir.match("#{project}").nil? -- system "rake set_root_dir[#{project}]" -- end ++ puts "Master branch renamed to 'source' for committing your blog source files" end end url = blog_url(user, project, source_dir) -@@ -347,31 +624,56 @@ +@@ -347,31 +624,56 @@ task :setup_github_pages, :repo do |t, args| File.open('_config.yml', 'w') do |f| f.write jekyll_config end @@ -624,7 +628,6 @@ - rakefile.sub!(/deploy_default(\s*)=(\s*)(["'])[\w-]*["']/, "deploy_default\\1=\\2\\3push\\3") - File.open(__FILE__, 'w') do |f| - f.write rakefile -- end + + rakefile = IO.read(__FILE__) + rakefile.sub!(/deploy_branch(\s*)=(\s*)(["'])[\w-]*["']/, "deploy_branch\\1=\\2\\3#{branch}\\3") @@ -634,15 +637,10 @@ + ext = 'markdown' + if ask("Do you want to use 'md' extension instead of 'markdown'?", ['y', 'n'], args.yes) == "y" + ext = 'md' - end -- puts "\n---\n## Now you can deploy to #{repo_url} with `rake deploy` ##" --end ++ end + rakefile.sub!(/new_post_ext(\s*)=(\s*)(["'])[\w-]*["']/, "new_post_ext\\1=\\2\\3#{ext}\\3") + rakefile.sub!(/new_page_ext(\s*)=(\s*)(["'])[\w-]*["']/, "new_page_ext\\1=\\2\\3#{ext}\\3") - --def ok_failed(condition) -- if (condition) -- puts "OK" ++ + if ask("Do you want to push_ex (renew remote repository evrey time)?", ['y', 'n'], args.yes) == 'y' + if yn_check(args.yes) == "y" + dir = "" @@ -658,8 +656,7 @@ + end + rakefile.sub!(/deploy_default(\s*)=(\s*)(["'])[\w-]*["']/, "deploy_default\\1=\\2\\3push_ex\\3") + rakefile.sub!(/(tmp_dir\s*=\s*File.expand_path\()(["'])[^"']*["']/,"\\1\\2#{dir}\\2") - else -- puts "FAILED" ++ else + rm_rf deploy_dir + mkdir deploy_dir + cd "#{deploy_dir}" do @@ -675,8 +672,16 @@ + puts "\n---\n## Now you can deploy with `rake deploy` ##" + else + puts "\n---\n## Now you can deploy to #{repo_url} with `rake deploy` ##" -+ end -+ end + end + end +- puts "\n---\n## Now you can deploy to #{repo_url} with `rake deploy` ##" +-end +- +-def ok_failed(condition) +- if (condition) +- puts "OK" +- else +- puts "FAILED" + File.open(__FILE__, 'w') do |f| + f.write rakefile end @@ -684,7 +689,7 @@ end def get_stdin(message) -@@ -379,9 +681,22 @@ +@@ -379,9 +681,22 @@ def get_stdin(message) STDIN.gets.chomp end @@ -709,7 +714,7 @@ else answer = get_stdin(message) end -@@ -404,3 +719,336 @@ +@@ -404,3 +719,336 @@ task :list do puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).join(', ')}" puts "(type rake -T for more detail)\n\n" end diff --git a/patches/_config.yml.patch b/patches/_config.yml.patch index 8ebc4e8..eeb3546 100644 --- a/patches/_config.yml.patch +++ b/patches/_config.yml.patch @@ -1,5 +1,5 @@ diff --git a/_config.yml b/_config.yml -index c1d56f4..d6d2191 100644 +index c1d56f4..26d3572 100644 --- a/_config.yml +++ b/_config.yml @@ -2,24 +2,57 @@ @@ -242,7 +242,7 @@ index c1d56f4..d6d2191 100644 # Disqus Comments disqus_short_name: -@@ -99,3 +220,177 @@ google_analytics_tracking_id: +@@ -99,3 +220,172 @@ google_analytics_tracking_id: # Facebook Like facebook_like: false @@ -341,8 +341,7 @@ index c1d56f4..d6d2191 100644 + +# page-view settings (need service account private key file (key_file). ref: https://github.com/developmentseed/jekyll-ga) +page-view: -+ credential: -+ key_file: # service account private key file (Analytics-XXXXXXXXXXXX.p12) ++ credential: # service account credential json file + property_id: # Analytics property id (XXXXXXXX) + start: # Beginning of report + - 30daysAgo diff --git a/source/_includes/async.html b/source/_includes/async.html index bd72307..f3dedfd 100644 --- a/source/_includes/async.html +++ b/source/_includes/async.html @@ -160,16 +160,8 @@ {% endif %} {% if page.math %}{% endif %}} -{% comment %}jQuery{% endcomment %} -{% if site.jquery_ie8_version %} - - {% endif %} {% if site.jquery_version %} - - {% endif %} {% comment %}