mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-03-25 09:05:47 +00:00
put test repos in a better location, fix other bugs
This commit is contained in:
parent
3437b8f08a
commit
291e40f859
9 changed files with 33 additions and 9 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -3,4 +3,4 @@ node_modules
|
|||
public/feed.xml
|
||||
www
|
||||
server/auth.json
|
||||
server/spec/test-blog*
|
||||
server/test-blog*
|
||||
|
|
|
|||
4
Gemfile
4
Gemfile
|
|
@ -1,8 +1,12 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem 'builder'
|
||||
gem 'css_parser'
|
||||
gem 'htmlentities'
|
||||
gem 'mustache'
|
||||
gem 'nokogiri'
|
||||
gem 'rdiscount'
|
||||
gem 'sinatra'
|
||||
|
||||
gem 'rspec'
|
||||
gem 'guard-rspec'
|
||||
|
|
|
|||
10
Gemfile.lock
10
Gemfile.lock
|
|
@ -1,10 +1,13 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
addressable (2.3.6)
|
||||
builder (3.2.2)
|
||||
celluloid (0.16.0)
|
||||
timers (~> 4.0.0)
|
||||
coderay (1.1.0)
|
||||
css_parser (1.3.5)
|
||||
addressable
|
||||
diff-lcs (1.2.5)
|
||||
ffi (1.9.3)
|
||||
formatador (0.2.5)
|
||||
|
|
@ -25,6 +28,10 @@ GEM
|
|||
rb-inotify (>= 0.9)
|
||||
lumberjack (1.0.9)
|
||||
method_source (0.8.2)
|
||||
mini_portile (0.6.0)
|
||||
mustache (0.99.6)
|
||||
nokogiri (1.6.3.1)
|
||||
mini_portile (= 0.6.0)
|
||||
pry (0.10.1)
|
||||
coderay (~> 1.1.0)
|
||||
method_source (~> 0.8.1)
|
||||
|
|
@ -63,8 +70,11 @@ PLATFORMS
|
|||
|
||||
DEPENDENCIES
|
||||
builder
|
||||
css_parser
|
||||
guard-rspec
|
||||
htmlentities
|
||||
mustache
|
||||
nokogiri
|
||||
rdiscount
|
||||
rspec
|
||||
sinatra
|
||||
|
|
|
|||
5
Makefile
5
Makefile
|
|
@ -13,7 +13,10 @@ publish_beta: compile
|
|||
./bin/publish.sh --beta --delete
|
||||
|
||||
test_blog:
|
||||
./bin/create-test-blog.sh server/spec/test-blog
|
||||
./bin/create-test-blog.sh server/test-blog
|
||||
|
||||
clean:
|
||||
rm -rf server/test-blog server/test-blog-origin.git
|
||||
|
||||
spec:
|
||||
cd server && rspec -f documentation
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ if [[ -e "$BLOG_PATH" ]]; then
|
|||
else
|
||||
if [[ ! -e "$ORIGIN_BLOG_PATH" ]]; then
|
||||
echo ">>> Mirroring local origin..."
|
||||
git clone --mirror https://github.com/samsonjs/samhuri.net.git "$ORIGIN_BLOG_PATH"
|
||||
git clone --mirror . "$ORIGIN_BLOG_PATH"
|
||||
fi
|
||||
echo ">>> Cloning test blog from local origin..."
|
||||
git clone "$ORIGIN_BLOG_PATH" "$BLOG_PATH"
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ class HarpBlog
|
|||
def posts_for_month(year, month)
|
||||
post_dir = post_path(year, month)
|
||||
post_data = read_post_data(post_dir)
|
||||
post_data.values.sort_by {|p| p['timestamp'] }.map {|p| Post.new(p) }
|
||||
post_data.values.sort_by { |p| p['timestamp'] }.map { |p| Post.new(p) }
|
||||
end
|
||||
|
||||
def get_post(year, month, slug)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ require './harp_blog'
|
|||
$config = {
|
||||
auth: false,
|
||||
dry_run: false,
|
||||
path: File.expand_path('../spec/test-blog', __FILE__),
|
||||
path: File.expand_path('../test-blog', __FILE__),
|
||||
host: '127.0.0.1',
|
||||
port: 6706,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ require 'json'
|
|||
require_relative './helpers'
|
||||
require_relative '../harp_blog'
|
||||
|
||||
TEST_BLOG_PATH = File.expand_path('../test-blog', __FILE__)
|
||||
TEST_BLOG_ORIGIN_PATH = File.expand_path('../test-blog-origin.git', __FILE__)
|
||||
TEST_BLOG_PATH = File.expand_path('../../test-blog', __FILE__)
|
||||
TEST_BLOG_ORIGIN_PATH = File.expand_path('../../test-blog-origin.git', __FILE__)
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.include Helpers
|
||||
|
|
@ -238,6 +238,7 @@ RSpec.describe HarpBlog do
|
|||
blog = HarpBlog.new(TEST_BLOG_PATH, dry_run, TitleFinder.new)
|
||||
post = blog.create_post(nil, nil, 'http://samhuri.net')
|
||||
expect(post.title).to eq('fancy title')
|
||||
blog.delete_post(post.time.year.to_s, post.padded_month, post.slug)
|
||||
post = blog.create_post(" \t\n", nil, 'http://samhuri.net')
|
||||
expect(post.title).to eq('fancy title')
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,7 +16,13 @@ module Helpers
|
|||
end
|
||||
|
||||
def git_bare?(dir)
|
||||
!File.exist?(File.join(dir, '.git'))
|
||||
if File.exist?(File.join(dir, '.git'))
|
||||
false
|
||||
elsif File.exist?(File.join(dir, 'HEAD'))
|
||||
true
|
||||
else
|
||||
raise "what is this dir? #{dir} #{Dir[dir + '/*'].join(', ')}"
|
||||
end
|
||||
end
|
||||
|
||||
def git_sha(dir)
|
||||
|
|
@ -29,7 +35,7 @@ module Helpers
|
|||
|
||||
def git_reset_hard(dir, ref = nil)
|
||||
if git_bare?(dir)
|
||||
raise 'git_reset_hard does not support bare repos'
|
||||
raise 'git_reset_hard does not support bare repos ' + dir + ' -- ' + ref.to_s
|
||||
else
|
||||
args = ref ? "'#{ref}'" : ''
|
||||
`cd '#{dir}' && git reset --hard #{args}`
|
||||
|
|
|
|||
Loading…
Reference in a new issue