ric 0.11.13 → 0.11.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/HISTORY.yml +2 -0
  2. data/Manifest +1 -0
  3. data/VERSION +1 -1
  4. data/bin/septober +55 -21
  5. data/ric.gemspec +3 -3
  6. metadata +5 -5
@@ -1,4 +1,6 @@
1
1
  # would like to have this in YML format :)
2
+ 2011-02-06 v0.11.14:
3
+ - septober v0.9.8 with timeout and :edit
2
4
  2011-02-06 v0.11.13:
3
5
  - septober v0.9.7 with better CLI
4
6
  - reengineering septober yaml and help...
data/Manifest CHANGED
@@ -24,6 +24,7 @@ lib/ruby_classes/arrays.rb
24
24
  lib/ruby_classes/strings.rb
25
25
  lib/tmp/uniquify.rb
26
26
  rails/init.rb
27
+ ric.gemspec
27
28
  sbin/reboot.rb
28
29
  sbin/ric_reboot.rb
29
30
  test/sample_conf.yml
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.13
1
+ 0.11.14
@@ -11,14 +11,20 @@
11
11
  @tags: development, rcarlesso
12
12
  @synopsis: This connects to septober websites. For more info, look here
13
13
  @description:
14
- septober.heroku.com client to add and list todos!
14
+ septober.heroku.com client to add and list todos!
15
15
 
16
- TODO
17
- - add --context|-x : to change context (--local => --context 'local' , default: "septober" )
18
-
19
- API: add actions (done, toggle, ..., due <today|tomorrow|monday> )
16
+ TODO
17
+ - add --context|-x : to change context (--local => --context 'local' , default: "septober" )
20
18
 
19
+ API: add actions (done, toggle, ..., due <today|tomorrow|monday> )
20
+ ###########################################################
21
+ =end
22
+
23
+ $PROG_VER = '0.9.8'
24
+
25
+ =begin
21
26
  @history:
27
+ 0.9.8 2011-02-10 Added timeout (works) and a broken prototype for :edit
22
28
  0.9.7 2011-02-09 mini banner WITH version (not to get nuts again thru versions!). --conf now works!
23
29
  0.9.6 2011-02-09 CLI supports --conf now. Tags working!
24
30
  0.9.5 2011-02-08 more concise 'add'
@@ -26,9 +32,8 @@
26
32
  0.9.3 2011-02-04 better 'list'
27
33
  0.9.2 2011-02-04 'add' operation succefully added!
28
34
  0.9.1 2011-01-18 First version
29
- ############################################################
30
35
  =end
31
- $PROG_VER = '0.9.7'
36
+
32
37
 
33
38
  require 'optparse'
34
39
  require 'rubygems'
@@ -46,21 +51,25 @@
46
51
  :septober_url => 'http://septober.heroku.com/' ,
47
52
  :dflt_config_file => '~/.septober.yml' ,
48
53
  :local => false ,
54
+ :timeout => 7 ,
49
55
  }
50
56
 
51
57
  def init
52
58
  $opts[:config_file] = $opts[:dflt_config_file]
53
- #$colors_active = true
54
59
  $optparse = OptionParser.new do |opts|
55
60
  opts.on( '-c', '--config <FILE>', 'uses a different configfile from: '+$opts[:dflt_config_file] ) {|arg_file|
56
61
  puts "Importing file different from default: #{yellow arg_file}"
57
62
  $opts[:config_file] = arg_file
58
63
  }
59
- opts.on( '-d', '--debug', 'enables debug (DFLT=false)' ) { $opts[:debug] = true ; $debug = true ; debug_on('Debug enabled from ARGV')}
60
- opts.on( '-h', '--help', 'Display this screen' ) { puts(opts); exit 1 }
64
+ opts.on( '-d', '--debug', 'enables debug (DFLT=false)' ) { $opts[:debug] = true ; $debug = true ; debug_on('Debug enabled from ARGV')}
65
+ opts.on( '-h', '--help', 'Display this screen' ) { puts(opts); exit 1 }
61
66
  opts.on( '-n', '--no-colors', 'Deactives colors (onta e disonore!)' ) { $colors_active = false }
