octopress 3.0.0.alpha2 → 3.0.0.alpha3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +6 -14
  2. data/.gitignore +15 -18
  3. data/Gemfile +3 -1
  4. data/LICENSE +20 -0
  5. data/README.md +66 -0
  6. data/Rakefile +1 -76
  7. data/bin/octopress +14 -58
  8. data/lib/octopress.rb +40 -79
  9. data/lib/octopress/command.rb +10 -4
  10. data/lib/octopress/commands/new.rb +50 -12
  11. data/lib/octopress/commands/publish.rb +18 -0
  12. data/lib/octopress/core_ext.rb +1 -0
  13. data/lib/octopress/draft.rb +43 -0
  14. data/lib/octopress/page.rb +109 -0
  15. data/lib/octopress/post.rb +30 -0
  16. data/lib/octopress/version.rb +1 -1
  17. data/octopress.gemspec +7 -32
  18. metadata +31 -437
  19. data/.editorconfig +0 -22
  20. data/.gitattributes +0 -1
  21. data/.powrc +0 -4
  22. data/.rspec +0 -5
  23. data/.rubocop.yml +0 -119
  24. data/.slugignore +0 -3
  25. data/.travis.yml +0 -6
  26. data/CHANGELOG.markdown +0 -46
  27. data/CONTRIBUTING.markdown +0 -17
  28. data/README.markdown +0 -37
  29. data/lib/console +0 -17
  30. data/lib/guard/jekyll.rb +0 -33
  31. data/lib/octopress/commands.rb +0 -14
  32. data/lib/octopress/commands/build.rb +0 -17
  33. data/lib/octopress/commands/build_javascripts.rb +0 -11
  34. data/lib/octopress/commands/build_jekyll.rb +0 -42
  35. data/lib/octopress/commands/build_stylesheets.rb +0 -13
  36. data/lib/octopress/commands/install.rb +0 -44
  37. data/lib/octopress/commands/scaffold.rb +0 -102
  38. data/lib/octopress/commands/serve.rb +0 -25
  39. data/lib/octopress/configuration.rb +0 -237
  40. data/lib/octopress/dependency_installer.rb +0 -287
  41. data/lib/octopress/errors.rb +0 -3
  42. data/lib/octopress/filters/content.rb +0 -66
  43. data/lib/octopress/filters/date.rb +0 -46
  44. data/lib/octopress/filters/post.rb +0 -175
  45. data/lib/octopress/filters/url.rb +0 -34
  46. data/lib/octopress/formatters.rb +0 -9
  47. data/lib/octopress/formatters/base_formatter.rb +0 -17
  48. data/lib/octopress/formatters/simple_formatter.rb +0 -9
  49. data/lib/octopress/formatters/verbose_formatter.rb +0 -9
  50. data/lib/octopress/generators/category_generator.rb +0 -196
  51. data/lib/octopress/generators/sitemap_generator.rb +0 -308
  52. data/lib/octopress/guardfile +0 -43
  53. data/lib/octopress/helpers/titlecase.rb +0 -37
  54. data/lib/octopress/ink.rb +0 -12
  55. data/lib/octopress/inquirable_string.rb +0 -12
  56. data/lib/octopress/installer.rb +0 -96
  57. data/lib/octopress/js_assets_manager.rb +0 -97
  58. data/lib/octopress/liquid_helpers/conditional.rb +0 -36
  59. data/lib/octopress/liquid_helpers/config.rb +0 -58
  60. data/lib/octopress/liquid_helpers/include.rb +0 -33
  61. data/lib/octopress/liquid_helpers/url.rb +0 -29
  62. data/lib/octopress/liquid_helpers/vars.rb +0 -30
  63. data/lib/octopress/plugin.rb +0 -33
  64. data/lib/octopress/rake.rb +0 -16
  65. data/lib/octopress/scaffold/.gitignore +0 -18
  66. data/lib/octopress/scaffold/site/Gemfile +0 -3
  67. data/lib/octopress/scaffold/site/config.ru +0 -25
  68. data/lib/octopress/scaffold/site/config/compass.rb +0 -27
  69. data/lib/octopress/scaffold/site/config/rack.rb +0 -25
  70. data/lib/octopress/scaffold/site/config/site.yml +0 -0
  71. data/lib/octopress/scaffold/site/javascripts/lib/ios-rotate-scaling-fix.js +0 -19
  72. data/lib/octopress/scaffold/site/javascripts/lib/jquery-1.9.1.js +0 -9598
  73. data/lib/octopress/scaffold/site/javascripts/lib/jquery.cookie.js +0 -93
  74. data/lib/octopress/scaffold/site/stylesheets/_config.scss +0 -1
  75. data/lib/octopress/scaffold/site/stylesheets/_style.scss +0 -1
  76. data/lib/octopress/scaffold/site/stylesheets/site.scss +0 -16
  77. data/lib/octopress/tags/assign.rb +0 -34
  78. data/lib/octopress/tags/capture.rb +0 -31
  79. data/lib/octopress/tags/config-tag.rb +0 -23
  80. data/lib/octopress/tags/include.rb +0 -63
  81. data/lib/octopress/tags/js-assets.rb +0 -23
  82. data/lib/octopress/tags/puts.rb +0 -39
  83. data/lib/octopress/tags/render-partial.rb +0 -89
  84. data/lib/octopress/tags/return.rb +0 -21
  85. data/lib/rake/clean.rake +0 -8
  86. data/lib/rake/clobber.rake +0 -5
  87. data/lib/rake/console.rake +0 -5
  88. data/lib/rake/deploy.rake +0 -4
  89. data/lib/rake/gen_deploy.rake +0 -2
  90. data/lib/rake/generate.rake +0 -4
  91. data/lib/rake/generate_only.rake +0 -14
  92. data/lib/rake/hygiene.rake +0 -29
  93. data/lib/rake/install.rake +0 -8
  94. data/lib/rake/integrate.rake +0 -4
  95. data/lib/rake/isolate.rake +0 -13
  96. data/lib/rake/list_drafts.rake +0 -7
  97. data/lib/rake/new.rake +0 -7
  98. data/lib/rake/new_page.rake +0 -49
  99. data/lib/rake/new_post.rake +0 -32
  100. data/lib/rake/nuke.rake +0 -4
  101. data/lib/rake/preview.rake +0 -4
  102. data/lib/rake/push.rake +0 -37
  103. data/lib/rake/rsync.rake +0 -20
  104. data/lib/rake/set_root_dir.rake +0 -35
  105. data/lib/rake/setup_github_pages.rake +0 -115
  106. data/lib/rake/watch.rake +0 -11
  107. data/lib/scaffold/Rakefile +0 -142
  108. data/lib/scaffold/plugin-name.gemspec +0 -43
  109. data/lib/spec/fixtures/env/defaults/classic.yml +0 -2
  110. data/lib/spec/fixtures/no_override/defaults/classic.yml +0 -11
  111. data/lib/spec/fixtures/override/defaults/classic.yml +0 -11
  112. data/lib/spec/fixtures/override/site.yml +0 -11
  113. data/lib/spec/octopress/configuration_spec.rb +0 -67
  114. data/lib/spec/octopress/dependency_installer_spec.rb +0 -66
  115. data/lib/spec/octopress/ink_spec.rb +0 -10
  116. data/lib/spec/octopress/octopress_spec.rb +0 -97
  117. data/lib/spec/spec_helper.rb +0 -22
  118. data/lib/spec/support/env.rb +0 -36
  119. data/lib/spec/support/simplecov.rb +0 -52
