lib/showoff.rb in showoff-0.9.10.3 vs lib/showoff.rb in showoff-0.9.10.4
- old
+ new
@@ -51,30 +51,10 @@
set :page_size, "Letter"
set :pres_template, nil
set :showoff_config, {}
set :encoding, nil
- FileUtils.mkdir settings.statsdir unless File.directory? settings.statsdir
-
- # Page view time accumulator. Tracks how often slides are viewed by the audience
- begin
- @@counter = JSON.parse(File.read("#{settings.statsdir}/#{settings.viewstats}"))
- rescue
- @@counter = Hash.new
- end
-
- # keeps track of form responses. In memory to avoid concurrence issues.
- begin
- @@forms = JSON.parse(File.read("#{settings.statsdir}/#{settings.forms}"))
- rescue
- @@forms = Hash.new
- end
-
- @@downloads = Hash.new # Track downloadable files
- @@cookie = nil # presenter cookie. Identifies the presenter for control messages
- @@current = Hash.new # The current slide that the presenter is viewing
-
def initialize(app=nil)
super(app)
@logger = Logger.new(STDOUT)
@logger.formatter = proc { |severity,datetime,progname,msg| "#{progname} #{msg}\n" }
@logger.level = settings.verbose ? Logger::DEBUG : Logger::WARN
@@ -113,9 +93,29 @@
require_ruby_files
# Default asset path
@asset_path = "./"
+ # Create stats directory
+ FileUtils.mkdir settings.statsdir unless File.directory? settings.statsdir
+
+ # Page view time accumulator. Tracks how often slides are viewed by the audience
+ begin
+ @@counter = JSON.parse(File.read("#{settings.statsdir}/#{settings.viewstats}"))
+ rescue
+ @@counter = Hash.new
+ end
+
+ # keeps track of form responses. In memory to avoid concurrence issues.
+ begin
+ @@forms = JSON.parse(File.read("#{settings.statsdir}/#{settings.forms}"))
+ rescue
+ @@forms = Hash.new
+ end
+
+ @@downloads = Hash.new # Track downloadable files
+ @@cookie = nil # presenter cookie. Identifies the presenter for control messages
+ @@current = Hash.new # The current slide that the presenter is viewing
# Initialize Markdown Configuration
MarkdownConfig::setup(settings.pres_dir)
end