62
- opts.on( '-l', '--local', 'uses local instead' ) { $opts[:local] = true }
63
- opts.on( '-v', '--verbose', 'Output more information' ) { $opts[:verbose] = true}
67
+ opts.on( '-l', '--local', 'uses local instead' ) { $opts[:local] = true }
68
+ opts.on( '-t', '--timeout TIMEOUT', "Sets timeout (default =#{$opts[:timeout]}s)" ) {|new_timeout|
69
+ $opts[:timeout] = new_timeout.to_i rescue 5
70
+ RemoteTodo.timeout = new_timeout.to_i rescue 5
71
+ }
72
+ opts.on( '-v', '--verbose', 'Output more information' ) { $opts[:verbose] = true}
64
73
 
65
74
  opts.banner = <<-API_OPTIONS
66
75
  #{$0} v.#{$PROG_VER}
@@ -70,12 +79,19 @@ Usage: #{File.basename $0} [options] [add|list|done|del] [args]
70
79
  add <FREE TEXT> # adds new task in free text with some magic..
71
80
  delete <ID> # T delete ticket.ID (DONT USE IF U CAN!)
72
81
  done <ID> # T posts ticket.ID :done (resolved)
82
+ edit <ID> [ACTION1:ARG1] [ACT2:ARG2]# T posts generic action for ticket.ID /edit.xml?due=tomorrow&ACT2=ARG2
73
83
  list # shows a list of your todos yet to complete
74
84
  mail <ID> # T mail to yourself ticket.ID !!!
75
85
  show <ID> # shows details about todo with id=ID
76
86
  procrastinate <ID> <NDAYS> # T mail to yourself ticket.ID !!!
77
87
  sleep <ID> <NDAYS> # T mail to yourself ticket.ID !!!
78
-
88
+
89
+ Examples:
90
+ septober --local edit 110 due:tomorrow
91
+ septober list
92
+ septober show 1
93
+ septober add 'This is a ticket with priority 4 and a simple @example tag!'
94
+
79
95
  Options:
80
96
  API_OPTIONS
81
97
  end
@@ -85,10 +101,14 @@ Usage: #{File.basename $0} [options] [add|list|done|del] [args]
85
101
 
86
102
  #################################################################################################################################################
87
103
  class RemoteTodo < ActiveResource::Base
88
- self.site = "http://septober.example.com/" # uninitialized
104
+ # With a singleton u can define the accessors of the class (attr accessor for self!)
105
+ #class << self
106
+ # attr_accessor :description # = '-'
107
+ #end
108
+ self.site = "http://septober.example.com/" # uninitialized
89
109
  self.element_name = 'todo'
90
- self.timeout = 5
91
- #self.proxy = nil
110
+ self.timeout = $opts[:timeout] rescue 6
111
+
92
112
  @@sample_yml_config = <<-SAMPLE_YML_CONFIG
93
113
  riccardo heroku: &DEVEL_LOCAL
94
114
  # YAML file with septober configuration. For more info: http://septober.heroku.com/
@@ -136,6 +156,7 @@ SAMPLE_YML_CONFIG
136
156
  self.site = conf_hash['site']
137
157
  self.user = conf_hash['user']
138
158
  self.password = conf_hash['password']
159
+ self.description = conf_hash['description'] rescue '-'
139
160
  deb "Conf imported successuflly: #{blue self.user}@#{self.site}"
140
161
  else
141
162
  pred "Missing file: #{file} !!! Try to do the following:"
@@ -148,6 +169,14 @@ SAMPLE_YML_CONFIG
148
169
  self.name
149
170
  end
150
171
 
172
+ def self.description
173
+ @@description ||= '-'
174
+ end
175
+
176
+ def self.description=(desc)
177
+ @@description = desc
178
+ end
179
+
151
180
  def colored_project_name()
152
181
  colora(project.color || :grey ,project.name)
153
182
  end
