This repository has been archived by the owner. It is now read-only.

use launchy for multi-platform docs opener #2

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+3 −1
Diff settings

Always

Just for now

View
@@ -20,4 +20,5 @@ if ENV['RACK_ENV'] != "production"
# gem "guard-puma"
# gem "guard-minitest"
gem "rake"
+ gem "launchy"
end
@@ -4,6 +4,7 @@ namespace :doc do
ENV['DONT_CONNECT'] = 'true'
ENV['DONT_PRINT_ROUTES'] = 'true'
require 'wd_sinatra/app_loader'
+ require 'launchy'
root = File.expand_path("../..", File.dirname(__FILE__))
WDSinatra::AppLoader.server(root)
LOGGER.level = Logger::FATAL
@@ -14,7 +15,7 @@ namespace :doc do
copy_assets(destination)
File.open("#{destination}/index.html", "w"){|f| f << template.result(binding)}
puts "Documentation available there: #{destination}/index.html"
- `open #{destination}/index.html` if RUBY_PLATFORM =~ /darwin/ && !ENV['DONT_OPEN']
+ Launchy.open "#{destination}/index.html" unless ENV['DONT_OPEN']
end
def template