Skip to content

Commit ef31879

Browse files
committed
Added the project infrastructure.
1 parent af4f7fc commit ef31879

File tree

4 files changed

+70
-0
lines changed

4 files changed

+70
-0
lines changed

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Gemfile.lock
2+
*json
3+
node_modules
4+
_site
5+
_blog
6+
.sass-cache
7+
.jekyll-metadata
8+
scripts
9+
www

.travis.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
language: ruby
2+
rvm:
3+
- 2.2
4+
script: "awesome_bot README.md CONTRIBUTING.md --allow-dupe"

Gemfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# frozen_string_literal: true
2+
source 'https://rubygems.org'
3+
4+
gem 'awesome_bot', '~> 1.13'

Rakefile

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
require 'yaml'
2+
require 'rake/clean'
3+
CLEAN.include '*.json'
4+
5+
namespace :test do
6+
task :links2 do
7+
require 'awesome_bot'
8+
content = File.read('README.md')
9+
result = AwesomeBot.check(content)
10+
puts result.success(nil) ? ':)' : ':('
11+
end
12+
13+
CMD_STRING = YAML.load_file('.travis.yml')['script']
14+
desc 'Test links with AwesomeBot'
15+
task :links do
16+
system(CMD_STRING)
17+
end
18+
end
19+
20+
desc 'Regenerate the TOC.'
21+
task :toc do
22+
`node_modules/markdown-toc/cli.js -i README.md`
23+
end
24+
25+
desc 'Create the www sources.'
26+
task :webgen do
27+
DOCS_DIR = 'www/_mkdocs_source/'
28+
SRC_FILES = ['README.md', 'FAQ.md', 'motivation.md']
29+
SRC_FILES.each do |name|
30+
nodoc(name)
31+
end
32+
end
33+
34+
def nodoc(file)
35+
lines = File.readlines(file)
36+
37+
if file == 'README.md'
38+
file = 'index.md'
39+
end
40+
File.open(DOCS_DIR + file, 'w') do |file|
41+
lines.each do |line|
42+
unless line =~ /<!-- nodoc/ .. line =~ /<!-- doc/
43+
file.write(line)
44+
end
45+
end
46+
end
47+
end
48+
49+
desc 'Upload files to the web server.'
50+
task :release => :webgen do
51+
`cd www && mkdocs build`
52+
`cd www/_site && git add . && git commit -m "Release: $(date +%F-%H:%M)"`
53+
end

0 commit comments

Comments
 (0)