@@ -213,8 +242,10 @@ SAMPLE_YML_CONFIG
213
242
  #############################
214
243
  # Program start..
215
244
 
245
+ # header
216
246
  def bannerino(desc)
217
- "#septober v#{$PROG_VER} #{white desc.to_s} (#{green RemoteTodo.user} @ #{cyan RemoteTodo.site.to_s.split('/')[2] })"
247
+ "#septober v#{$PROG_VER} #{white desc.to_s} (#{green RemoteTodo.user} @ #{cyan RemoteTodo.site.to_s.split('/')[2] }, timeout=#{RemoteTodo.timeout})" +
248
+ (RemoteTodo.description.length > 2 ? " # #{gray RemoteTodo.description}" : '')
218
249
  end
219
250
 
220
251
  def todo_list(opts={})
@@ -232,7 +263,7 @@ SAMPLE_YML_CONFIG
232
263
  to assing the correct ptoject and stuff..
233
264
  =end
234
265
  def todo_add(words_from_argv)
235
- puts bannerino( "Add(#{words_from_argv})" )
266
+ puts bannerino( "Add('#{words_from_argv}')" )
236
267
  # TODO put this into begin/end/catch !!!
237
268
  t = RemoteTodo.create(
238
269
  :name => words_from_argv,
@@ -277,6 +308,7 @@ SAMPLE_YML_CONFIG
277
308
  :my_action => action,
278
309
  :from_cli_in_test_ric => Socket.gethostname
279
310
  }.merge( opts.fetch( :additional_args, {:nis => :bah } ) ) # if there are ,m good. Otherwise, "nisba" :)
311
+ deb "todo_generic_put(id=#{id},#{purple action}, #{gray opts.inspect})"
280
312
  todo.put(action, put_options ) # test stuff
281
313
  #todo.put(action, :my_action => action, :from_cli_in_test_ric => Socket.gethostname , additional_args) # test stuff
282
314
  rescue ActiveResource::ResourceNotFound
@@ -308,15 +340,17 @@ SAMPLE_YML_CONFIG
308
340
  #unless ARGV.size > 0
309
341
  # usage "Give me at least 1 argument" # Maybe default to list?!?
310
342
  #end
311
- all_args = ARGV[1..-1].join(' ')
343
+ all_args = ARGV[1..-1].join(' ') rescue ''
312
344
  case ARGV[0].to_s
313
345
  when 'list' ; todo_list()
314
346
  when 'show' ; todo_show(ARGV[1])
315
347
  when 'done' ; todo_done(ARGV[1],true)
316
348
  when 'add' ; todo_add(all_args) # all except last one
317
349
  when 'toggle'; todo_toggle(ARGV[1]) # all except last one
318
- when 'delete'; todo_generic_put(ARGV[1], :delete , :additional_args => {:test_foo => 'test deletion string, please removeme' }) # all except last one
319
- #when 'del'; copy
350
+ when 'delete'; todo_generic_put(ARGV[1], :delete , :additional_args => {:test_foo => 'test deletion string, with whole DELETE' })
351
+ when 'del'; todo_generic_put(ARGV[1], :delete , :additional_args => {:test_foo => 'test deletion string, with just DEL' })
352
+ when 'edit'; todo_generic_put(ARGV[1], :edit, :additional_args => ARGV.map{|arg| k,v=arg.split(':') } )
353
+ # TODO transform [ [act1, arg1], [act2,arg2]] into {:act1 => arg1, :act2 => arg2 }
320
354
  when 'tag' ; todo_generic_put(ARGV[1], :additional_args => {:tag_with => all_args.join(',') }) # all except last one
321
355
  when 'help' ; usage 'Explicitly called help..'
322
356
  when '' ; todo_list()
@@ -2,18 +2,18 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ric}
5
- s.version = "0.11.13"
5
+ s.version = "0.11.14"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Riccardo Carlesso"]
9
- s.date = %q{2011-02-09}
9
+ s.date = %q{2011-02-10}
10
10
  s.description = %q{My first gem with various utilities (colors and tests now).
11
11
  My name is Riccardo, hence 'ric' (ok I admit it, this was just ot prove Im able to build a sentence
12
12
  with hence!)}
