From f5bb4dd89ea64181910acb8ef0df5ae84644b75d Mon Sep 17 00:00:00 2001 From: erizhang Date: Fri, 31 May 2013 11:19:47 +0800 Subject: add https protocol supporting during rake setup_github_pages --- Rakefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index a57a56f6..b9daf00c 100644 --- a/Rakefile +++ b/Rakefile @@ -305,9 +305,15 @@ task :setup_github_pages, :repo do |t, args| else puts "Enter the read/write url for your repository" puts "(For example, 'git@github.com:your_username/your_username.github.io)" + puts " or 'https://github.com/your_username/your_username.github.io')" repo_url = get_stdin("Repository url: ") end - user = repo_url.match(/:([^\/]+)/)[1] + protocol = (repo_url.match(/(^git)@/).nil?) ? 'https' : 'git' + if protocol == 'git' + user = repo_url.match(/:([^\/]+)/)[1] + else + user = repo_url.match(/github\.com\/([^\/]+)/)[1] + end branch = (repo_url.match(/\/[\w-]+\.github\.(?:io|com)/).nil?) ? 'gh-pages' : 'master' project = (branch == 'gh-pages') ? repo_url.match(/\/([^\.]+)/)[1] : '' unless (`git remote -v` =~ /origin.+?octopress(?:\.git)?/).nil? -- cgit v1.2.1 From bc674751486a2a5d423e6c6a0aa8778da3c73231 Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Sun, 23 Jun 2013 18:05:40 -0500 Subject: Github Pages deployment is now using `git add -A` for compatability with Git 1.8.2+ --- Rakefile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index b9daf00c..f3ada93d 100644 --- a/Rakefile +++ b/Rakefile @@ -247,18 +247,21 @@ end desc "deploy public directory to github pages" multitask :push do puts "## Deploying branch to Github Pages " + puts "## Pulling any updates from Github Pages " + cd "#{deploy_dir}" do + system "git pull" + end (Dir["#{deploy_dir}/*"]).each { |f| rm_rf(f) } Rake::Task[:copydot].invoke(public_dir, deploy_dir) - puts "\n## copying #{public_dir} to #{deploy_dir}" + puts "\n## Copying #{public_dir} to #{deploy_dir}" cp_r "#{public_dir}/.", deploy_dir cd "#{deploy_dir}" do - system "git add ." - system "git add -u" + system "git add -A" puts "\n## Commiting: Site updated at #{Time.now.utc}" message = "Site updated at #{Time.now.utc}" system "git commit -m \"#{message}\"" puts "\n## Pushing generated #{deploy_dir} website" - system "git push origin #{deploy_branch} --force" + system "git push origin #{deploy_branch}" puts "\n## Github Pages deploy complete" end end -- cgit v1.2.1 From def01cb4441a08a4dca4b4be4d44c8684857f648 Mon Sep 17 00:00:00 2001 From: Rob Slifka Date: Wed, 21 Aug 2013 16:42:03 -0700 Subject: Use source/CNAME (if it exists) to set _config.yml url property --- Rakefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index f3ada93d..f16a5f40 100644 --- a/Rakefile +++ b/Rakefile @@ -337,7 +337,11 @@ task :setup_github_pages, :repo do |t, args| end end end - url = "http://#{user}.github.io" + url = if File.exists?('source/CNAME') + "http://#{IO.read('source/CNAME').strip}" + else + "http://#{user}.github.io" + end url += "/#{project}" unless project == '' jekyll_config = IO.read('_config.yml') jekyll_config.sub!(/^url:.*$/, "url: #{url}") -- cgit v1.2.1 From f56cbb55891c9214d66a9eaace4120d0901c62b4 Mon Sep 17 00:00:00 2001 From: Rob Slifka Date: Wed, 21 Aug 2013 20:58:45 -0700 Subject: Extract method --- Rakefile | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index f16a5f40..8e07281a 100644 --- a/Rakefile +++ b/Rakefile @@ -337,14 +337,8 @@ task :setup_github_pages, :repo do |t, args| end end end - url = if File.exists?('source/CNAME') - "http://#{IO.read('source/CNAME').strip}" - else - "http://#{user}.github.io" - end - url += "/#{project}" unless project == '' jekyll_config = IO.read('_config.yml') - jekyll_config.sub!(/^url:.*$/, "url: #{url}") + jekyll_config.sub!(/^url:.*$/, "url: #{blog_url(user,project)}") File.open('_config.yml', 'w') do |f| f.write jekyll_config end @@ -389,6 +383,15 @@ def ask(message, valid_options) answer end +def blog_url(user, project) + url = if File.exists?('source/CNAME') + "http://#{IO.read('source/CNAME').strip}" + else + "http://#{user}.github.io" + end + url += "/#{project}" unless project == '' +end + desc "list tasks" task :list do puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).join(', ')}" -- cgit v1.2.1 From 7f19c78cd53369cac01c1b107e9147c72de6d22a Mon Sep 17 00:00:00 2001 From: Rob Slifka Date: Thu, 22 Aug 2013 22:01:41 -0700 Subject: Improved readability --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index 8e07281a..ce6ba4ad 100644 --- a/Rakefile +++ b/Rakefile @@ -338,7 +338,7 @@ task :setup_github_pages, :repo do |t, args| end end jekyll_config = IO.read('_config.yml') - jekyll_config.sub!(/^url:.*$/, "url: #{blog_url(user,project)}") + jekyll_config.sub!(/^url:.*$/, "url: #{blog_url(user, project)}") File.open('_config.yml', 'w') do |f| f.write jekyll_config end -- cgit v1.2.1 From 77dc6a1ccf7ffb67ecbaecd9fd612ebdd7906d72 Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Fri, 23 Aug 2013 14:07:42 -0500 Subject: Fixed setup_github_pages success message. #1328 --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index ce6ba4ad..402d2728 100644 --- a/Rakefile +++ b/Rakefile @@ -358,7 +358,7 @@ task :setup_github_pages, :repo do |t, args| f.write rakefile end end - puts "\n---\n## Now you can deploy to #{url} with `rake deploy` ##" + puts "\n---\n## Now you can deploy to #{repo_url} with `rake deploy` ##" end def ok_failed(condition) -- cgit v1.2.1 From a604dce25826ab31846064f9799f0c0e8197dac4 Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Fri, 23 Aug 2013 15:03:57 -0500 Subject: Fixed blog_url for personal github pages projects. #1328 --- Rakefile | 1 + 1 file changed, 1 insertion(+) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index 402d2728..d7a6931a 100644 --- a/Rakefile +++ b/Rakefile @@ -390,6 +390,7 @@ def blog_url(user, project) "http://#{user}.github.io" end url += "/#{project}" unless project == '' + url end desc "list tasks" -- cgit v1.2.1 From d7a4bf5fc0c35f461c0d75796070203376d1b538 Mon Sep 17 00:00:00 2001 From: nagimov Date: Fri, 20 Sep 2013 02:17:07 +0600 Subject: ".git" added to sample string with SSH repository URL Octopress does not work with a repo URL like a "git@github.com:your_username/your_username.github.io" ("ERROR: repository not found" error appears). It is necessary to add ".git" to the end of this line. --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index d7a6931a..0d5ec3b5 100644 --- a/Rakefile +++ b/Rakefile @@ -307,7 +307,7 @@ task :setup_github_pages, :repo do |t, args| repo_url = args.repo else puts "Enter the read/write url for your repository" - puts "(For example, 'git@github.com:your_username/your_username.github.io)" + puts "(For example, 'git@github.com:your_username/your_username.github.io.git)" puts " or 'https://github.com/your_username/your_username.github.io')" repo_url = get_stdin("Repository url: ") end -- cgit v1.2.1