gridcli 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -0
- data/lib/gridcli/commands/base.rb +4 -0
- data/lib/gridcli/commands/dislike.rb +4 -3
- data/lib/gridcli/commands/like.rb +4 -3
- data/lib/gridcli/commands/signup.rb +1 -1
- data/lib/gridcli/commands/status.rb +4 -3
- data/lib/gridcli/commands/update.rb +2 -0
- data/lib/gridcli/version.rb +1 -1
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -105,5 +105,6 @@ This command will install the gem "grid-plugin-echo" and load it each time the g
|
|
105
105
|
* before_post_creation(post_hash)
|
106
106
|
* before_signup(username)
|
107
107
|
* before_update
|
108
|
+
* after_update
|
108
109
|
|
109
110
|
and prints out a message whenever a user signs up, a post is created, or the update command is called. You can see the code for the echo module at https://github.com/bmuller/grid-plugin-echo.
|
@@ -20,6 +20,10 @@ module GridCLI
|
|
20
20
|
@optp.on(*args) { |u| yield u }
|
21
21
|
end
|
22
22
|
|
23
|
+
def pop_arg(args, default=nil)
|
24
|
+
(args.length != 0 and not args.first.start_with?('-')) ? args.shift : default
|
25
|
+
end
|
26
|
+
|
23
27
|
def add_format_option
|
24
28
|
msg = "Specify output format (json, cmdcolor, cmd, textline)"
|
25
29
|
add_option("-o format", "--output-format format", msg) { |o|
|
@@ -1,22 +1,23 @@
|
|
1
1
|
module GridCLI
|
2
2
|
class DislikeCommand < BaseCommand
|
3
3
|
def initialize
|
4
|
-
super "dislike", "Dislike something."
|
4
|
+
super "dislike", "Dislike something. Specify friends/subgrids to restrict recipients."
|
5
5
|
add_format_option
|
6
6
|
end
|
7
7
|
|
8
8
|
def usage
|
9
|
-
super "<dislike>"
|
9
|
+
super "<dislike> [<username>[,<username>]]"
|
10
10
|
end
|
11
11
|
|
12
12
|
def run(args)
|
13
13
|
usage if args.length == 0
|
14
14
|
body = args.shift
|
15
|
+
recipients = pop_arg(args, "friends")
|
15
16
|
parse_opts args
|
16
17
|
|
17
18
|
begin
|
18
19
|
log "Trying to send a dislike '#{body}' to your friends"
|
19
|
-
post = Post::Dislike.create :body => body, :recipients =>
|
20
|
+
post = Post::Dislike.create :body => body, :recipients => recipients, :posttype => 'dislike'
|
20
21
|
rescue ActiveResource::ClientError
|
21
22
|
puts "There was an error sending your dislike. Please make sure it's not empty."
|
22
23
|
return
|
@@ -1,22 +1,23 @@
|
|
1
1
|
module GridCLI
|
2
2
|
class LikeCommand < BaseCommand
|
3
3
|
def initialize
|
4
|
-
super "like", "Like something."
|
4
|
+
super "like", "Like something. Specify friends/subgrids to restrict recipients."
|
5
5
|
add_format_option
|
6
6
|
end
|
7
7
|
|
8
8
|
def usage
|
9
|
-
super "<like>"
|
9
|
+
super "<like> [<username>[,<username>]]"
|
10
10
|
end
|
11
11
|
|
12
12
|
def run(args)
|
13
13
|
usage if args.length == 0
|
14
14
|
body = args.shift
|
15
|
+
recipients = pop_arg(args, "friends")
|
15
16
|
parse_opts args
|
16
17
|
|
17
18
|
begin
|
18
19
|
log "Trying to send a like '#{body}' to your friends"
|
19
|
-
post = Post::Like.create :body => body, :recipients =>
|
20
|
+
post = Post::Like.create :body => body, :recipients => recipients, :posttype => 'like'
|
20
21
|
rescue ActiveResource::ClientError
|
21
22
|
puts "There was an error sending your like. Please make sure it's not empty."
|
22
23
|
return
|
@@ -24,7 +24,7 @@ module GridCLI
|
|
24
24
|
User.new(:username => username, :token => @config['token']).save
|
25
25
|
puts "New user created. You are now known as '#{username}'"
|
26
26
|
rescue ActiveResource::ClientError
|
27
|
-
puts "Sorry, username '#{username}' already exists."
|
27
|
+
puts "Sorry, username '#{username}' already exists or contains non-alphanumeric characters."
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -1,22 +1,23 @@
|
|
1
1
|
module GridCLI
|
2
2
|
class StatusCommand < BaseCommand
|
3
3
|
def initialize
|
4
|
-
super "status", "Send a status update to all friends."
|
4
|
+
super "status", "Send a status update to all friends (or specific ones)."
|
5
5
|
add_format_option
|
6
6
|
end
|
7
7
|
|
8
8
|
def usage
|
9
|
-
super "<status>"
|
9
|
+
super "<status> [<username>[,<username>]]"
|
10
10
|
end
|
11
11
|
|
12
12
|
def run(args)
|
13
13
|
usage if args.length == 0
|
14
14
|
body = args.shift
|
15
|
+
recipients = pop_arg(args, "friends")
|
15
16
|
parse_opts args
|
16
17
|
|
17
18
|
begin
|
18
19
|
log "Trying to send a status update '#{body}' to your friends"
|
19
|
-
post = Post::Status.create :body => body, :recipients =>
|
20
|
+
post = Post::Status.create :body => body, :recipients => recipients, :posttype => 'status'
|
20
21
|
rescue ActiveResource::ClientError
|
21
22
|
puts "There was an error sending your status. Please make sure it's not empty."
|
22
23
|
return
|
data/lib/gridcli/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gridcli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 12
|
10
|
+
version: 0.0.12
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Muller
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-10-
|
18
|
+
date: 2011-10-11 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|