Sha256: bb6eb90925955e4d6dded2b6fa30f95e703b4d227123e83fee040e3947bd927b
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
require 'thor/group' require 'util' class Refresh < Thor::Group include Util include Thor::Actions argument :presentation_name, :type => :string, :desc => 'The presentation name', :required => false def refresh_presentation block = Proc.new do |master,client| say "refreshing tokens and secrets for #{File.basename(master)}" master = "#{master}/index.html" client = "#{client}/index.html" master_content = File.read(master) token = request_token config = parse_config multiplex = %Q( multiplex: { secret: "#{token.secret}", id: "#{token.socket_id}", url: "#{config.host}:#{config.port}" }, ) regex = /multiplex: \{.*?\},/m master_content.sub!(regex,multiplex) File.write(master, master_content) client_content = File.read(client) multiplex = %Q( multiplex: { secret: null, id: "#{token.socket_id}", url: "#{config.host}:#{config.port}" }, ) client_content.sub!(regex,multiplex) File.write(client, client_content) end @presentation_name ? presentation(@presentation_name,&block) : each_presentation(&block) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
slidemgr-1.0.3 | lib/commands/refresh.rb |
slidemgr-1.0.2 | lib/commands/refresh.rb |
slidemgr-1.0.1 | lib/commands/refresh.rb |