Permalink
Browse files

pres_file option which to override the name of the 'showoff.json' fil…

…e, to allow several different presentations which share sections
  • Loading branch information...
1 parent 77cab9c commit 186bedc332725f032ba369bde1ab1e16a29ca401 @alexch committed May 4, 2011
Showing with 17 additions and 7 deletions.
  1. +9 −7 bin/showoff
  2. +4 −0 lib/showoff.rb
  3. +4 −0 lib/showoff_utils.rb
View
@@ -56,7 +56,9 @@ command :heroku do |c|
end
end
-desc 'Serves the showoff presentation in the current directory'
+desc 'Serves the showoff presentation in the specified (or current) directory'
+arg_name "[pres_dir]"
+default_value "."
command :serve do |c|
c.desc 'Port on which to run'
@@ -65,14 +67,14 @@ command :serve do |c|
c.desc 'Host or ip to run on'
c.default_value "localhost"
- c.flag [:h,:host]
-
- c.desc 'Presentation directory'
- c.default_value "."
- c.arg_name "pres_dir"
+ c.flag [:h,:host]
+
+ c.desc 'Presentation file'
@davetron5000
davetron5000 May 9, 2011

I like this feature, but I'm not sure I would know what it was; what about

c.desc 'JSON file used to drive presentation'

?

@alexch
alexch May 9, 2011 Owner

sounds good

+ c.default_value "showoff.json"
+ c.flag [:f, :pres_file]
c.action do |global_options,options,args|
- ShowOff.run! :host => options[:h], :port => options[:p].to_i, :pres_dir => args[0]
+ ShowOff.run! :host => options[:h], :port => options[:p].to_i, :pres_file => options[:f], :pres_dir => args[0]
end
end
View
@@ -49,6 +49,10 @@ def initialize(app=nil)
@root_path = ".."
end
options.pres_dir = File.expand_path(options.pres_dir)
+ if (options.pres_file)
+ puts "Using #{options.pres_file}"
+ ShowOffUtils.presentation_config_file = options.pres_file
+ end
puts "Serving presentation from #{options.pres_dir}"
@cached_image_size = {}
@pres_name = options.pres_dir.split('/').pop
@@ -3,6 +3,10 @@ def self.presentation_config_file
@presentation_config_file ||= 'showoff.json'
end
+ def self.presentation_config_file=(filename)
+ @presentation_config_file = filename
+ end
+
def self.create(dirname,create_samples,dir='one')
Dir.mkdir(dirname) if !File.exists?(dirname)
Dir.chdir(dirname) do

0 comments on commit 186bedc

Please sign in to comment.