ric 0.11.12 → 0.11.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY.yml +5 -0
- data/Manifest +0 -1
- data/VERSION +1 -1
- data/bin/septober +93 -35
- data/ric.gemspec +2 -2
- metadata +4 -4
data/HISTORY.yml
CHANGED
@@ -1,4 +1,9 @@
|
|
1
1
|
# would like to have this in YML format :)
|
2
|
+
2011-02-06 v0.11.13:
|
3
|
+
- septober v0.9.7 with better CLI
|
4
|
+
- reengineering septober yaml and help...
|
5
|
+
2011-02-06 v0.11.12:
|
6
|
+
- septober v0.9.6 with tags and other stuff
|
2
7
|
2011-02-06 v0.11.12:
|
3
8
|
- septober v0.9.6 with tags and other stuff
|
4
9
|
2011-02-06 v0.11.11:
|
data/Manifest
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.11.
|
1
|
+
0.11.13
|
data/bin/septober
CHANGED
@@ -2,24 +2,24 @@
|
|
2
2
|
|
3
3
|
=begin
|
4
4
|
############################################################
|
5
|
-
# $Id: script.rb 5582 2011-01-18 15:18:36Z rcarlesso $
|
6
|
-
##########################################################
|
7
5
|
@author: Riccardo Carlesso
|
8
|
-
@email: riccardo.carlesso@
|
6
|
+
@email: riccardo.carlesso@gmail.com
|
7
|
+
@url: http://github.com/palladius/septober
|
8
|
+
@script: septober
|
9
9
|
@maturity: development
|
10
10
|
@language: Ruby
|
11
|
-
@synopsis: Brief Description here
|
12
11
|
@tags: development, rcarlesso
|
12
|
+
@synopsis: This connects to septober websites. For more info, look here
|
13
13
|
@description:
|
14
14
|
septober.heroku.com client to add and list todos!
|
15
15
|
|
16
16
|
TODO
|
17
|
-
- add --conf|-c : to change configuration file
|
18
17
|
- add --context|-x : to change context (--local => --context 'local' , default: "septober" )
|
19
18
|
|
20
19
|
API: add actions (done, toggle, ..., due <today|tomorrow|monday> )
|
21
20
|
|
22
21
|
@history:
|
22
|
+
0.9.7 2011-02-09 mini banner WITH version (not to get nuts again thru versions!). --conf now works!
|
23
23
|
0.9.6 2011-02-09 CLI supports --conf now. Tags working!
|
24
24
|
0.9.5 2011-02-08 more concise 'add'
|
25
25
|
0.9.4 2011-02-04 added 'done' action (and 'delete' ?)
|
@@ -28,7 +28,7 @@
|
|
28
28
|
0.9.1 2011-01-18 First version
|
29
29
|
############################################################
|
30
30
|
=end
|
31
|
-
$PROG_VER = '0.9.
|
31
|
+
$PROG_VER = '0.9.7'
|
32
32
|
|
33
33
|
require 'optparse'
|
34
34
|
require 'rubygems'
|
@@ -36,23 +36,29 @@
|
|
36
36
|
require 'active_resource'
|
37
37
|
require 'socket'
|
38
38
|
|
39
|
+
include RubyClasses::Array
|
40
|
+
|
39
41
|
$DEBUG = false
|
40
42
|
|
41
43
|
$opts = {
|
42
44
|
:app_name => 'septober client',
|
43
45
|
:hello => 'Welcome to this terrific application',
|
44
46
|
:septober_url => 'http://septober.heroku.com/' ,
|
45
|
-
:dflt_config_file
|
47
|
+
:dflt_config_file => '~/.septober.yml' ,
|
46
48
|
:local => false ,
|
47
49
|
}
|
48
50
|
|
49
51
|
def init
|
50
|
-
|
51
|
-
|
52
|
-
|
52
|
+
$opts[:config_file] = $opts[:dflt_config_file]
|
53
|
+
#$colors_active = true
|
54
|
+
$optparse = OptionParser.new do |opts|
|
55
|
+
opts.on( '-c', '--config <FILE>', 'uses a different configfile from: '+$opts[:dflt_config_file] ) {|arg_file|
|
56
|
+
puts "Importing file different from default: #{yellow arg_file}"
|
57
|
+
$opts[:config_file] = arg_file
|
58
|
+
}
|
53
59
|
opts.on( '-d', '--debug', 'enables debug (DFLT=false)' ) { $opts[:debug] = true ; $debug = true ; debug_on('Debug enabled from ARGV')}
|
54
60
|
opts.on( '-h', '--help', 'Display this screen' ) { puts(opts); exit 1 }
|
55
|
-
opts.on( '-
|
61
|
+
opts.on( '-n', '--no-colors', 'Deactives colors (onta e disonore!)' ) { $colors_active = false }
|
56
62
|
opts.on( '-l', '--local', 'uses local instead' ) { $opts[:local] = true }
|
57
63
|
opts.on( '-v', '--verbose', 'Output more information' ) { $opts[:verbose] = true}
|
58
64
|
|
@@ -73,7 +79,7 @@ Usage: #{File.basename $0} [options] [add|list|done|del] [args]
|
|
73
79
|
Options:
|
74
80
|
API_OPTIONS
|
75
81
|
end
|
76
|
-
optparse.parse!
|
82
|
+
$optparse.parse!
|
77
83
|
RemoteTodo.import_config()
|
78
84
|
end
|
79
85
|
|
@@ -83,24 +89,50 @@ Usage: #{File.basename $0} [options] [add|list|done|del] [args]
|
|
83
89
|
self.element_name = 'todo'
|
84
90
|
self.timeout = 5
|
85
91
|
#self.proxy = nil
|
86
|
-
@@sample_yml_config =
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
92
|
+
@@sample_yml_config = <<-SAMPLE_YML_CONFIG
|
93
|
+
riccardo heroku: &DEVEL_LOCAL
|
94
|
+
# YAML file with septober configuration. For more info: http://septober.heroku.com/
|
95
|
+
site: "http://localhost:3000/api/" # or http://septober.heroku.com/api/
|
96
|
+
user: guest
|
97
|
+
password: guest
|
98
|
+
description: My Rails 3 development (guest//guest shuld work for real This is NOT a random thing)
|
99
|
+
RiccardoHeroku: &RICCARDO_HEROKU
|
100
|
+
site: "http://septober.heroku.com/api/" # or http://septober.heroku.com/api/
|
101
|
+
user: YOURUSERNAME
|
102
|
+
password: YOURPASSWORD
|
103
|
+
description: this server exists but is REALLY slow..
|
104
|
+
Your server:
|
105
|
+
site: http://your_server.example.com/api/
|
106
|
+
user: USERNAME
|
107
|
+
pass: V3ry_D1ff1cul1
|
108
|
+
description: you can use your own server. this is open source. Just remember to say Riccardo you think hes a genius. I dont want money, just fame.
|
109
|
+
#########################################################################################################
|
110
|
+
|
111
|
+
#########################################################################################################
|
112
|
+
# YAML file with septober configuration. For more info: http://septober.heroku.com/
|
113
|
+
# You just change here:
|
114
|
+
septober:
|
115
|
+
<<: *RICCARDO_HEROKU
|
116
|
+
septober_local:
|
117
|
+
<<: *DEVEL_LOCAL
|
118
|
+
|
119
|
+
SAMPLE_YML_CONFIG
|
120
|
+
|
91
121
|
# self.ssl_options = {:cert => OpenSSL::X509::Certificate.new(File.open(pem_file))
|
92
122
|
# :key => OpenSSL::PKey::RSA.new(File.open(pem_file)),
|
93
123
|
# :ca_path => "/path/to/OpenSSL/formatted/CA_Certs",
|
94
124
|
# :verify_mode => OpenSSL::SSL::VERIFY_PEER}
|
95
125
|
|
96
126
|
def self.import_config(file=nil)
|
97
|
-
file ||= $opts[:
|
127
|
+
file ||= $opts[:config_file]
|
98
128
|
real_file = File.expand_path file
|
99
129
|
deb "Importing config from #{file}.."
|
100
130
|
if File.exists?(real_file)
|
101
131
|
#puts "TODO import from #{file} (local=#{$opts[:local]})"
|
102
|
-
sub_conf = $opts[:local] ? 'septober_local' : 'septober'
|
103
|
-
|
132
|
+
sub_conf = $opts[:local] ? 'septober_local' : 'septober' # TODO remove local... put a generic subconf key, like 'wor', devel', ...
|
133
|
+
whole_hash = YAML.load_file(real_file) rescue {}
|
134
|
+
puts "Possible sub_confs: #{yellow whole_hash.keys.join(', ')}"
|
135
|
+
conf_hash = whole_hash[sub_conf] rescue nil
|
104
136
|
self.site = conf_hash['site']
|
105
137
|
self.user = conf_hash['user']
|
106
138
|
self.password = conf_hash['password']
|
@@ -146,26 +178,33 @@ Usage: #{File.basename $0} [options] [add|list|done|del] [args]
|
|
146
178
|
def show_entry(opts={})
|
147
179
|
mywhere = where ? azure( " @#{where}") : ''
|
148
180
|
mytags = (tag_list != [] ?
|
149
|
-
' '+tag_list.map{|tag|
|
181
|
+
' '+tag_list.map{|tag| orange("@#{tag}")}.join(' ') :
|
150
182
|
''
|
151
183
|
) rescue ''
|
152
184
|
return sprintf "%-3d %-30s %2s %s %s%s",
|
153
185
|
id, colored_project_name , priority_str(priority), colored_due_explaination(due), name, mywhere+mytags
|
154
186
|
end
|
155
187
|
|
188
|
+
def tags_comma_separated_list
|
189
|
+
orange(tag_list.join(', '))
|
190
|
+
end
|
191
|
+
|
192
|
+
def colored_name()
|
193
|
+
white(name)
|
194
|
+
end
|
195
|
+
|
156
196
|
def show_full_entry(opts={})
|
157
197
|
attributes = %w{
|
158
|
-
|
198
|
+
colored_name id
|
159
199
|
due hide_until
|
160
200
|
active depends_on_id
|
161
201
|
photo_url progress_status
|
162
|
-
source
|
202
|
+
source tags_comma_separated_list
|
163
203
|
url where
|
164
204
|
}
|
165
205
|
key_vals = attributes.map{|attr| [attr,send(attr)] } # array of [key, val]
|
166
|
-
key_vals << ['ProjectName', "#{project.name} (#{project.color
|
167
|
-
|
168
|
-
key_vals.map{|k,v| [k,v] }.sort{|x,y| x.first <=> y.first }.map{ |k,v| "#{k}: #{v}" }.join("\n") +
|
206
|
+
key_vals << ['ProjectName', "#{project.name} (#{send(project.color,project.color ) rescue white(project.color) })" ]
|
207
|
+
key_vals.map{|k,v| [k,v] }.select{|k,v| v.to_s != ''}.sort{|x,y| x.first <=> y.first }.map{ |k,v| "#{k}: #{v}" }.join("\n") +
|
169
208
|
"\n--\n#{description}"
|
170
209
|
end
|
171
210
|
end # /RemoteTodo
|
@@ -175,7 +214,7 @@ Usage: #{File.basename $0} [options] [add|list|done|del] [args]
|
|
175
214
|
# Program start..
|
176
215
|
|
177
216
|
def bannerino(desc)
|
178
|
-
"#
|
217
|
+
"#septober v#{$PROG_VER} #{white desc.to_s} (#{green RemoteTodo.user} @ #{cyan RemoteTodo.site.to_s.split('/')[2] })"
|
179
218
|
end
|
180
219
|
|
181
220
|
def todo_list(opts={})
|
@@ -184,7 +223,7 @@ Usage: #{File.basename $0} [options] [add|list|done|del] [args]
|
|
184
223
|
all = RemoteTodo.find(:all)
|
185
224
|
all.each{|todo|
|
186
225
|
puts( todo.show_entry ) unless( show_only_active && ! todo.active )
|
187
|
-
deb "Full ToString for #{white todo}:\n\t#{todo.inspect}"
|
226
|
+
#deb "Full ToString for #{white todo}:\n\t#{todo.inspect}"
|
188
227
|
} if all
|
189
228
|
end
|
190
229
|
|
@@ -234,7 +273,12 @@ Usage: #{File.basename $0} [options] [add|list|done|del] [args]
|
|
234
273
|
begin
|
235
274
|
todo = RemoteTodo.find(id)
|
236
275
|
puts "Todo.#{id} ok #{green action}: #{yellow( todo.to_s )}"
|
237
|
-
|
276
|
+
put_options = {
|
277
|
+
:my_action => action,
|
278
|
+
:from_cli_in_test_ric => Socket.gethostname
|
279
|
+
}.merge( opts.fetch( :additional_args, {:nis => :bah } ) ) # if there are ,m good. Otherwise, "nisba" :)
|
280
|
+
todo.put(action, put_options ) # test stuff
|
281
|
+
#todo.put(action, :my_action => action, :from_cli_in_test_ric => Socket.gethostname , additional_args) # test stuff
|
238
282
|
rescue ActiveResource::ResourceNotFound
|
239
283
|
puts "Sorry ResourceNotFound: #{red $!}"
|
240
284
|
exit 11
|
@@ -251,6 +295,12 @@ Usage: #{File.basename $0} [options] [add|list|done|del] [args]
|
|
251
295
|
pred "To Be implemented Yet"
|
252
296
|
end
|
253
297
|
|
298
|
+
def usage(explaination=nil)
|
299
|
+
puts $optparse
|
300
|
+
pred(explaination) if explaination
|
301
|
+
exit 85
|
302
|
+
end
|
303
|
+
|
254
304
|
|
255
305
|
def main()
|
256
306
|
init()
|
@@ -258,12 +308,20 @@ Usage: #{File.basename $0} [options] [add|list|done|del] [args]
|
|
258
308
|
#unless ARGV.size > 0
|
259
309
|
# usage "Give me at least 1 argument" # Maybe default to list?!?
|
260
310
|
#end
|
261
|
-
|
262
|
-
|
263
|
-
when '
|
264
|
-
when '
|
265
|
-
when '
|
266
|
-
|
311
|
+
all_args = ARGV[1..-1].join(' ')
|
312
|
+
case ARGV[0].to_s
|
313
|
+
when 'list' ; todo_list()
|
314
|
+
when 'show' ; todo_show(ARGV[1])
|
315
|
+
when 'done' ; todo_done(ARGV[1],true)
|
316
|
+
when 'add' ; todo_add(all_args) # all except last one
|
317
|
+
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
|
320
|
+
when 'tag' ; todo_generic_put(ARGV[1], :additional_args => {:tag_with => all_args.join(',') }) # all except last one
|
321
|
+
when 'help' ; usage 'Explicitly called help..'
|
322
|
+
when '' ; todo_list()
|
323
|
+
else
|
324
|
+
usage "Unrecognized command: '#{ARGV[0]}'"
|
267
325
|
end
|
268
326
|
end
|
269
327
|
|
data/ric.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{ric}
|
5
|
-
s.version = "0.11.
|
5
|
+
s.version = "0.11.13"
|
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"]
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
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", "
|
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"]
|
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:
|
4
|
+
hash: 41
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 11
|
9
|
-
-
|
10
|
-
version: 0.11.
|
9
|
+
- 13
|
10
|
+
version: 0.11.13
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Riccardo Carlesso
|
@@ -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
|
84
83
|
- sbin/reboot.rb
|
85
84
|
- sbin/ric_reboot.rb
|
86
85
|
- test/sample_conf.yml
|
87
86
|
- test/strings_helper.rb
|
88
87
|
- test/test_helper.rb
|
89
88
|
- var/www/index.html
|
89
|
+
- ric.gemspec
|
90
90
|
has_rdoc: true
|
91
91
|
homepage: http://github.com/palladius/riclib
|
92
92
|
licenses: []
|