Sha256: 3f9fcc1e42b620aece0399b7346d19f8dbbefbf396bf6ebe8867d1c04eeeb8e3

Contents?: true

Size: 606 Bytes

Versions: 6

Compression:

Stored size: 606 Bytes

Contents

module Socialcast
  def config_dir
    config_dir = File.expand_path '~/.socialcast'
    FileUtils.mkdir config_dir, :mode => 0700 unless File.exist?(config_dir)
    config_dir
  end
  def credentials_file
    File.join config_dir, 'credentials.yml'
  end
  def save_credentials(options)
    File.open(credentials_file, "w") do |f|
      f.write(options.to_yaml)
    end
    File.chmod 0600, credentials_file
  end
  def credentials
    raise 'Unknown Socialcast credentials.  Run `socialcast authenticate` to initialize' unless File.exist?(credentials_file)
    YAML.load_file(credentials_file)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
socialcast-0.3.3 lib/socialcast.rb
socialcast-0.3.2 lib/socialcast.rb
socialcast-0.3.1 lib/socialcast.rb
socialcast-0.3.0 lib/socialcast.rb
socialcast-0.2.1 lib/socialcast.rb
socialcast-0.2.0 lib/socialcast.rb