pingfm 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,6 +21,19 @@
21
21
  pingfm.tpost('The message here.', '#something_custom', 'Optional Title')
22
22
  # => {'status' => 'OK'} # if success, otherwise 'FAIL'
23
23
 
24
+ You can also manage the configuration file through <tt>Pingfm::Config</tt>.
25
+
26
+ # Load from an existing config file (defaults to $HOME/.pingfm.yml).
27
+ begin
28
+ app_key = Pingfm::Config['app_key']
29
+ rescue Pingfm::ConfigNotFound # This is raised if the config file can't be found.
30
+ # Helper method to get user app key from STDIN:
31
+ app_key = Pingfm::Config.ask_for_app_key!
32
+
33
+ # Or just assign a value to 'app_key' (this will automatically save the config file):
34
+ Pingfm::Config['app_key'] = 'YOUR_USER_APP_KEY'
35
+ end
36
+
24
37
  Check the {documentation}[http://rdoc.info/projects/Oshuma/pingfm] for more details.
25
38
 
26
39
  == Shell Usage
@@ -29,18 +42,17 @@ Check the {documentation}[http://rdoc.info/projects/Oshuma/pingfm] for more deta
29
42
 
30
43
  Everything after the '<tt>pingfm</tt>' command is what will be posted to the service. You
31
44
  may also include the message within quotes (ex. using the client within a shell script).
45
+ Run with '<tt>--help</tt>' to list all command-line options.
32
46
 
33
47
  If your key has not been stored, it will ask for it. This key will be saved
34
48
  in a YAML file in your home directory and you won't be asked for it again.
35
49
 
36
- You can obtain your key here:
37
-
38
- * User API Key - {http://ping.fm/key/}[http://ping.fm/key/]
50
+ You can obtain your key here: {http://ping.fm/key/}[http://ping.fm/key/]
39
51
 
40
52
 
41
53
  == Authors
42
54
 
43
- * {Dale Campbell}[http://oshuma.github.com/]
55
+ * {Dale Campbell}[http://nerdno.de/]
44
56
  * {Kevin Williams}[http://kevwil.com/]
45
57
  * {Krunoslav Husak}[http://h00s.net]
46
58
 
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'bundler'
2
+ require 'rdoc/task'
2
3
  require 'rspec/core/rake_task'
3
4
 
4
5
  Bundler::GemHelper.install_tasks
@@ -14,3 +15,13 @@ desc 'Run the specs'
14
15
  RSpec::Core::RakeTask.new(:spec) do |t|
15
16
  t.rspec_opts = ['--color']
16
17
  end
18
+
19
+ namespace :docs do
20
+ RDoc::Task.new do |rd|
21
+ rd.title = "Pingfm API Docs"
22
+ rd.main = "README.rdoc"
23
+ rd.rdoc_dir = "#{File.dirname(__FILE__)}/doc/api"
24
+ rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
25
+ rd.options << "--all"
26
+ end
27
+ end
data/bin/pingfm CHANGED
@@ -4,6 +4,8 @@ require 'rubygems' if RUBY_VERSION =~ /1\.8/
4
4
  require 'bundler/setup'
5
5
  require 'slop'
6
6
 
7
+ require 'pingfm'
8
+
7
9
  opts = Slop.parse!(:help => true) do
8
10
  banner "Usage: #{File.basename(__FILE__)} [options] <message>"
9
11
 
@@ -35,8 +37,8 @@ message = ARGV.join(' ')
35
37
  begin
36
38
  app_key = Pingfm::Config['app_key']
37
39
  rescue Pingfm::ConfigNotFound => error
38
- Pingfm::Config.ask_for_app_key!
39
- app_key = Pingfm::Config['app_key']
40
+ app_key = Pingfm::Config.ask_for_app_key!
41
+ Pingfm::Config['app_key'] = app_key
40
42
  end
41
43
 
42
44
  client = Pingfm::Client.new(app_key)
@@ -4,5 +4,5 @@ require 'pingfm/client'
4
4
  require 'pingfm/config'
5
5
 
6
6
  module Pingfm
7
- VERSION = '2.0.0'
7
+ VERSION = '2.1.0'
8
8
  end
@@ -10,9 +10,7 @@ module Pingfm
10
10
  # Prompts the user for their API key and saves it.
11
11
  def ask_for_app_key!
12
12
  STDOUT.print 'Enter your Ping.fm User API key (http://ping.fm/key/): '
13
- @@config ||= {}
14
- @@config['app_key'] = STDIN.gets.chomp
15
- save!
13
+ STDIN.gets.chomp
16
14
  end
17
15
 
18
16
  def [](key)
@@ -20,6 +18,12 @@ module Pingfm
20
18
  @@config[key]
21
19
  end
22
20
 
21
+ def []=(key, value)
22
+ @@config ||= {}
23
+ @@config[key] = value
24
+ save!
25
+ end
26
+
23
27
  def save!
24
28
  ::File.open(CONFIG_FILE, 'w') do |config_file|
25
29
  ::YAML.dump(@@config, config_file)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pingfm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -15,7 +15,7 @@ date: 2011-06-12 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: slop
18
- requirement: &75088130 !ruby/object:Gem::Requirement
18
+ requirement: &76760630 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: '0'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *75088130
26
+ version_requirements: *76760630
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
- requirement: &75087470 !ruby/object:Gem::Requirement
29
+ requirement: &76759860 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,7 +34,7 @@ dependencies:
34
34
  version: 2.6.0
35
35
  type: :development
36
36
  prerelease: false
37
- version_requirements: *75087470
37
+ version_requirements: *76759860
38
38
  description: Ping.fm (http://ping.fm) is a simple service that makes updating your
39
39
  social networks a snap, and this it's Ruby library.
40
40
  email: