facebook-cli 1.5.4 → 1.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4545be7f2d09e94c5e799f08a54b6cb453da010
4
- data.tar.gz: 148791b88d70284e2a8e15e65216e4697749e8c2
3
+ metadata.gz: 79f1f91e3545439c67240cb83896173701b4698a
4
+ data.tar.gz: ee318f64b4a6498b904b6a40107414bcf90e5b93
5
5
  SHA512:
6
- metadata.gz: 0dc07031e8983d5b2ef4ab9d09a4ebf79fbcd755185c4343537c606ebe1574f2c4618866e6592a17b917b4292165427d0803f16ac3e989fa9e02e7b225bc9ca9
7
- data.tar.gz: ee21dcdef2fd18e9097972af9e5f96ef295bf7ab2c188bb3937593d3b7fbdad860b324aa7b92664a3f0cd0999c827db67e670ba5ff2fd0686af92efbb01e7331
6
+ metadata.gz: 1c1bb9c89e8fbfb05ba4b718c7f17d4b1db805dc77a18c2b60cb7450eae516c305ba71434938c64bf725486edbe4ae2955ba02c020bee597bac03fd83d1c755d
7
+ data.tar.gz: 8c8a0aeb0cdfd832cb4e95f2cafaec4de68b3cd4f417de7e19f8b35928edc96a561756ebf0386ae68ce544ccea129c33abce9c9c63277d5b9e6f355752cdecbe
data/lib/fbcli/auth.rb CHANGED
@@ -11,10 +11,14 @@ module FBCLI
11
11
  "&redirect_uri=http://localhost:#{port}/" +
12
12
  "&scope=user_likes,user_friends,user_posts,user_photos,user_videos,user_events,publish_actions"
13
13
 
14
- puts "Please open: #{uri}"
15
- puts
16
- puts "Waiting for authorization code on port #{port}..."
17
- puts
14
+ puts <<-EOM
15
+ Request permission to use the Facebook API by opening this link in your browser:
16
+
17
+ #{uri}
18
+
19
+ Waiting for authorization code on port #{port}...
20
+
21
+ EOM
18
22
 
19
23
  server = WEBrick::HTTPServer.new(
20
24
  :Port => port,
@@ -5,7 +5,11 @@ module FBCLI
5
5
 
6
6
  def self.init_api
7
7
  if $config['access_token'].nil? or $config['access_token'].empty?
8
- exit_now! "You must first acquire an access token; run: #{APP_NAME} login"
8
+ exit_now! <<-EOM
9
+ Obtain an access token to interact with the Facebook API.
10
+
11
+ Run: #{APP_NAME} login
12
+ EOM
9
13
  end
10
14
 
11
15
  Koala::Facebook::API.new($config['access_token'])
data/lib/fbcli/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module FBCLI
2
- VERSION = '1.5.4'
2
+ VERSION = '1.5.5'
3
3
  end
data/lib/fbcli.rb CHANGED
@@ -42,7 +42,8 @@ def save_config
42
42
  end
43
43
 
44
44
  pre do |global_options, command|
45
- $global_options = global_options # They're supposed to be global, right?
45
+ # Make options officially global
46
+ $global_options = global_options
46
47
 
47
48
  # Exit gracefully when terminating due to a broken pipe
48
49
  Signal.trap "PIPE", "SYSTEM_DEFAULT" if Signal.list.include? "PIPE"
@@ -56,26 +57,7 @@ pre do |global_options, command|
56
57
  exit_now! <<-EOM
57
58
  It looks like you are running #{APP_NAME} for the first time.
58
59
 
59
- To interact with the Facebook API you must create and configure
60
- a new Facebook application for your personal use.
61
-
62
- - Create a new application at: https://developers.facebook.com/apps
63
- - In the Settings tab:
64
- - Click "Add Platform" and select "Website"
65
- - Set "Site URL" to "http://localhost"
66
- - Under "App Domains" add "localhost"
67
- - Click "Save"
68
- - In the "App Review" tab:
69
- - Flip the switch to make your app live
70
- - In the "Dashboard" tab:
71
- - Click "Show" to reveal your app secret
72
- - Save the App ID and App Secret by running:
73
-
74
- #{APP_NAME} config --appid=<app-id> --appsecret=<app-secret>
75
-
76
- After that, acquire an access token by running:
77
-
78
- #{APP_NAME} login
60
+ Run `#{APP_NAME} config` for setup instructions.
79
61
  EOM
80
62
  end
81
63
  end
@@ -96,11 +78,38 @@ on_error do |exception|
96
78
  false
97
79
  end
98
80
 
99
- desc "Save Facebook application ID and secret"
81
+ # Update instructions in README.md when these change
82
+ SETUP_INSTRUCTIONS = <<-EOM
83
+ You must create and configure a Facebook application to interact with the Graph API.
84
+
85
+ - Create a new application at: https://developers.facebook.com/apps
86
+ - In the Settings tab:
87
+ - Click "Add Platform" and select "Website"
88
+ - Set "Site URL" to "http://localhost"
89
+ - Under "App Domains" add "localhost"
90
+ - Click "Save"
91
+ - In the "App Review" tab:
92
+ - Flip the switch to make your app live
93
+ - In the "Dashboard" tab:
94
+ - Click "Show" to reveal your app secret
95
+ - Save the App ID and App Secret by running:
96
+
97
+ #{APP_NAME} config --appid=<app-id> --appsecret=<app-secret>
98
+
99
+ Obtain an access token by running:
100
+
101
+ #{APP_NAME} login
102
+ EOM
103
+
104
+ desc "Save your Facebook API credentials"
100
105
  command :config do |c|
101
- c.flag [:appid], :desc => 'Facebook application ID', :required => true
102
- c.flag [:appsecret], :desc => 'Facebook application secret', :required => true
106
+ c.flag [:appid], :desc => 'Facebook application ID', :default_value => ""
107
+ c.flag [:appsecret], :desc => 'Facebook application secret', :default_value => ""
103
108
  c.action do |global_options, options|
109
+ if options['appid'].empty? or options['appsecret'].empty?
110
+ exit_now! SETUP_INSTRUCTIONS
111
+ end
112
+
104
113
  $config['app_id'] = options['appid'].to_i
105
114
  $config['app_secret'] = options['appsecret']
106
115
 
@@ -108,11 +117,11 @@ command :config do |c|
108
117
 
109
118
  puts "Configuration saved to #{CONFIG_FILE}"
110
119
  puts
111
- puts "To acquire a Facebook access token, run: #{APP_NAME} login"
120
+ puts "To obtain a Facebook access token, run: #{APP_NAME} login"
112
121
  end
113
122
  end
114
123
 
115
- desc "Log into Facebook and receive an access token"
124
+ desc "Request Facebook permissions and receive an API access token"
116
125
  command :login do |c|
117
126
  c.flag [:port], :desc => 'Local TCP port to serve Facebook login redirect page', :default_value => '3333'
118
127
  c.switch [:info], :desc => 'Show information about the current access token and exit', :negatable => false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facebook-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 1.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ildar Sagdejev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-30 00:00:00.000000000 Z
11
+ date: 2017-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: koala