Skip to content

Commit b6a75ad

Browse files
committed
Move docs around (make consistent with other ianwhite releases)
1 parent 5f837ec commit b6a75ad

File tree

5 files changed

+64
-93
lines changed

5 files changed

+64
-93
lines changed

CHANGELOG

Lines changed: 0 additions & 3 deletions
This file was deleted.

MIT-LICENSE

Lines changed: 0 additions & 20 deletions
This file was deleted.

README.rdoc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
http://plugins.ardes.com > truncate_html
2-
3-
= truncate_html
1+
= {ianwhite}[http://github.com/ianwhite] / {truncate_html}[http://github.com/truncate_html]
42

53
Ardes::TruncateHtml is just like the vanilla truncate rails helper, except it respects tags and html entities, and returns valid html.
64

@@ -24,7 +22,7 @@ or - in your environment.rb file (>= rails 2.1)
2422

2523
* The SPECDOC lists the specifications
2624
* Coverage is 100% (C0)
27-
* CI: tested against all 2.x branches and stable tags
25+
* CI: tested against all 2.x branches
2826

2927
RSpec is used for testing, so the tests are in <tt>spec/</tt> rather than
3028
<tt>test/</tt> Do rake --tasks for more details.

Rakefile

Lines changed: 62 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ $LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base) and !$LOAD_PATH.includ
44

55
require 'spec/rake/spectask'
66
require 'spec/rake/verify_rcov'
7-
require 'rake/rdoctask'
7+
require 'hanna/rdoctask'
8+
require 'garlic/tasks'
89

9-
plugin_name = File.basename(File.dirname(__FILE__))
10+
plugin_name = "truncate_html"
1011

1112
task :default => :spec
1213

13-
task :cruise do
14-
sh "garlic all"
14+
task :cruise => ['garlic:all', 'doc:push'] do
15+
puts "The build is GOOD"
1516
end
1617

1718
desc "Run the specs for #{plugin_name}"
@@ -20,53 +21,66 @@ Spec::Rake::SpecTask.new(:spec) do |t|
2021
t.spec_opts = ["--colour"]
2122
end
2223

23-
namespace :spec do
24-
desc "Generate RCov report for #{plugin_name}"
25-
Spec::Rake::SpecTask.new(:rcov) do |t|
26-
t.spec_files = FileList['spec/**/*_spec.rb']
27-
t.rcov = true
28-
t.rcov_dir = 'doc/coverage'
29-
t.rcov_opts = ['--text-report', '--exclude', "spec/,rcov.rb,#{File.expand_path(File.join(File.dirname(__FILE__),'../../..'))}"]
30-
end
31-
32-
namespace :rcov do
33-
desc "Verify RCov threshold for #{plugin_name}"
34-
RCov::VerifyTask.new(:verify => "spec:rcov") do |t|
35-
t.threshold = 100.0
36-
t.index_html = File.join(File.dirname(__FILE__), 'doc/coverage/index.html')
37-
end
38-
end
39-
40-
desc "Generate specdoc for #{plugin_name}"
41-
Spec::Rake::SpecTask.new(:doc) do |t|
42-
t.spec_files = FileList['spec/**/*_spec.rb']
43-
t.spec_opts = ["--format", "specdoc:SPECDOC"]
44-
end
24+
desc "Generate RCov report for #{plugin_name}"
25+
Spec::Rake::SpecTask.new(:rcov) do |t|
26+
t.spec_files = FileList['spec/**/*_spec.rb']
27+
t.rcov = true
28+
t.rcov_dir = 'doc/coverage'
29+
t.rcov_opts = ['--text-report', '--exclude', "spec/,rcov.rb,#{File.expand_path(File.join(File.dirname(__FILE__),'../../..'))}"]
30+
end
4531

46-
namespace :doc do
47-
desc "Generate html specdoc for #{plugin_name}"
48-
Spec::Rake::SpecTask.new(:html => :rdoc) do |t|
49-
t.spec_files = FileList['spec/**/*_spec.rb']
50-
t.spec_opts = ["--format", "html:doc/rspec_report.html", "--diff"]
51-
end
32+
namespace :rcov do
33+
desc "Verify RCov threshold for #{plugin_name}"
34+
RCov::VerifyTask.new(:verify => "spec:rcov") do |t|
35+
t.threshold = 100.0
36+
t.index_html = File.join(File.dirname(__FILE__), 'doc/coverage/index.html')
5237
end
5338
end
5439

55-
task :rdoc => :doc
56-
task "SPECDOC" => "spec:doc"
40+
task :doc => 'doc:build'
5741

58-
desc "Generate rdoc for #{plugin_name}"
59-
Rake::RDocTask.new(:doc) do |t|
60-
t.rdoc_dir = 'doc'
61-
t.main = 'README'
62-
t.title = "#{plugin_name}"
63-
t.template = ENV['RDOC_TEMPLATE']
64-
t.options = ['--line-numbers', '--inline-source', '--all']
65-
t.rdoc_files.include('README', 'SPECDOC', 'MIT-LICENSE', 'CHANGELOG')
66-
t.rdoc_files.include('lib/**/*.rb')
42+
namespace :doc do
43+
def sha
44+
`git log -1 --pretty=format:"%h"`
45+
end
46+
47+
Rake::RDocTask.new(:build) do |d|
48+
d.rdoc_dir = 'doc'
49+
d.main = 'README.rdoc'
50+
d.title = "#{plugin_name} API Docs (#{sha})"
51+
d.rdoc_files.include('README.rdoc', 'History.txt', 'License.txt', 'Todo.txt', 'lib/**/*.rb')
52+
end
53+
54+
task :push => 'doc:build' do
55+
# if sha != `cat`
56+
#
57+
# mv 'doc', 'newdoc'
58+
# on_gh_pages do
59+
# if doc_changed_sha?('newdoc', 'doc')
60+
# puts "doc has changed, pushing to gh-pages"
61+
# `rm -rf doc && mv newdoc doc`
62+
# `git add doc`
63+
# `git commit -a -m "Update API docs"`
64+
# `git push`
65+
# else
66+
# puts "doc is unchanged"
67+
# rm_rf 'newdoc'
68+
# end
69+
# end
70+
end
71+
72+
def doc_changed_sha?(docpath1, docpath2)
73+
`cat #{docpath1}/index.html | grep "<title>"` != `cat #{docpath2}/index.html | grep "<title>"`
74+
end
75+
76+
def on_gh_pages(&block)
77+
`git branch -m gh-pages orig-gh-pages > /dev/null 2>&1`
78+
`git checkout -b gh-pages origin/gh-pages`
79+
`git pull`
80+
yield
81+
ensure
82+
`git checkout master`
83+
`git branch -D gh-pages`
84+
`git branch -m orig-gh-pages gh-pages > /dev/null 2>&1`
85+
end
6786
end
68-
69-
namespace :doc do
70-
desc "Generate all documentation (rdoc, specdoc, specdoc html and rcov) for #{plugin_name}"
71-
task :all => ["spec:doc:html", "spec:doc", "spec:rcov", "doc"]
72-
end

SPECDOC

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)