facebookcl 0.3.4 → 0.4.0
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.
- data/README.markdown +10 -1
- data/VERSION +1 -1
- data/bin/facebook +28 -19
- data/facebookcl.gemspec +1 -1
- metadata +3 -3
data/README.markdown
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
FacebookCL
|
2
2
|
==========
|
3
3
|
|
4
|
+
** Source code available on [github](http://github.com/jubishop/facebookcl) **
|
5
|
+
|
4
6
|
Installation
|
5
7
|
------------
|
6
8
|
|
@@ -13,5 +15,12 @@ Installation
|
|
13
15
|
Usage
|
14
16
|
-----
|
15
17
|
|
18
|
+
For interactive shell:
|
19
|
+
|
16
20
|
* facebook
|
17
|
-
* [FacebookCL] help
|
21
|
+
* [FacebookCL] help
|
22
|
+
|
23
|
+
To just execute one command:
|
24
|
+
|
25
|
+
* facebook <single command>
|
26
|
+
* facebook help
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/bin/facebook
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
# built in
|
3
4
|
require 'readline'
|
4
5
|
require 'shellwords'
|
5
6
|
|
@@ -9,27 +10,35 @@ Dir.glob(__DIR__ + '/../commands/*.rb').each { |src| require src }
|
|
9
10
|
|
10
11
|
FacebookCL.authorize
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
if (ARGV.empty?)
|
14
|
+
# history management
|
15
|
+
HISTORY_FILENAME = "#{ENV['HOME']}/.FacebookCLHistory"
|
16
|
+
if (File.exists?(HISTORY_FILENAME))
|
17
|
+
history_text = File.open(HISTORY_FILENAME, 'r'){|file| file.read}
|
18
|
+
saved_history = JSON.parse(history_text)
|
19
|
+
saved_history.each { |historical_event|
|
20
|
+
Readline::HISTORY.push(historical_event)
|
21
|
+
}
|
22
|
+
end
|
20
23
|
|
21
|
-
at_exit {
|
22
|
-
|
23
|
-
|
24
|
+
at_exit {
|
25
|
+
File.open(HISTORY_FILENAME, 'w') { |file|
|
26
|
+
file.puts Readline::HISTORY.to_a.to_json
|
27
|
+
}
|
24
28
|
}
|
25
|
-
}
|
26
29
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
}
|
30
|
+
# command completion
|
31
|
+
METHODS = FacebookCommands.singleton_methods - ['method_missing']
|
32
|
+
Readline.completion_proc = proc {|s|
|
33
|
+
METHODS.grep(/^#{Regexp.escape(s)}/)
|
34
|
+
}
|
31
35
|
|
32
|
-
|
33
|
-
|
34
|
-
|
36
|
+
# interactive shell
|
37
|
+
while line = Readline::readline('[FacebookCL] ', true)
|
38
|
+
args = Shellwords.shellwords(line)
|
39
|
+
FacebookCommands.send(args.shift, *args)
|
40
|
+
end
|
41
|
+
else
|
42
|
+
# simply execute command provided from shell
|
43
|
+
FacebookCommands.send(ARGV.shift, *ARGV)
|
35
44
|
end
|
data/facebookcl.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facebookcl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 3
|
9
8
|
- 4
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Justin Bishop
|