Class: Ralber::Commands::Publish
- Inherits:
-
Object
- Object
- Ralber::Commands::Publish
- Defined in:
- lib/ralber/commands/publish_command.rb
Instance Method Summary collapse
- #configure_destination ⇒ Object
- #configure_template ⇒ Object
-
#initialize(args, options) ⇒ Publish
constructor
A new instance of Publish.
- #message(context, message) ⇒ Object
- #publish ⇒ Object
- #set_defaults(options) ⇒ Object
Constructor Details
Instance Method Details
#configure_destination ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/ralber/commands/publish_command.rb', line 37 def configure_destination dest = @options.to dest = @album.destination unless dest if not dest puts "Please provide a destination path with --to <path>" exit 2 end @album.destination = dest if not (Pathname.new dest).absolute? dest = File.join(@album.path,dest) end return dest end |
#configure_template ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ralber/commands/publish_command.rb', line 22 def configure_template tpl = @options.template tpl = @album.template unless tpl tpl = "default" unless tpl tplObj = nil begin tplObj = Ralber::Template.find(tpl) @album.template = tpl rescue puts "Could not find template. Either give the name or path to a template via --template parameter, or put a 'template' config in album.json." exit 2 end return tplObj end |
#message(context, message) ⇒ Object
67 68 69 |
# File 'lib/ralber/commands/publish_command.rb', line 67 def (context, ) puts end |
#publish ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ralber/commands/publish_command.rb', line 55 def publish template = self.configure_template dest = self.configure_destination puts "please wait, work in progress..." publisher = Ralber::Publisher.new(@album, template) publisher.force = @options.force publisher.add_listener(self) publisher.publish_to(dest) publisher.save_album if @options.save end |
#set_defaults(options) ⇒ Object
17 18 19 20 |
# File 'lib/ralber/commands/publish_command.rb', line 17 def set_defaults() .default \ :title => nil end |