Sha256: a13a477b5ea5c9e618d6d0bf5565ede710fc4bccd31e6445a63a9e1fc56ef279
Contents?: true
Size: 1.93 KB
Versions: 3
Compression:
Stored size: 1.93 KB
Contents
#!/usr/bin/env ruby # Copyright 2011 Marc Hedlund <marc@precipice.org> # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # campfire_export -- export Campfire transcripts and uploaded files. # # Since Campfire (www.campfirenow.com) doesn't provide an export feature, # this script implements one via the Campfire API. # # See https://github.com/precipice/campfire_export/blob/master/README.md # for more information on using this script. lib = File.expand_path(File.join(File.dirname(__FILE__), '../lib')) $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib) require 'campfire_export' def config_date(config, date_key) date_str = config.fetch(date_key, nil) date_str.nil? ? nil : Date.parse(date_str) end def ensure_config_for(config, key, prompt) value = config.fetch(key, "") while value == "" print "#{prompt}: " value = gets.chomp end config[key] = value end config = {} config_file = File.join(ENV['HOME'], '.campfire_export.yaml') if File.exists?(config_file) and File.readable?(config_file) config = YAML.load_file(config_file) end ensure_config_for(config, 'subdomain', "Your Campfire subdomain (for 'https://myco.campfirenow.com', use 'myco')") ensure_config_for(config, 'api_token', "Your Campfire API token (see 'My Info' on your Campfire site)") account = CampfireExport::Account.new(config['subdomain'], config['api_token']) account.export(config_date(config, 'start_date'), config_date(config, 'end_date'))
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
campfire_export-0.1.0 | bin/campfire_export |
campfire_export-0.0.2 | bin/campfire_export |
campfire_export-0.0.1 | bin/campfire_export |