Skip to content

Commit

Permalink
setting up tests in Rakefile
Browse files Browse the repository at this point in the history
  • Loading branch information
moutons committed Jul 31, 2016
1 parent d288de4 commit 1d86624
Show file tree
Hide file tree
Showing 21 changed files with 294 additions and 52 deletions.
13 changes: 13 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.1
Include:
- '**/Rakefile'

Style/Encoding:
Enabled: false

Metrics/LineLength:
#Enabled: false
Max: 99
Empty file added .rubocop_todo.yml
Empty file.
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
sudo: false
language: bash
language: ruby
rvm:
- "2.2.5"
- "2.3.1"
script:
- echo YOLO straight to prod
notifications:
slack:
secure: ppR6E8Tzxf+o2Ump0dEE2Xp0GMvDDnq8YN9ll+WCIwGlwVgsvH4jW0vD7to9+tl6Yx5w9cW/YxmF4CDQszUpGH6rAF8CLjXMwD/QgiHjkjkGNPoIU+/sr6oAzvD0iUWOZ8BU7n9FuGI0T/z4MPNH8k16XoxLrYGjAKpKyG0mj502OQTI/BAsAJyXMSeu6wUAyc6iFWdcs36cpOuFT58Dt/3vNrfFqXHZf61mPjKNXzWstIEaglsnVc/t1aOGiN/o2DETm1ysGcVrqIXeSv3wEWIrHUVwoOI3vSe4DvWW93br0aQWDJ2JucMEzvX1K2Jcx1WWMnGiG5tVeQXrWA1tYYXGyfWXYdZrfVJf7WvkLHV4JX2j3AgKAaUMvFA1AZeApM4DPHM+3tGZpZwzHZD992rQhyzjqydFzxuIya6nwwmS/LwH4J4nHvs0OQalC8A6zEX9EMhte/WBgAYr+mWQqamKjdv1JQd8vEQQZweUDc51WBdkodRYjmBcJNak/+5KcSL5ecw+GTqpCtnSEd4s+h3PKFX90AR5Gxeorju3KYAPuH6nqp1S3zdv5QlJQH9VDkUqPeH9zsI8pyqypHgJdO/wNf1HfRvYPvodxrRBrON+1OQkAn3pCjEs7zVRQMTraUQ6w2ptIhAhwAk7w1gIABEbmLoj1s0I/54co328828=
deploy:
local_dir: build
provider: s3
access_key_id: AKIAJGMDPBO6WAJAZRQA
secret_access_key:
secure: PhgNSq4p7GSl9tK1pu4REw00gNpPeki7D6MHu9VIqMd1KaJfpFqZ4+OzntAWSWTNBvDSZpzqT+oR4ALAg/31o9dYegnOk7JiobHNlgFWFa8YECcMwje1aTbMaeAQ5ZQBzgikaDXdfzuJPwK8frrcSvvJjldNFpnE52WZ4BcfM4TtsZNYPMYgKKip77g1ba/f/hguXESZp/9bWB0tCQLY7aLpxhx/QQLQYncF5IgtGkEO1UNJYZdPdcHvozyzEw9EhDm/jMGe/2UIkpao/koX0tsfH6JKO+Fz1qeUFtQyRUNEJeoEJwSLPDEBOevRF5QW+WSO/vt7MiMhWB2J12Fif52xLPEtIhgzSOsvgvGX777FF/i87Gv5UshUXv2SlJyCJ1tKmuwkh1vrY7fz9DwW4kyomYwnmU3Ce4m46M151pmf/YEx9n4CeXIdutU26iOHT9XIa2sIxh5iTrZUcPudGuaO7cAfe89874+kyh3prk4CuNFVgD3rB6J4xEv8FV8OdFirBDhXTKUf+SR9az3vpT2Ox0aYIdZU5+UuMOZbHzIjrEIS6Gs5DVBmkvX3ITlkNupcUaY8Y2YmTcC7QVXGZ0oNI1OIPaoDeEF0em0XCn1S42aLnlh74M3K2iwpQBcTY2NBYa04Z9LORAUi/QGYnl0Te1ZbYfq3sZ95Bb14zbQ=
bucket: tirefi.re
acl: public_read
on:
branch: master
repo: tirefire/tirefi.re
10 changes: 10 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
source 'https://rubygems.org'
gem 'html-proofer'
gem 'jekyll'
gem 'jekyll-redirect-from'
gem 'jekyll-paginate'
gem 'jekyll-sitemap'
gem 'jekyll-feed'
gem 'kramdown'
gem 'rake'
gem 'rubocop'
105 changes: 105 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (4.2.7)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.4.0)
ast (2.3.0)
colorator (1.1.0)
colored (1.2)
ethon (0.9.0)
ffi (>= 1.3.0)
ffi (1.9.14)
forwardable-extended (2.6.0)
html-proofer (3.0.6)
activesupport (~> 4.2)
addressable (~> 2.3)
colored (~> 1.2)
mercenary (~> 0.3.2)
nokogiri (~> 1.5)
parallel (~> 1.3)
typhoeus (~> 0.7)
yell (~> 2.0)
i18n (0.7.0)
jekyll (3.2.0)
colorator (~> 1.0)
jekyll-sass-converter (~> 1.0)
jekyll-watch (~> 1.1)
kramdown (~> 1.3)
liquid (~> 3.0)
mercenary (~> 0.3.3)
pathutil (~> 0.9)
rouge (~> 1.7)
safe_yaml (~> 1.0)
jekyll-feed (0.6.0)
jekyll-paginate (1.1.0)
jekyll-redirect-from (0.11.0)
jekyll (>= 2.0)
jekyll-sass-converter (1.4.0)
sass (~> 3.4)
jekyll-sitemap (0.11.0)
addressable (~> 2.4.0)
jekyll-watch (1.5.0)
listen (~> 3.0, < 3.1)
json (1.8.3)
kramdown (1.11.1)
liquid (3.0.6)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
mercenary (0.3.6)
mini_portile2 (2.1.0)
minitest (5.9.0)
nokogiri (1.6.8)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
parallel (1.9.0)
parser (2.3.1.2)
ast (~> 2.2)
pathutil (0.14.0)
forwardable-extended (~> 2.6)
pkg-config (1.1.7)
powerpack (0.1.1)
rainbow (2.1.0)
rake (11.2.2)
rb-fsevent (0.9.7)
rb-inotify (0.9.7)
ffi (>= 0.5.0)
rouge (1.11.1)
rubocop (0.42.0)
parser (>= 2.3.1.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1)
safe_yaml (1.0.4)
sass (3.4.22)
thread_safe (0.3.5)
typhoeus (0.8.0)
ethon (>= 0.8.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
unicode-display_width (1.1.0)
yell (2.0.6)

PLATFORMS
ruby

DEPENDENCIES
html-proofer
jekyll
jekyll-feed
jekyll-paginate
jekyll-redirect-from
jekyll-sitemap
kramdown
rake
rubocop

BUNDLED WITH
1.12.5
158 changes: 158 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
#!/usr/bin/env ruby
# jekyll Rakefile
# Config variables above those defined in _config.yml

# post_ext = '.md'
# post_dir = '_posts/'
# load from configuration file if present
load '_rake-configuration.rb' if File.exist?('_rake-configuration.rb')
load '_rake_configuration.rb' if File.exist?('_rake_configuration.rb')
#
# OK now starting main engines
#
# Specify default values for variables NOT set by the user

# post_ext ||= '.md'
# post_dir ||= '_posts/'
# git_check ||= true
# git_autopush ||= false
#

desc 'Test site using HTML::Proofer'
task :proof_sitedir do
system 'bundle exec jekyll build'
# system 'bundle exec htmlproofer --allow-hash-href --assume-extension ./_site'
HTMLProofer.check_directory(
'./_site/',
allow_hash_href: true,
assume_extension: true,
url_ignore: [
'http://tirefi.re/about/',
'http://tirefi.re/feed.xml',
'http://validator.w3.org/check?uri=referer'
]
).run
end
#
# and the rest
#
desc 'Clean up generated site'
task :clean do
cleanup
end

desc 'Preview on local machine'
task preview: :clean do
jekyll('serve --watch')
end
task serve: :preview

desc 'Build for deployment'
task build: :clean do
if rake_running
puts "\n\n****WARNING: An instance of rake is running.\n"
puts "****WARNING: Building while running other tasks (preview!)\n"
puts " might create a site with broken links.\n\n"
puts 'Are you certain you want to continue? [Y|n]'

ans = STDIN.gets.chomp
exit if ans != 'Y'
end
jekyll('build --config _config.yml')
end

desc 'Show the file changed since last deploy to stdout'
task :list_changes do |_t|
content = list_file_changed
puts content
end

def list_file_changed
content = "Files changed since last deploy:\n"
IO.popen('find * -newer _last_deploy.txt -type f') do |io|
while (line = io.gets)
filename = line.chomp
if user_visible(filename)
content << "* \"#{filename}\":{{site.url}}/#{file_change_ext(filename, '.html')}\n"
end
end
end
content
end

# this is the list of files we do not want to show in changed files
EXCLUSION_LIST = [/.*~/,
/_.*/,
'javascripts?',
'js',
/stylesheets?/,
'css',
'Rakefile',
'Gemfile',
/s[ca]ss/,
/.*\.css/,
/.*.js/,
'bower_components',
'config.rb'].map!(&:freeze).freeze

# return true if filename is "visible" to the user (e.g., it is not javascript, css, ...)
def user_visible(filename)
exclusion_list = Regexp.union(EXCLUSION_LIST)
!filename.match(exclusion_list)
end

def file_change_ext(filename, newext)
if File.extname(filename) == '.textile' || File.extname(filename) == '.md'
filename.sub(File.extname(filename), newext)
else
filename
end
end

#
# General support functions
#

# remove generated site
def cleanup
jekyll('clean')
end

# launch jekyll
def jekyll(directives = '')
system 'bundle exec jekyll ' + directives
end

# check if there is another rake task running (in addition to this one!)
def rake_running
`pgrep rake | wc -l`.to_i > 1
end

def git_local_diffs
`git diff --name-only` != ''
end

def git_remote_diffs(branch)
`git fetch`
`git rev-parse #{branch}` != `git rev-parse origin/#{branch}`
end

def git_repo?
`git status` != ''
end

def git_requires_attention(branch)
git_check && git_repo? && git_remote_diffs(branch)
end

#
# default task stuff
#
require 'rake'
require 'html-proofer'
require 'rubocop/rake_task'

RuboCop::RakeTask.new

desc 'Set default tasks'
task default: :proof_sitedir
25 changes: 0 additions & 25 deletions _posts/2016-07-30-welcome-to-jekyll.markdown

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>ಠ_ಠ in docker</title>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<link rel="icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="1;URL='/docker/docker/docker/docker/docker/docker/docker/docker/docker/docker/'" />
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>ಠ_ಠ in docker</title>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<link rel="icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="1;URL='/docker/docker/docker/docker/docker/docker/docker/docker/docker/docker/MUSHROOM/MUSHROOM/'" />
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>ಠ_ಠ in docker</title>
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
/*<![CDATA[*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>ಠ_ಠ in docker</title>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<link rel="icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="0;URL='/docker/docker/docker/docker/docker/docker/docker/docker/docker/docker/MUSHROOM/'" />
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>ಠ_ಠ in docker</title>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<link rel="icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="0;URL='/docker/docker/docker/docker/docker/docker/docker/docker/docker'" />
</head>
Expand Down
2 changes: 0 additions & 2 deletions docker/docker/docker/docker/docker/docker/docker/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>ಠ_ಠ in docker</title>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<link rel="icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="0;URL='/docker/docker/docker/docker/docker/docker/docker/docker'" />
</head>
Expand Down
Loading

0 comments on commit 1d86624

Please sign in to comment.