Skip to content

Commit c7cb217

Browse files
committed
Merge pull request progit#306 from progit/ci_travis
Ci travis
2 parents 7060f42 + 1718b5d commit c7cb217

File tree

3 files changed

+52
-2
lines changed

3 files changed

+52
-2
lines changed

Diff for: .travis.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
language: ruby
2+
script: 'bundle exec rake ci:check'
3+
rvm:
4+
- 1.9.3
5+
notifications:
6+
email: false

Diff for: Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'maruku'

Diff for: Rakefile

+43-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# encoding: UTF-8
22

33
require 'rake/clean'
4-
4+
require 'redcarpet'
55

66
$lang = ENV['language']
77
$lang ||= 'en'
@@ -11,7 +11,7 @@ namespace :epub do
1111
INDEX_FILEPATH = File.join(TMP_DIR, 'progit.html')
1212
TARGET_FILEPATH = "progit-#{$lang}.epub"
1313

14-
SOURCE_FILES = FileList.new(File.join($lang, '**', '*.markdown')).sort
14+
SOURCE_FILES = FileList.new(File.join($lang, '0*', '*.markdown')).sort
1515
CONVERTED_MK_FILES = SOURCE_FILES.pathmap(File.join(TMP_DIR, '%f'))
1616
HTML_FILES = CONVERTED_MK_FILES.ext('html')
1717

@@ -158,3 +158,44 @@ namespace :pdf do
158158
system("ruby makepdfs")
159159
end
160160
end
161+
162+
namespace :ci do
163+
164+
desc "Continuous Integration"
165+
task :check do
166+
require 'maruku'
167+
langs = FileList.new('??')+FileList.new('??-??')
168+
if ENV['debug'] && $lang
169+
langs = [$lang]
170+
else
171+
excluded_langs = [
172+
'ca'
173+
]
174+
excluded_langs.each do |lang|
175+
puts "excluding #{lang}: known to fail"
176+
end
177+
langs -= excluded_langs
178+
end
179+
error_code = false
180+
langs.each do |lang|
181+
print "processing #{lang} "
182+
mark = ''
183+
source_files = FileList.new(File.join(lang, '0*', '*.markdown')).sort
184+
source_files.each do |mk_filename|
185+
mk_file = File.open(mk_filename, 'r') do |mk|
186+
mark+= mk.read.encode("UTF-8")
187+
end
188+
end
189+
begin
190+
code = Maruku.new(mark, :on_error => :raise)
191+
print "OK\n"
192+
rescue
193+
print "KO\n"
194+
print $!
195+
error_code = true
196+
end
197+
end
198+
fail "At least one language conversion failed" if error_code
199+
end
200+
201+
end

0 commit comments

Comments
 (0)