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.
Files changed (5) hide show
  1. data/README.markdown +10 -1
  2. data/VERSION +1 -1
  3. data/bin/facebook +28 -19
  4. data/facebookcl.gemspec +1 -1
  5. metadata +3 -3
@@ -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.3.4
1
+ 0.4.0
@@ -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
- HISTORY_FILENAME = "#{ENV['HOME']}/.FacebookCLHistory"
13
- if (File.exists?(HISTORY_FILENAME))
14
- history_text = File.open(HISTORY_FILENAME, 'r'){|file| file.read}
15
- saved_history = JSON.parse(history_text)
16
- saved_history.each { |historical_event|
17
- Readline::HISTORY.push(historical_event)
18
- }
19
- end
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
- File.open(HISTORY_FILENAME, 'w') { |file|
23
- file.puts Readline::HISTORY.to_a.to_json
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
- METHODS = FacebookCommands.singleton_methods - ['method_missing']
28
- Readline.completion_proc = proc {|s|
29
- METHODS.grep(/^#{Regexp.escape(s)}/)
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
- while line = Readline::readline('[FacebookCL] ', true)
33
- args = Shellwords.shellwords(line)
34
- FacebookCommands.send(args.shift, *args)
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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{facebookcl}
8
- s.version = "0.3.4"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Justin Bishop"]
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: 27
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 3
9
8
  - 4
10
- version: 0.3.4
9
+ - 0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Justin Bishop