Extract method
This commit is contained in:
parent
def01cb444
commit
f56cbb5589
17
Rakefile
17
Rakefile
@ -337,14 +337,8 @@ task :setup_github_pages, :repo do |t, args|
|
|||||||
end
|
end
|
||||||
end
|
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 = 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|
|
File.open('_config.yml', 'w') do |f|
|
||||||
f.write jekyll_config
|
f.write jekyll_config
|
||||||
end
|
end
|
||||||
@ -389,6 +383,15 @@ def ask(message, valid_options)
|
|||||||
answer
|
answer
|
||||||
end
|
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"
|
desc "list tasks"
|
||||||
task :list do
|
task :list do
|
||||||
puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).join(', ')}"
|
puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).join(', ')}"
|
||||||
|
Loading…
Reference in New Issue
Block a user