ric 0.11.11 → 0.11.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,6 @@
1
1
  # would like to have this in YML format :)
2
+ 2011-02-06 v0.11.12:
3
+ - septober v0.9.6 with tags and other stuff
2
4
  2011-02-06 v0.11.11:
3
5
  - better septober add
4
6
  2011-02-06 v0.11.10:
data/Manifest CHANGED
@@ -20,9 +20,11 @@ lib/ric/debug.rb
20
20
  lib/ric/files.rb
21
21
  lib/ric/html.rb
22
22
  lib/ric/zibaldone.rb
23
+ lib/ruby_classes/arrays.rb
23
24
  lib/ruby_classes/strings.rb
24
25
  lib/tmp/uniquify.rb
25
26
  rails/init.rb
27
+ ric.gemspec
26
28
  sbin/reboot.rb
27
29
  sbin/ric_reboot.rb
28
30
  test/sample_conf.yml
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.11
1
+ 0.11.12
@@ -13,7 +13,14 @@
13
13
  @description:
14
14
  septober.heroku.com client to add and list todos!
15
15
 
16
+ TODO
17
+ - add --conf|-c : to change configuration file
18
+ - add --context|-x : to change context (--local => --context 'local' , default: "septober" )
19
+
20
+ API: add actions (done, toggle, ..., due <today|tomorrow|monday> )
21
+
16
22
  @history:
23
+ 0.9.6 2011-02-09 CLI supports --conf now. Tags working!
17
24
  0.9.5 2011-02-08 more concise 'add'
18
25
  0.9.4 2011-02-04 added 'done' action (and 'delete' ?)
19
26
  0.9.3 2011-02-04 better 'list'
@@ -21,7 +28,7 @@
21
28
  0.9.1 2011-01-18 First version
22
29
  ############################################################
23
30
  =end
24
- $PROG_VER = '0.9.5'
31
+ $PROG_VER = '0.9.6'
25
32
 
26
33
  require 'optparse'
27
34
  require 'rubygems'
@@ -35,10 +42,42 @@
35
42
  :app_name => 'septober client',
36
43
  :hello => 'Welcome to this terrific application',
37
44
  :septober_url => 'http://septober.heroku.com/' ,
38
- :dflt_config => '~/.septober.yml' ,
45
+ :dflt_config_file => '~/.septober.yml' ,
39
46
  :local => false ,
40
47
  }
48
+
49
+ def init
50
+ #$opts = {}
51
+ optparse = OptionParser.new do |opts|
52
+ opts.on( '-c', '--config <FILE>', 'uses a different configfile from: '+$opts[:dflt_config_file] ) {|arg_file| $opts[:config_file] = arg_file }
53
+ opts.on( '-d', '--debug', 'enables debug (DFLT=false)' ) { $opts[:debug] = true ; $debug = true ; debug_on('Debug enabled from ARGV')}
54
+ opts.on( '-h', '--help', 'Display this screen' ) { puts(opts); exit 1 }
55
+ opts.on( '-j', '--jabba', 'Activates my Jabber powerful CLI' ) { $opts[:jabba] = true }
56
+ opts.on( '-l', '--local', 'uses local instead' ) { $opts[:local] = true }
57
+ opts.on( '-v', '--verbose', 'Output more information' ) { $opts[:verbose] = true}
58
+
59
+ opts.banner = <<-API_OPTIONS
60
+ #{$0} v.#{$PROG_VER}
61
+ Usage: #{File.basename $0} [options] [add|list|done|del] [args]
41
62
 
63
+ API Actions (T stands for ToBeDoneYet ):
64
+ add <FREE TEXT> # adds new task in free text with some magic..
65
+ delete <ID> # T delete ticket.ID (DONT USE IF U CAN!)
66
+ done <ID> # T posts ticket.ID :done (resolved)
67
+ list # shows a list of your todos yet to complete
68
+ mail <ID> # T mail to yourself ticket.ID !!!
69
+ show <ID> # shows details about todo with id=ID
70
+ procrastinate <ID> <NDAYS> # T mail to yourself ticket.ID !!!
71
+ sleep <ID> <NDAYS> # T mail to yourself ticket.ID !!!
72
+
73
+ Options:
74
+ API_OPTIONS
75
+ end
76
+ optparse.parse!
77
+ RemoteTodo.import_config()
78
+ end
79
+
80
+ #################################################################################################################################################
42
81
  class RemoteTodo < ActiveResource::Base
43
82
  self.site = "http://septober.example.com/" # uninitialized
44
83
  self.element_name = 'todo'
@@ -49,14 +88,13 @@
49
88
  site: "http://localhost:3000/api/" # or http://septober.heroku.com/api/
50
89
  user: guest
51
90
  password: guest'
