class RemoteTodo
Public Class Methods
description()
click to toggle source
# File bin/septober 183 def self.description 184 @@description ||= '-' 185 end
description=(desc)
click to toggle source
# File bin/septober 187 def self.description=(desc) 188 @@description = desc 189 end
import_config(file=nil)
click to toggle source
self.ssl_options = {:cert => OpenSSL::X509::Certificate.new(File.open(pem_file))
:key => OpenSSL::PKey::RSA.new(File.open(pem_file)), :ca_path => "/path/to/OpenSSL/formatted/CA_Certs", :verify_mode => OpenSSL::SSL::VERIFY_PEER}
# File bin/septober 157 def self.import_config(file=nil) 158 file ||= $opts[:config_file] 159 real_file = File.expand_path file 160 deb "Importing config from #{file}.." 161 if File.exists?(real_file) 162 #puts "TODO import from #{file} (local=#{$opts[:local]})" 163 sub_conf = $opts[:local] ? 'septober_local' : 'septober' # TODO remove local... put a generic subconf key, like 'wor', devel', ... 164 whole_hash = YAML.load_file(real_file) rescue {} 165 puts "Possible sub_confs: #{yellow whole_hash.keys.join(', ')}" 166 conf_hash = whole_hash[sub_conf] rescue nil 167 self.site = conf_hash['site'] 168 self.user = conf_hash['user'] 169 self.password = conf_hash['password'] 170 self.description = conf_hash['description'] rescue '-' 171 deb "Conf imported successuflly: #{blue self.user}@#{self.site}" 172 else 173 pred "Missing file: #{file} !!! Try to do the following:" 174 puts "cat > #{file}\n#{@@sample_yml_config rescue "Err#{$!}" }" 175 exit 79 176 end 177 end
Public Instance Methods
colored_due_explaination(override_explaination=nil)
click to toggle source
TODO put this into todo.rb model and add it to the controller like “cli_colored_string” and “cli_neutral_string”
# File bin/septober 196 def colored_due_explaination(override_explaination=nil) 197 mycolor = case due_explaination 198 when 'overdue' ; :red 199 when 'close' ; :yellow 200 when 'far' ; :green 201 else ; :gray 202 #default ; :gray 203 end 204 return colora(mycolor, override_explaination || due_explaination) 205 end
colored_name()
click to toggle source
# File bin/septober 232 def colored_name() 233 white(name) 234 end
colored_project_name()
click to toggle source
# File bin/septober 191 def colored_project_name() 192 colora(project.color || :grey ,project.name) 193 end
priority_str(priority)
click to toggle source
# File bin/septober 207 def priority_str(priority) 208 case priority.to_s 209 when '1'; return '--' 210 when '2'; return '-' 211 when '3'; return ' ' 212 when '4'; return '!' 213 when '5'; return '!!' 214 end 215 return "'?' #{priority}" 216 end
show_entry(opts={})
click to toggle source
# File bin/septober 218 def show_entry(opts={}) 219 mywhere = where ? azure( " @#{where}") : '' 220 mytags = (tag_list != [] ? 221 ' '+tag_list.map{|tag| orange("@#{tag}")}.join(' ') : 222 '' 223 ) rescue '' 224 return sprintf "%-3d %-30s %2s %s %s%s", 225 id, colored_project_name , priority_str(priority), colored_due_explaination(due), name, mywhere+mytags 226 end
show_full_entry(opts={})
click to toggle source
# File bin/septober 236 def show_full_entry(opts={}) 237 attributes = %w{ 238 colored_name id 239 due hide_until 240 active depends_on_id 241 photo_url progress_status 242 source tags_comma_separated_list 243 url where 244 } 245 key_vals = attributes.map{|attr| [attr,send(attr)] } # array of [key, val] 246 key_vals << ['ProjectName', "#{project.name} (#{send(project.color,project.color ) rescue white(project.color) })" ] 247 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") + 248 "\n--\n#{description}" 249 end
to_s()
click to toggle source
# File bin/septober 179 def to_s 180 self.name 181 end