зеркало из https://github.com/github/pages-gem.git
spike out github-pages health-check
This commit is contained in:
Родитель
1bc7eeb6bb
Коммит
9a554eed39
|
@ -1,3 +1,4 @@
|
|||
*.gem
|
||||
*.lock
|
||||
.bundle
|
||||
CNAME
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
require 'mercenary'
|
||||
require 'terminal-table'
|
||||
require 'github-pages-health-check'
|
||||
require_relative "../lib/github-pages"
|
||||
|
||||
Mercenary.program(:"github-pages") do |p|
|
||||
|
@ -34,4 +35,21 @@ Mercenary.program(:"github-pages") do |p|
|
|||
].join(", ")
|
||||
end
|
||||
end
|
||||
|
||||
p.command(:"health-check") do |c|
|
||||
c.syntax "health-check"
|
||||
c.description "Checks your GitHub Pages site for common DNS configuration issues"
|
||||
c.action do |args, options|
|
||||
cname_path = File.expand_path "CNAME", Dir.pwd
|
||||
raise "No CNAME file found in current directory" unless File.exists?(cname_path)
|
||||
cname = File.open(cname_path).read.strip
|
||||
check = GitHubPages::HealthCheck.new(cname)
|
||||
puts "Checking domain #{cname}..."
|
||||
if check.valid?
|
||||
puts "Everything looks a-okay! :)"
|
||||
else
|
||||
puts "Uh oh. Looks like something's fishy: #{check.reason}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,6 +18,7 @@ Gem::Specification.new do |s|
|
|||
s.add_dependency(gem, "= #{version}")
|
||||
end
|
||||
|
||||
s.add_dependency('github-pages-health-check', "~> 0.1")
|
||||
s.add_dependency('mercenary', "~> 0.3")
|
||||
s.add_dependency('terminal-table', "~> 1.4")
|
||||
s.add_development_dependency("rspec", "~> 2.14")
|
||||
|
|
|
@ -11,9 +11,6 @@ class GitHubPages
|
|||
"jekyll-coffeescript" => "1.0.0",
|
||||
"jekyll-sass-converter" => "1.2.0",
|
||||
|
||||
# Pages
|
||||
"github-pages-health-check" => "0.1.0",
|
||||
|
||||
# Converters
|
||||
"kramdown" => "1.3.1",
|
||||
"maruku" => "0.7.0",
|
||||
|
|
|
@ -3,7 +3,5 @@
|
|||
|
||||
set -ex
|
||||
|
||||
bundle exec bin/github-pages versions
|
||||
bundle exec bin/github-pages br my-branch
|
||||
bundle exec jekyll --version
|
||||
bundle exec rspec
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe(GitHubPages) do
|
||||
it "lists the dependency versions" do
|
||||
output = `github-pages versions`
|
||||
expect(output).to include("Gem")
|
||||
expect(output).to include("Version")
|
||||
GitHubPages.gems.each do |name, version|
|
||||
expect(output).to include("| #{name}")
|
||||
expect(output).to include("| #{version}")
|
||||
end
|
||||
end
|
||||
|
||||
it "outputs the branch" do
|
||||
expect(`github-pages branch`).to eql("gem 'github-pages', :branch => 'master', :git => 'git://github.com/github/pages-gem'\n")
|
||||
end
|
||||
|
||||
it "detects the CNAME when running health check" do
|
||||
File.write("CNAME", "foo.invalid")
|
||||
expect(`github-pages health-check`).to include("Checking domain foo.invalid...")
|
||||
File.delete("CNAME")
|
||||
end
|
||||
end
|
Загрузка…
Ссылка в новой задаче