52
-
53
91
  # self.ssl_options = {:cert => OpenSSL::X509::Certificate.new(File.open(pem_file))
54
92
  # :key => OpenSSL::PKey::RSA.new(File.open(pem_file)),
55
93
  # :ca_path => "/path/to/OpenSSL/formatted/CA_Certs",
56
94
  # :verify_mode => OpenSSL::SSL::VERIFY_PEER}
57
95
 
58
96
  def self.import_config(file=nil)
59
- file ||= $opts[:dflt_config]
97
+ file ||= $opts[:dflt_config_file]
60
98
  real_file = File.expand_path file
61
99
  deb "Importing config from #{file}.."
62
100
  if File.exists?(real_file)
@@ -96,47 +134,46 @@
96
134
 
97
135
  def priority_str(priority)
98
136
  case priority.to_s
99
- when '1' ; return '--'
100
- when '2' ; return '-'
101
- when '3' ; return ' '
102
- when '4' ; return '!'
103
- when '5' ; return '!!'
137
+ when '1'; return '--'
138
+ when '2'; return '-'
139
+ when '3'; return ' '
140
+ when '4'; return '!'
141
+ when '5'; return '!!'
104
142
  end
105
143
  return "'?' #{priority}"
106
144
  end
107
145
 
108
146
  def show_entry(opts={})
109
147
  mywhere = where ? azure( " @#{where}") : ''
148
+ mytags = (tag_list != [] ?
149
+ ' '+tag_list.map{|tag| purple("@#{tag}")}.join(' ') :
150
+ ''
151
+ ) rescue ''
110
152
  return sprintf "%-3d %-30s %2s %s %s%s",
111
- id, colored_project_name , priority_str(priority), colored_due_explaination(due), name, mywhere
153
+ id, colored_project_name , priority_str(priority), colored_due_explaination(due), name, mywhere+mytags
112
154
  end
113
155
 
114
156
  def show_full_entry(opts={})
115
- attributes = %w{name id due where url progress_status active description }
157
+ attributes = %w{
158
+ name id
159
+ due hide_until
160
+ active depends_on_id
161
+ photo_url progress_status
162
+ source tag_list
163
+ url where
164
+ }
116
165
  key_vals = attributes.map{|attr| [attr,send(attr)] } # array of [key, val]
117
- key_vals << ['ProjectName', project.name ]
118
- key_vals.map{ |k,v| "#{k}: #{v}" }.join("\n")
166
+ key_vals << ['ProjectName', "#{project.name} (#{project.color.to_s.send( project.color ) rescue project.color})" ]
167
+ #key_vals << ['PjColor', project.color ]
168
+ key_vals.map{|k,v| [k,v] }.sort{|x,y| x.first <=> y.first }.map{ |k,v| "#{k}: #{v}" }.join("\n") +
169
+ "\n--\n#{description}"
119
170
  end
120
171
  end # /RemoteTodo
121
-
172
+ #################################################################################################################################################
122
173
 
123
174
  #############################
124
175
  # Program start..
125
176
 
126
- def usage(comment=nil)
127
- puts "#{$0} v.#{$PROG_VER}"
128
- puts "Usage: #{File.basename $0} [-dhjv] [--local] [--no-colors] OPTIONS"
129
- puts " add <FREE TEXT> # V adds new task in free text with some magic.."
130
- puts " delete <ID> # T delete ticket.ID (DONT USE IF U CAN!)"
131
- puts " list # V shows a list of your todos yet to complete"
132
- puts " show <ID> # V shows details about todo with id=ID"
133
- puts " done <ID> # T posts ticket.ID :done (resolved)"
134
- puts " mail <ID> # T mail to yourself ticket.ID !!!"
135
- #puts " search <QUERY> # look for TODOs relating to 'QUERY' string"
136
- pred comment if comment
137
- exit 78
138
- end
139
-
140
177
  def bannerino(desc)
141
178
  "#Todo #{white desc.to_s} (user: #{blue RemoteTodo.user}@#{cyan RemoteTodo.site.to_s.split('/')[2] })"
142
179
  end
@@ -147,6 +184,7 @@
147
184
  all = RemoteTodo.find(:all)
148
185
  all.each{|todo|
149
186
  puts( todo.show_entry ) unless( show_only_active && ! todo.active )
187
+ deb "Full ToString for #{white todo}:\n\t#{todo.inspect}"
150
188
  } if all
151
189
  end
152
190
 
@@ -188,7 +226,7 @@
188
226
  todo_generic_put(id,:done)
189
227
  end
190
228
  def todo_toggle(id,done_or_undone=true)
191
- todo_generic_put(id,:done)
229
+ todo_generic_put(id,:toggle)
192
230
  end
193
231
 
194
232
  def todo_generic_put(id,action,opts={})
