Permalink
Browse files

Tests + Asset Path fixes

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...
1 parent 6e08e1f commit b3f337d5f581b62fd8736b001e1398d7f95fc4ec @grundprinzip grundprinzip committed Nov 19, 2011
Showing with 10 additions and 4 deletions.
  1. +2 −1 bin/showoff
  2. +6 −3 lib/showoff.rb
  3. +2 −0 lib/showoff_utils.rb
View
3 bin/showoff
@@ -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'
View
9 lib/showoff.rb
@@ -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, '.'
@@ -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
@@ -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")
View
2 lib/showoff_utils.rb
@@ -293,6 +293,8 @@ def self.get_config_option(dir, option, default = nil)
data[option] || default
end
end
+ else
+ default
end
end

0 comments on commit b3f337d

Please sign in to comment.