Skip to content

Commit

Permalink
place_github_badge with camo url + use ruby instead of sed
Browse files Browse the repository at this point in the history
  • Loading branch information
razum2um committed Aug 25, 2015
1 parent d649cf6 commit d2eb318
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tasks/generate.rake
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@ def needs_generation?
!File.exists?("#{EXAMPLE_PATH}/Gemfile")
end

def place_github_badge(fname)
full_fname = "#{EXAMPLE_PATH}/#{fname}"
content = File.read(full_fname).gsub("</header>", <<-EOF
</header>
<a href='https://github.com/razum2um/lurker'>
<img style='position: absolute; top: 0; right: 0; border: 0; z-index: 1000'
src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67"
data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"
alt='Fork me on GitHub'>
</a>
EOF
)
File.open(full_fname, 'w') { |f| f.write content }
end

desc 'destroys & recreates new test app'
task :regenerate => ["clobber:coverage", "clobber:app", "assets:precompile", "generate:app", "generate:stuff"]

Expand All @@ -79,7 +94,7 @@ task :convert_example_docs do
in_lurker_app "bin/lurker convert"
end

in_lurker_app %Q{sed -i "" "s|</header>|</header><a href='https://github.com/razum2um/lurker'><img style='position: absolute; top: 0; right: 0; border: 0; z-index: 1000' src='https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png' alt='Fork me on GitHub'></a>|" public/lurker/index.html}
place_github_badge 'public/lurker/index.html'
in_lurker_app "bin/lurker convert -f pdf"
end

Expand Down

0 comments on commit d2eb318

Please sign in to comment.