Skip to content

Commit

Permalink
Tests + Asset Path fixes
Browse files Browse the repository at this point in the history
I could not execute the tests because of the following reasons:

1) the get_options() method did not handle the fact that sometimes there is no config file
2) my sinatra version requires public to be not a member variable

In Addition I could not execute the showoff executable from the trunk since it uses ShowOff::VERSION, but one of the previous merges of a pull request made this to SHOWOFF_VERSION
  • Loading branch information
grundprinzip committed Nov 19, 2011
1 parent 6e08e1f commit b3f337d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion bin/showoff
Expand Up @@ -2,12 +2,13 @@

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
require 'showoff'
require 'showoff/version'
require 'rubygems'
require 'gli'

include GLI

version ShowOff::Version
version SHOWOFF_VERSION

desc 'Create new showoff presentation'
arg_name 'dir_name'
Expand Down
9 changes: 6 additions & 3 deletions lib/showoff.rb
Expand Up @@ -34,7 +34,7 @@ class ShowOff < Sinatra::Application
attr_reader :cached_image_size

set :views, File.dirname(__FILE__) + '/../views'
set :public, File.dirname(__FILE__) + '/../public'
set :public_folder, File.dirname(__FILE__) + '/../public'

set :verbose, false
set :pres_dir, '.'
Expand All @@ -61,6 +61,9 @@ def initialize(app=nil)
@logger.debug options.pres_dir
@pres_name = options.pres_dir.split('/').pop
require_ruby_files

# Default asset path
@asset_path = "./"
end

def self.pres_dir_current
Expand Down Expand Up @@ -359,10 +362,10 @@ def assets_needed
assets << href if href
end

css = Dir.glob("#{options.public}/**/*.css").map { |path| path.gsub(options.public + '/', '') }
css = Dir.glob("#{options.public_folder}/**/*.css").map { |path| path.gsub(options.public_folder + '/', '') }
assets << css

js = Dir.glob("#{options.public}/**/*.js").map { |path| path.gsub(options.public + '/', '') }
js = Dir.glob("#{options.public_folder}/**/*.js").map { |path| path.gsub(options.public_folder + '/', '') }
assets << js

assets.uniq.join("\n")
Expand Down
2 changes: 2 additions & 0 deletions lib/showoff_utils.rb
Expand Up @@ -293,6 +293,8 @@ def self.get_config_option(dir, option, default = nil)
data[option] || default
end
end
else
default
end
end

Expand Down

0 comments on commit b3f337d

Please sign in to comment.