13
13
  s.email = %q{['p','ll','diusbonton].join('a') @ gmail.com}
14
14
  s.executables = ["itunes", "ric", "riclib-test", "septober", "xcopy"]
15
15
  s.extra_rdoc_files = ["LICENSE", "README.md", "TODO", "bin/itunes", "bin/ric", "bin/riclib-test", "bin/septober", "bin/xcopy", "lib/rails/acts_as_carlesso.rb", "lib/rails/helpers/rails_helper.rb", "lib/ric.rb", "lib/ric/colors.rb", "lib/ric/conf.rb", "lib/ric/debug.rb", "lib/ric/files.rb", "lib/ric/html.rb", "lib/ric/zibaldone.rb", "lib/ruby_classes/arrays.rb", "lib/ruby_classes/strings.rb", "lib/tmp/uniquify.rb"]
16
- s.files = ["HISTORY.yml", "LICENSE", "Manifest", "README.md", "Rakefile", "TODO", "VERSION", "bin/itunes", "bin/ric", "bin/riclib-test", "bin/septober", "bin/xcopy", "init.rb", "lib/rails/acts_as_carlesso.rb", "lib/rails/helpers/rails_helper.rb", "lib/ric.rb", "lib/ric/colors.rb", "lib/ric/conf.rb", "lib/ric/debug.rb", "lib/ric/files.rb", "lib/ric/html.rb", "lib/ric/zibaldone.rb", "lib/ruby_classes/arrays.rb", "lib/ruby_classes/strings.rb", "lib/tmp/uniquify.rb", "rails/init.rb", "sbin/reboot.rb", "sbin/ric_reboot.rb", "test/sample_conf.yml", "test/strings_helper.rb", "test/test_helper.rb", "var/www/index.html", "ric.gemspec"]
16
+ s.files = ["HISTORY.yml", "LICENSE", "Manifest", "README.md", "Rakefile", "TODO", "VERSION", "bin/itunes", "bin/ric", "bin/riclib-test", "bin/septober", "bin/xcopy", "init.rb", "lib/rails/acts_as_carlesso.rb", "lib/rails/helpers/rails_helper.rb", "lib/ric.rb", "lib/ric/colors.rb", "lib/ric/conf.rb", "lib/ric/debug.rb", "lib/ric/files.rb", "lib/ric/html.rb", "lib/ric/zibaldone.rb", "lib/ruby_classes/arrays.rb", "lib/ruby_classes/strings.rb", "lib/tmp/uniquify.rb", "rails/init.rb", "ric.gemspec", "sbin/reboot.rb", "sbin/ric_reboot.rb", "test/sample_conf.yml", "test/strings_helper.rb", "test/test_helper.rb", "var/www/index.html"]
17
17
  s.homepage = %q{http://github.com/palladius/riclib}
18
18
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Ric", "--main", "README.md"]
19
19
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ric
3
3
  version: !ruby/object:Gem::Version
4
- hash: 41
4
+ hash: 47
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 11
9
- - 13
10
- version: 0.11.13
9
+ - 14
10
+ version: 0.11.14
11
11
  platform: ruby
12
12
  authors:
13
13
  - Riccardo Carlesso
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-09 00:00:00 +00:00
18
+ date: 2011-02-10 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -80,13 +80,13 @@ files:
80
80
  - lib/ruby_classes/strings.rb
81
81
  - lib/tmp/uniquify.rb
82
82
  - rails/init.rb
83
+ - ric.gemspec
83
84
  - sbin/reboot.rb
84
85
  - sbin/ric_reboot.rb
85
86
  - test/sample_conf.yml
86
87
  - test/strings_helper.rb
87
88
  - test/test_helper.rb
88
89
  - var/www/index.html
89
- - ric.gemspec
90
90
  has_rdoc: true
91
91
  homepage: http://github.com/palladius/riclib
92
92
  licenses: []