gridcli 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  require 'active_support/core_ext'
2
+ require 'tempfile'
2
3
 
3
4
  module GridCLI
4
5
  class MessageCommand < BaseCommand
@@ -6,7 +7,7 @@ module GridCLI
6
7
  super "message", "Send a message to a friend or group of friends."
7
8
  add_option("-s subject", "--subject subject", "Subject for message") { |s| @opts[:subject] = s }
8
9
  add_option("-f file", "--file file", "File to use for message body") { |f| @opts[:file] = f }
9
- add_option("-b body", "--body body", "Message body") { |b| @opts[:body] = b }
10
+ add_option("-b body", "--body body", "Message body. If -b/-f aren't used, $EDITOR will be opened.") { |b| @opts[:body] = b }
10
11
  add_format_option
11
12
  end
12
13
 
@@ -15,7 +16,7 @@ module GridCLI
15
16
  end
16
17
 
17
18
  def run(args)
18
- usage if args.length < 2
19
+ usage if args.length == 0
19
20
  recipients = args.shift
20
21
  parse_opts args
21
22
 
@@ -25,6 +26,13 @@ module GridCLI
25
26
  body = File.read(@opts[:file])
26
27
  elsif not @opts[:body].nil?
27
28
  body = @opts[:body]
29
+ else
30
+ editor = ENV['EDITOR'] || 'vi'
31
+ tfile = Tempfile.new('gridmessage')
32
+ tfile.close
33
+ system("#{editor} #{tfile.path}")
34
+ body = File.read(tfile.path)
35
+ tfile.unlink
28
36
  end
29
37
 
30
38
  error("Body cannot be blank. Use one of -f or -b") if body.nil?
@@ -1,3 +1,3 @@
1
1
  module GridCLI
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,104 +1,82 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gridcli
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.3
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 0.1.4
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Brian Muller
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-06 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
12
+
13
+ date: 2012-10-11 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
15
16
  name: activeresource
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: 3.0.10
22
- type: :runtime
23
17
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: 3.0.10
30
- - !ruby/object:Gem::Dependency
31
- name: activesupport
32
- requirement: !ruby/object:Gem::Requirement
18
+ requirement: &id001 !ruby/object:Gem::Requirement
33
19
  none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
37
23
  version: 3.0.10
38
24
  type: :runtime
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: activesupport
39
28
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
29
+ requirement: &id002 !ruby/object:Gem::Requirement
41
30
  none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
45
34
  version: 3.0.10
46
- - !ruby/object:Gem::Dependency
47
- name: chronic
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: 0.6.4
54
35
  type: :runtime
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: chronic
55
39
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
40
+ requirement: &id003 !ruby/object:Gem::Requirement
57
41
  none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
61
45
  version: 0.6.4
62
- - !ruby/object:Gem::Dependency
63
- name: json
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: 1.6.1
70
46
  type: :runtime
47
+ version_requirements: *id003
48
+ - !ruby/object:Gem::Dependency
49
+ name: json
71
50
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
51
+ requirement: &id004 !ruby/object:Gem::Requirement
73
52
  none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
77
56
  version: 1.6.1
78
- - !ruby/object:Gem::Dependency
79
- name: colorize
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: 0.5.8
86
57
  type: :runtime
58
+ version_requirements: *id004
59
+ - !ruby/object:Gem::Dependency
60
+ name: colorize
87
61
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
62
+ requirement: &id005 !ruby/object:Gem::Requirement
89
63
  none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
93
67
  version: 0.5.8
94
- description: ! 'A command line interface to The Grid: Social Networking, Web 0.2'
95
- email:
68
+ type: :runtime
69
+ version_requirements: *id005
70
+ description: "A command line interface to The Grid: Social Networking, Web 0.2"
71
+ email:
96
72
  - bamuller@gmail.com
97
- executables:
73
+ executables:
98
74
  - grid
99
75
  extensions: []
76
+
100
77
  extra_rdoc_files: []
101
- files:
78
+
79
+ files:
102
80
  - .gitignore
103
81
  - .rvmrc
104
82
  - Gemfile
@@ -142,26 +120,30 @@ files:
142
120
  - lib/gridcli/ymlhash.rb
143
121
  homepage: http://gridcli.com
144
122
  licenses: []
123
+
145
124
  post_install_message:
146
125
  rdoc_options: []
147
- require_paths:
126
+
127
+ require_paths:
148
128
  - lib
149
- required_ruby_version: !ruby/object:Gem::Requirement
129
+ required_ruby_version: !ruby/object:Gem::Requirement
150
130
  none: false
151
- requirements:
152
- - - ! '>='
153
- - !ruby/object:Gem::Version
154
- version: '0'
155
- required_rubygems_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: "0"
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
136
  none: false
157
- requirements:
158
- - - ! '>='
159
- - !ruby/object:Gem::Version
160
- version: '0'
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: "0"
161
141
  requirements: []
142
+
162
143
  rubyforge_project: gridcli
163
144
  rubygems_version: 1.8.24
164
145
  signing_key:
165
146
  specification_version: 3
166
- summary: ! 'A command line interface to The Grid: Social Networking, Web 0.2'
147
+ summary: "A command line interface to The Grid: Social Networking, Web 0.2"
167
148
  test_files: []
149
+