data/lib/rake/clean.rake DELETED
@@ -1,8 +0,0 @@
1
- desc "Clean out caches: .pygments-cache, .gist-cache, .sass-cache, and Compass-generated files."
2
- task :clean do
3
- rm_rf [".pygments-cache", ".gist-cache", File.join(Octopress.configuration[:source], "javascripts", "build")]
4
- if Dir.exists? "stylesheets"
5
- system "compass clean"
6
- puts "## Cleaned Compass-generated files, and various caches ##"
7
- end
8
- end
@@ -1,5 +0,0 @@
1
- desc "Remove generated files (#{Octopress.configuration[:destination]} directory)."
2
- task :clobber do
3
- rm_rf [Octopress.configuration[:destination]]
4
- puts "## Cleaned generated site in #{Octopress.configuration[:destination]} ##"
5
- end
@@ -1,5 +0,0 @@
1
- desc "Open Octopress console"
2
- task :console do
3
- prompt = `which pry`.strip.empty? ? "irb" : "pry"
4
- sh "#{prompt} -r./lib/octopress.rb", verbose: false
5
- end
data/lib/rake/deploy.rake DELETED
@@ -1,4 +0,0 @@
1
- desc "Default deploy task"
2
- task :deploy do
3
- Rake::Task["#{Octopress.configuration[:deploy_default]}"].execute
4
- end
@@ -1,2 +0,0 @@
1
- desc "Generate website and deploy"
2
- task :gen_deploy => [:integrate, :generate, :deploy]
@@ -1,4 +0,0 @@
1
- desc "Generate Jekyll site"
2
- task :generate do
3
- Octopress::Commands::Build.process(nil, nil)
4
- end
@@ -1,14 +0,0 @@
1
- # usage rake generate_only[my-post]
2
- desc "Generate only the specified post (much faster)"
3
- task :generate_only, :filename do |t, args|
4
- if args.filename
5
- filename = args.filename
6
- else
7
- filename = get_stdin("Enter a post file name: ")
8
- end
9
- puts "## Stashing other posts"
10
- Rake::Task["isolate"].invoke(filename)
11
- Rake::Task["generate"].execute
12
- puts "## Restoring stashed posts"
13
- Rake::Task["integrate"].execute
14
- end
@@ -1,29 +0,0 @@
1
- namespace :hygiene do
2
- desc "Tidy up whitespace in all non-vendored files."
3
- task :whitespace do
4
- FileList[
5
- "lib/**/*.{rb,rake,ru,feature,yml,md,markdown}",
6
- "{Gemfile,Rakefile,*.md,*.markdown,*.ru,*.rb,.powrc,.rspec,.travis.yml,.slugignore,.gitignore,.gitattributes,.editorconfig}"
7
- ].each do |fname|
8
- next if(File.directory?(fname))
9
- printf "Processing #{fname}..."
10
- raw_contents = File.read(fname)
11
- new_contents = raw_contents.
12
- rstrip. # Strip ALL trailing newlines.
13
- split(/\n/). # Now look at it per-line...
14
- map(&:rstrip). # ... strip trailing WS per-line.
15
- join("\n") + # Now put it back together into one string.
16
- "\n" # And ensure EXACTLY one trailing newline.
17
- if(raw_contents != new_contents)
18
- printf " Cleaned!"
19
- File.open(fname, "w") { |fh| fh.write(new_contents) }
20
- end
21
- printf "\n"
22
- end
23
- end
24
-
25
- desc "Run the Rubocop static analyzer against Cthulhu."
26
- task :rubocop do
27
- sh 'rubocop -d Rakefile Gemfile lib'
28
- end
29
- end
@@ -1,8 +0,0 @@
1
- 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]"
2
- task :install, :plugin do |t, args|
3
- plugin = args.plugin
4
- if plugin.nil? || plugin == ""
5
- plugin = "classic-theme"
6
- end
7
- Octopress::DependencyInstaller.install_all(plugin)
8
- end
@@ -1,4 +0,0 @@
1
- desc "Move all stashed posts back into the posts directory, ready for site generation."
2
- task :integrate do
3
- FileUtils.mv Dir.glob("#{full_stash_dir}/*.*"), "#{Octopress.configuration[:source]}/#{Octopress.configuration[:posts_dir]}/"
4
- end
@@ -1,13 +0,0 @@
1
- # usage rake isolate[my-post]
2
- 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."
3
- task :isolate, :filename do |t, args|
4
- if args.filename
5
- filename = args.filename
6
- else
7
- filename = get_stdin("Enter a post file name: ")
8
- end
9
- FileUtils.mkdir(full_stash_dir) unless File.exist?(full_stash_dir)
10
- Dir.glob("#{Octopress.configuration[:source]}/#{Octopress.configuration[:posts_dir]}/*.*") do |post|
11
- FileUtils.mv post, full_stash_dir unless post.include?(filename)
12
- end
13
- end
@@ -1,7 +0,0 @@
1
- # usage rake list_posts or rake list_posts[pub|unpub]
2
- desc "List all unpublished/draft posts"
3
- task :list_drafts do
4
- posts = Dir.glob("#{Octopress.configuration[:source]}/#{Octopress.configuration[:posts_dir]}/*.*")
5
- unpublished = get_unpublished(posts)
6
- puts unpublished.empty? ? "There are no posts currently in draft" : unpublished
7
- end
data/lib/rake/new.rake DELETED
@@ -1,7 +0,0 @@
1
- task :install, :plugin do |t, args|
2
- plugin = args.plugin
3
- if plugin.nil? || plugin == ""
4
- plugin = "classic-theme"
5
- end
6
- Octopress::DependencyInstaller.install_all(plugin)
7
- end
@@ -1,49 +0,0 @@
1
- # usage rake new_page[my-new-page] or rake new_page[my-new-page.html] or rake new_page (defaults to "new-page/index.html")
2
- desc "Create a new page in #{Octopress.configuration[:source]}/(filename)/index.#{Octopress.configuration[:new_page_ext]}"
3
- task :new_page, :filename do |t, args|
4
- args.with_defaults(:filename => 'new-page')
5
-
6
- if args.filename.downcase =~ /(^.+\/)?(.+?)\/?$/
7
- page_dir = [Octopress.configuration[:source]]
8
- filename, dot, extension = $2.rpartition('.').reject(&:empty?) # Get filename and extension
9
- page_dir.concat($1.downcase.sub(/^\//, '').split('/')) unless $1.nil? # Add path to page_dir Array
10
- title = filename
11
-
12
- if extension.nil?
13
- page_dir << filename
14
- filename = "index"
15
- end
16
-
17
- page_dir = page_dir.map! { |d| d = d.to_url }.join('/') # Sanitize path
18
- filename = filename.downcase.to_url
19
-
20
- page_template = Octopress.configuration[:templates][:page]
21
- ext = page_template.delete :extension
22
-
23
- extension ||= ext
24
-
25
- file = "#{page_dir}/#{filename}.#{extension}"
26
-
27
- if File.exist?(file)
28
- abort("rake aborted!") if ask("#{file} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
29
- end
30
-
31
- mkdir_p page_dir unless Dir.exists? page_dir
32
-
33
- page_template[:date] = time.iso8601 if page_template[:date]
34
- page_template[:title] = title.gsub(/&/,'&amp;') if page_template[:title]
35
-
36
- begin
37
- time = now_in_timezone(Octopress.configuration[:timezone])
38
- open(file, 'w') do |page|
39
- page.puts page_template.to_yaml.gsub(/^:/m,'')
40
- page.puts "---"
41
- end
42
- rescue
43
- raise "Failed to create page: #{filename}"
44
- end
45
- puts "New page created: #{file}"
46
- else
47
- puts "Syntax error: #{args.filename} contains unsupported characters"
48
- end
49
- end
@@ -1,32 +0,0 @@
1
- # usage rake new_post[my-new-post] or rake new_post['my new post'] or rake new_post (defaults to "new-post")
2
- desc "Begin a new post in #{Octopress.configuration[:source]}/#{Octopress.configuration[:posts_dir]}"
3
- task :new_post, :title do |t, args|
4
- if args.title
5
- title = args.title
6
- else
7
- title = get_stdin("Enter a title for your post: ")
8
- end
9
- title = title.titlecase if Octopress.configuration[:titlecase]
10
- time = now_in_timezone(Octopress.configuration[:timezone])
11
-
12
- posts_dir = "#{Octopress.configuration[:source]}/#{Octopress.configuration[:posts_dir]}"
13
- mkdir_p posts_dir unless Dir.exists? posts_dir
14
- post_template = Octopress.configuration[:templates][:post]
15
- filename = "#{Octopress.configuration[:source]}/#{Octopress.configuration[:posts_dir]}/#{time.strftime('%Y-%m-%d')}-#{title.to_url}.#{post_template.delete(:extension)}"
16
-
17
- if File.exist?(filename)
18
- abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
19
- end
20
-
21
- begin
22
- post_template[:date] = time.iso8601 if post_template[:date]
23
- post_template[:title] = title.gsub(/&/,'&amp;') if post_template[:title]
24
- open(filename, 'w') do |post|
25
- post.puts post_template.to_yaml.gsub(/^:/m,'')
26
- post.puts "---"
27
- end
28
- rescue
29
- Raise "Failed to create post: #{filename}"
30
- end
31
- puts "Created new post: #{filename}"
32
- end
data/lib/rake/nuke.rake DELETED
@@ -1,4 +0,0 @@
1
- desc "Destroy your entire site."
2
- task :nuke do
3
- rm_rf %w[.plugins _site config javascripts plugins public source stylesheets]
4
- end
@@ -1,4 +0,0 @@
1
- desc "preview the site in a web browser."
2
- task :preview do
3
- Octopress::Commands::Serve.process([], {})
4
- end
data/lib/rake/push.rake DELETED
@@ -1,37 +0,0 @@
1
- desc "deploy public directory to github pages"
2
- multitask :push do
3
- if File.directory?(Octopress.configuration[:deploy_dir])
4
- puts "## Deploying branch to GitHub Pages "
5
- (Dir["#{Octopress.configuration[:deploy_dir]}/*"]).each { |f| rm_rf(f) }
6
- puts "Attempting pull, to sync local deployment repository"
7
- cd "#{Octopress.configuration[:deploy_dir]}" do
8
- system "git pull origin #{Octopress.configuration[:deploy_branch]}"
9
- end
10
- puts "\n## copying #{Octopress.configuration[:destination]} to #{Octopress.configuration[:deploy_dir]}"
11
- cp_r "#{Octopress.configuration[:destination]}/.", Octopress.configuration[:deploy_dir]
12
- cd "#{Octopress.configuration[:deploy_dir]}" do
13
- File.new(".nojekyll", "w").close
14
- system "git add -A"
15
- message = "Site updated at #{Time.now.utc}"
16
- puts "\n## Committing: #{message}"
17
- system "git commit -m \"#{message}\""
18
- puts "\n## Pushing generated #{Octopress.configuration[:deploy_dir]} website"
19
- if system "git push origin #{Octopress.configuration[:deploy_branch]}"
20
- puts "\n## GitHub Pages deploy complete"
21
- else
22
- remote = `git remote -v`
23
- repo_url = case remote
24
- when /(http[^\s]+)/
25
- $1
26
- when /(git@[^\s]+)/
27
- $1
28
- else
29
- ""
30
- end
31
- raise "\n## Octopress could not push to #{repo_url}"
32
- end
33
- end
34
- else
35
- puts "This project isn't configured for deploying to GitHub Pages\nPlease run `rake setup_github_pages[your-deployment-repo-url]`."
36
- end
37
- end
data/lib/rake/rsync.rake DELETED
@@ -1,20 +0,0 @@
1
- desc "Deploy website via rsync"
2
- task :rsync do
3
- exclude = ""
4
- if File.exists?('./rsync-exclude')
5
- exclude = "--exclude-from '#{File.expand_path('./rsync-exclude')}'"
6
- end
7
- puts "## Deploying website via Rsync"
8
- ssh_key = if(!Octopress.configuration[:ssh_key].nil? && !Octopress.configuration[:ssh_key].empty?)
9
- "-i #{ENV['HOME']}/.ssh/#{Octopress.configuration[:ssh_key]}"
10
- else
11
- ""
12
- end
13
- document_root = ensure_trailing_slash(Octopress.configuration[:document_root])
14
- exit system("rsync -avze 'ssh -p #{Octopress.configuration[:ssh_port]} #{ssh_key}' #{exclude} #{Octopress.configuration[:rsync_args]} #{"--delete-after" unless !Octopress.configuration[:rsync_delete]} #{ensure_trailing_slash(Octopress.configuration[:destination])} #{Octopress.configuration[:ssh_user]}:#{document_root}")
15
- end
16
-
17
- def ensure_trailing_slash(val)
18
- val = "#{val}/" unless(val.end_with?('/'))
19
- return val
20
- end
@@ -1,35 +0,0 @@
1
- desc "Update configurations to support publishing to root or sub directory"
2
- task :set_root_dir, :dir do |t, args|
3
- path = args.dir || nil
4
- if path.nil?
5
- path = get_stdin("Please provide a directory: ")
6
- end
7
- if path
8
- if path == "/"
9
- path = ""
10
- else
11
- path = "/" + path.sub(/(\/*)(.+)/, "\\2").sub(/\/$/, '');
12
- end
13
- # update personal configuration
14
- site_configs = Octopress.configurator.read_config('site.yml')
15
- site_configs[:destination] = "public#{path}"
16
- root = "/#{path.sub(/^\//, '')}"
17
- url = $1 if site_configs[:url] =~ /(https?:\/\/[^\/]+)/i
18
- site_configs[:url] = url + path
19
- site_configs[:subscribe_rss] = "#{path}/atom.xml"
20
- site_configs[:root] = "#{root}"
21
- Octopress.configurator.write_config('site.yml', site_configs)
22
-
23
- rm_rf Octopress.configuration[:destination]
24
- mkdir_p site_configs[:destination]
25
- puts "\nYour _config/site.yml has been updated to the following"
26
- output = <<-EOF
27
-
28
- url: #{url + path}
29
- destination: public#{path}
30
- subscribe_rss: #{path}/atom.xml
31
- root: #{root}
32
- EOF
33
- puts output.yellow
34
- end
35
- end
@@ -1,115 +0,0 @@
1
- desc "Set up _deploy folder and deploy branch for GitHub Pages deployment"
2
- task :setup_github_pages, :repo do |t, args|
3
- puts Octopress.configuration
4
- if args.repo
5
- repo_url = args.repo
6
- else
7
- puts "Enter the read/write url for your repository"
8
- puts "(For example, 'git@github.com:your_username/your_username.github.io)"
9
- repo_url = get_stdin("Repository url: ")
10
- end
11
- unless repo_url[-4..-1] == ".git"
12
- repo_url << ".git"
13
- end
14
- raise "!! The repo URL that was input was malformed." unless (repo_url =~ /https:\/\/github\.(?:io|com)\/[^\/]+\/[^\/]+/).nil? or (repo_url =~ /git@github\.(?:io|com):[^\/]+\/[^\/]+/).nil?
15
- user_match = repo_url.match(/(:([^\/]+)|(github\.(?:io|com)\/([^\/]+)))/)
16
- user = user_match[2] || user_match[4]
17
- branch = (repo_url =~ /\/[\w-]+\.github\.(?:io|com)/).nil? ? 'gh-pages' : 'master'
18
- project = (branch == 'gh-pages') ? repo_url.match(/\/(.+)(\.git)/)[1] : ''
19
- url = "http://#{user}.github.io"
20
- url += "/#{project}" unless project == ''
21
- unless (`git remote -v` =~ /origin.+?octopress(?:\.git)?/).nil?
22
- # If octopress is still the origin remote (from cloning) rename it to octopress
23
- system "git remote rename origin octopress"
24
- if branch == 'master'
25
- # If this is a user/organization pages repository, add the correct origin remote
26
- # and checkout the source branch for committing changes to the website's source.
27
- system "git remote add origin #{repo_url}"
28
- puts "Added remote #{repo_url} as origin"
29
- system "git config branch.master.remote origin"
30
- puts "Set origin as default remote"
31
- system "git branch -m master source"
32
- puts "Master branch renamed to 'source' for committing your website's source files"
33
- else
34
- unless !Octopress.configuration[:destination].match("#{project}").nil?
35
- Rake::Task[:set_root_dir].invoke(project)
36
- end
37
- end
38
- end
39
-
40
- # Configure deployment repository
41
- rm_rf Octopress.configuration[:deploy_dir], :verbose=>false
42
- cmd = "git clone #{repo_url} --branch #{branch} #{Octopress.configuration[:deploy_dir]}"
43
- Open3.popen2e(cmd) do |stdin, stdout_err, wait_thr|
44
- exit_status = wait_thr.value
45
- unless exit_status.success?
46
- error = ''
47
- while line = stdout_err.gets do error << line end
48
- puts "Be sure your repo (#{repo_url}) is set up properly and try again".red
49
- abort error
50
- end
51
- end
52
- cd "#{Octopress.configuration[:deploy_dir]}", :verbose=>false do
53
- unless File.exist?('index.html')
54
- `echo 'My Octopress Page is coming soon &hellip;' > index.html`
55
- `git add . && git commit -m 'Octopress init'`
56
- `git branch -m gh-pages` unless branch == 'master'
57
- end
58
- end
59
-
60
- # Configure deployment setup in deploy.yml
61
- deploy_configuration = Octopress.configurator.read_config('deploy.yml')
62
- config_message = ""
63
-
64
- unless deploy_configuration[:deploy_default] == "push"
65
- deploy_configuration[:deploy_default] = "push"
66
- config_message << "\n deploy_default: push"
67
- end
68
-
69
- unless deploy_configuration[:deploy_branch] == branch
70
- deploy_configuration[:deploy_branch] = branch
71
- config_message << "\n deploy_branch: #{branch}"
72
- end
73
-
74
- # Mention updated configs if any
75
- unless config_message.empty?
76
- deploy_configuration = Octopress.configurator.read_config('defaults/deploy/gh_pages.yml').deep_merge(deploy_configuration)
77
- Octopress.configurator.write_config('deploy.yml', deploy_configuration)
78
- puts "\nYour deployment configuration (_config/deploy.yml) has been updated to:"
79
- puts config_msg.yellow
80
- end
81
-
82
- # Configure published url
83
- site_configuration = Octopress.configurator.read_config('site.yml')
84
- if !site_configuration.has_key?(:url) or site_configuration[:url] == 'http://yoursite.com'
85
- site_configuration[:url] = url
86
- Octopress.configurator.write_config('site.yml', site_configuration)
87
- puts "\nYour site configuration (_config/site.yml) has been updated to:"
88
- puts "\n url: #{url}".yellow
89
- end
90
- jekyll_configuration = Octopress.configurator.read_config('defaults/jekyll.yml').deep_merge(site_configuration)
91
-
92
- cname_path = "#{jekyll_configuration[:source]}/CNAME"
93
- has_cname = File.exists?(cname_path)
94
- output = ""
95
- if has_cname
96
- cname = IO.read(cname_path).chomp
97
- current_url = site_configuration[:url]
98
- if cname != current_short_url
99
- output << "\nYour CNAME points to #{cname} but your _config/site.yml is setting the url to #{current_short_url}".red
100
- output << "\nIf you need help, get it here: https://help.github.com/articles/setting-up-a-custom-domain-with-pages"
101
- else
102
- url = cname
103
- end
104
- else
105
- output << "\nTo use a custom domain:".bold
106
- output << "\n Follow this guide: https://help.github.com/articles/setting-up-a-custom-domain-with-pages"
107
- output << "\n Then remember to update the url in _config/site.yml from #{url} to http://your-domain.com"
108
- end
109
-
110
- puts "Configured successfully:".green.bold
111
- puts " Github Pages will host your site at #{url}.".green
112
- puts "\nTo deploy:".bold
113
- puts " Run `rake deploy` which will copy your site to _deploy/, commit then push to #{repo_url}"
114
- puts output
115
- end