@@ -213,34 +251,19 @@
213
251
  pred "To Be implemented Yet"
214
252
  end
215
253
 
216
- def init
217
- #$opts = {}
218
- optparse = OptionParser.new do |opts|
219
- opts.banner = "#{$0} v.#{$PROG_VER}\n Usage: #{File.basename $0} [add|list|done|del] [args]"
220
- opts.on( '-c', '--config', 'uses a different configfile from: '+$opts[:dflt_config] ) { $opts[:jabba] = true }
221
- opts.on( '-d', '--debug', 'enables debug (DFLT=false)' ) { $opts[:debug] = true }
222
- opts.on( '-h', '--help', 'Display this screen' ) { puts(opts); exit 1 }
223
- opts.on( '-j', '--jabba', 'Activates my Jabber powerful CLI' ) { $opts[:jabba] = true }
224
- opts.on( '-l', '--local', 'uses local instead' ) { $opts[:local] = true }
225
- opts.on( '-v', '--verbose', 'Output more information' ) { $opts[:verbose] = true}
226
- end
227
- optparse.parse!
228
- RemoteTodo.import_config()
229
- end
230
254
 
231
255
  def main()
232
256
  init()
233
257
  # Maybe you may want to check on ARGV
234
- unless ARGV.size > 0
235
- usage "Give me at least 1 argument" # Maybe default to list?!?
236
- end
237
- # i dont need it for help :)
258
+ #unless ARGV.size > 0
259
+ # usage "Give me at least 1 argument" # Maybe default to list?!?
260
+ #end
238
261
  case ARGV[0]
239
262
  when 'list' ; todo_list()
240
263
  when 'show' ; todo_show(ARGV[1])
241
264
  when 'done' ; todo_done(ARGV[1],true)
242
265
  when 'add' ; todo_add(ARGV[1..-1].join(' ')) # all except last one
243
- else ; usage "Unrecognized command: #{ARGV[0]}"
266
+ #else ; usage "Unrecognized command: #{ARGV[0]}"
244
267
  end
245
268
  end
246
269
 
data/lib/ric.rb CHANGED
@@ -7,6 +7,8 @@ require 'ric/debug'
7
7
  require 'ric/html'
8
8
  require 'ric/zibaldone'
9
9
 
10
+ require 'ruby_classes/arrays'
11
+
10
12
  module Ric
11
13
  #include Ric::Colors
12
14
 
@@ -19,4 +21,6 @@ end
19
21
  include Ric::Colors
20
22
  include Ric::Conf
21
23
  include Ric::Debug
22
- include Ric::Files
24
+ include Ric::Files
25
+
26
+ include RubyClasses::Array
@@ -0,0 +1,16 @@
1
+
2
+ module RubyClasses
3
+ module Array
4
+ class Array
5
+
6
+ def to_s
7
+ "RicArr[ #{self.join(', ') rescue "ErrArr(#{$!})" } ]"
8
+ end
9
+
10
+ def to_ric
11
+ "Array.toRic Test Gem"
12
+ end
13
+
14
+ end
15
+ end
16
+ end
@@ -2,18 +2,18 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ric}
5
- s.version = "0.11.11"
5
+ s.version = "0.11.12"
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-08}
9
+ s.date = %q{2011-02-09}
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
- 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/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/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"]
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", "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: 37
4
+ hash: 43
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 11
9
- - 11
10
- version: 0.11.11
9
+ - 12
10
+ version: 0.11.12
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-08 00:00:00 +00:00
18
+ date: 2011-02-09 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -50,6 +50,7 @@ extra_rdoc_files:
50
50
  - lib/ric/files.rb
51
51
  - lib/ric/html.rb
52
52
  - lib/ric/zibaldone.rb
53
+ - lib/ruby_classes/arrays.rb
53
54
  - lib/ruby_classes/strings.rb
54
55
  - lib/tmp/uniquify.rb
55
56
  files:
@@ -75,16 +76,17 @@ files:
75
76
  - lib/ric/files.rb
76
77
  - lib/ric/html.rb
77
78
  - lib/ric/zibaldone.rb
79
+ - lib/ruby_classes/arrays.rb
78
80
  - lib/ruby_classes/strings.rb
79
81
  - lib/tmp/uniquify.rb
80
82
  - rails/init.rb
83
+ - ric.gemspec
81
84
  - sbin/reboot.rb
82
85
  - sbin/ric_reboot.rb
83
86
  - test/sample_conf.yml
84
87
  - test/strings_helper.rb
85
88
  - test/test_helper.rb
86
89
  - var/www/index.html
87
- - ric.gemspec
88
90
  has_rdoc: true
89
91
  homepage: http://github.com/palladius/riclib
90
92
  licenses: []