gtasks 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/VERSION +1 -1
  2. data/bin/gtasks +14 -2
  3. data/gtasks.gemspec +1 -1
  4. data/lib/gtasks.rb +15 -0
  5. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
data/bin/gtasks CHANGED
@@ -4,6 +4,16 @@
4
4
  require 'gtasks'
5
5
  require 'logger'
6
6
  require 'pit'
7
+ require 'optparse'
8
+
9
+ options = {:debug_mode => false}
10
+ parser = OptionParser.new{ |opts|
11
+ opts.banner = "Usage: #{File.basename($0)}"
12
+ opts.on("-d", "--debug", "Debug Mode"){ |v|
13
+ options[:debug_mode] = true
14
+ }
15
+ }
16
+ parser.parse!
7
17
 
8
18
  config = Pit.get("gtasks", :require => {
9
19
  :client_id => 'your google tasks client id',
@@ -13,8 +23,8 @@ config = Pit.get("gtasks", :require => {
13
23
  cli = GoogleTaskCLI.new(
14
24
  :client_id => config[:client_id],
15
25
  :client_secret => config[:client_secret],
16
- :logger => Logger.new(STDERR),
17
- :callback_uri => 'http://localhost:8080/oauth2callback'
26
+ :logger => Logger.new(options[:debug_mode] ? STDERR : nil),
27
+ #:callback_uri => 'http://localhost:8080/oauth2callback'
18
28
  #:no_refresh => true
19
29
  )
20
30
 
@@ -27,6 +37,8 @@ when 'lists'
27
37
  when 'add'
28
38
  raise ArgumentError if ARGV.empty?
29
39
  cli.add(ARGV.join(' '))
40
+ when 'update'
41
+ cli.update(ARGV.shift, ARGV.shift)
30
42
  when 'clear'
31
43
  cli.clear
32
44
  when 'done'
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gtasks}
8
- s.version = "0.0.5"
8
+ s.version = "0.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["kimoto"]
@@ -297,6 +297,12 @@ class GoogleTask
297
297
  }
298
298
  end
299
299
 
300
+ def update(task_number, update_info = {}, list_ident = '@default')
301
+ task_proc(task_number) { |task|
302
+ @gs_api.task_update(list_ident, task["id"], update_info)
303
+ }
304
+ end
305
+
300
306
  def done(task_number, list_ident = '@default')
301
307
  task_proc(task_number) { |task|
302
308
  @gs_api.task_update(list_ident, task["id"], "status" => "completed")
@@ -422,6 +428,15 @@ class GoogleTaskCLI
422
428
  build_selector_format(rand_index, items[rand_index]).display
423
429
  end
424
430
 
431
+ def update(param, update_string)
432
+ if param =~ /^[0-9]+$/
433
+ @gtasks.update(param.to_i, "title" => update_string)
434
+ else
435
+ raise ArgumentError
436
+ end
437
+ list
438
+ end
439
+
425
440
  private
426
441
  # 指定された配列を番号表記の文字列に変換します
427
442
  def array_to_selector(array)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thoughtbot-shoulda
16
- requirement: &2153331280 !ruby/object:Gem::Requirement
16
+ requirement: &237466880 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2153331280
24
+ version_requirements: *237466880
25
25
  description: GoogleTasks CommandLine Interface
26
26
  email: sub+peerler@gmail.com
27
27
  executables: