{: rooto:"YARD::CodeObjects::RootObject:@childrenIC:&YARD::CodeObjects::CodeObjectList[o:#YARD::CodeObjects::ClassObject;IC;[ o:$YARD::CodeObjects::MethodObject:@module_functionF: @scope: instance:@visibility: public: @pathI"OrgToYaml#help_cont:EF:@parameters[: @files[[I"lib/my_help/org2yml.rb;Ti :@current_file_has_commentsF: @name:help_cont:@source_type: ruby: @tags[:@docstrings{:@docstringIC:YARD::Docstring"-Returns the value of attribute help_cont ;T;[:@ref_tags[: @allI"-Returns the value of attribute help_cont;T:@unresolved_reference0: @object@ : @summary0:@hash_flagF:@namespace@: @sourceI"#def help_cont @help_cont end;T:@signatureI"def help_cont;T: @dynamicTo; ; F; ; ;;;I"OrgToYaml#help_cont=;F;[[I" value;T0;[[@i ;F;:help_cont=;;;[;{;IC;"!Sets the attribute help_cont ;T;[o:YARD::Tags::Tag :@tag_nameI" param;F: @textI"1the value to set the attribute help_cont to.;T;I" value;T: @types0; @;[;I"[Sets the attribute help_cont @param value the value to set the attribute help_cont to.;T;0; @;!0;"F;#@;$I"3def help_cont=(value) @help_cont = value end;T;%I"def help_cont=(value);T;&To; ; F; ; ;;;I"OrgToYaml#initialize;F;[[I" file;T0;[[@i ;F;:initialize;;;[;{;IC;" ;T;[o;( ;)I" return;F;*I" a new instance of OrgToYaml;T;0;+[I"OrgToYaml;F; @+;[;I";T;0; @+:@ref_tag_recurse_counti;#@;$I"¬def initialize(file) @help_cont = {} #{ head: [File.basename(file, '.org')] } @head_sym = nil @conts = '' @short_stored = [] org_to_yaml(File.readlines(file)) end;T;%I"def initialize(file);T;&T:@explicitTo; ; F; ; ;;;I"OrgToYaml#make_options;F;[[I" line;T0;[[@i;F;:make_options;;;[;{;IC;" ;T;[;[;@<;0; @?;-i;#@;$I"def make_options(line) head, desc = line.split(':') desc ||= head.to_s short = "-#{head[0]}" if @short_stored.include?(short) or head=='license' or head=='head' short = '' else @short_stored << short end { short: short, long: "#{head}", desc: desc } end;T;%I"def make_options(line);T;&T;.To; ; F; ; ;;;I"OrgToYaml#next_cont;F;[[I" head;T0;[[@i!;F;:next_cont;;;[;{;IC;" ;T;[;[;@<;0; @M;-i;#@;$I"âdef next_cont(head) @help_cont[@head_sym][:cont] = @conts if @head_sym return if head == 'EOF' @conts = '' @head_sym = head.to_sym @help_cont[@head_sym] = { opts: make_options(head), title: head, cont: '' } end;T;%I"def next_cont(head);T;&T;.To; ; F; ; ;;;I"OrgToYaml#org_to_yaml;F;[[I" lines;T0;[[@i+;F;:org_to_yaml;;;[;{;IC;" ;T;[;[;@<;0; @[;-i;#@;$I"¦def org_to_yaml(lines) lines.each do |line| if m = line.match(/^\* (.+)/) next_cont m[1] else @conts << line end end next_cont 'EOF' end;T;%I"def org_to_yaml(lines);T;&T;.T: @owner@:@class_mixinsIC;[;2@:@instance_mixinsIC;[;2@:@attributesIC:SymbolHash{: classIC;6{:@symbolize_valueT; IC;6{;IC;6{: read@ : write@;8T;8T;8T: @aliases{: @groups[;[[@i ;F;:OrgToYaml;;;;;[;{;IC;" ;T;[;[;@<;0; @;-i;#@;I"OrgToYaml;F:@superclasso:YARD::CodeObjects::Proxy :@orignamespace0:@origname0: @imethod0;: Object;#@: @obj0: @type;7o:$YARD::CodeObjects::ModuleObject;IC;[o:&YARD::CodeObjects::ConstantObject;[[I"lib/my_help/version.rb;Ti;F;: VERSION;;;;;[;{;IC;" ;T;[;[;@<;0; @|;#@z;I"MyHelp::VERSION;F;%I"VERSION = "0.7.4";T;$I"VERSION = "0.7.4";T: @valueI" "0.7.4";T;&To; ;IC;[o; ; F; ; ;;;I"MyHelp::Control#initialize;F;[;[[I"$lib/my_help/my_help_controll.rb;Ti ;F;;,;;;[;{;IC;" ;T;[o;( ;)I" return;F;*I"a new instance of Control;T;0;+[I" Control;F; @†;[;@<;0; @†;-i;#@„;$I"ôdef initialize() @template_dir = File.expand_path("../../templates", __FILE__) @exe_dir = File.expand_path("../../exe", __FILE__) @local_help_dir = File.join(ENV['HOME'],'.my_help') # @mini_account = File set_help_dir_if_not_exists end;T;%I"def initialize();T;&T;.To; ; F; ; ;;;I"/MyHelp::Control#set_help_dir_if_not_exists;F;[;[[@‹i;F;:set_help_dir_if_not_exists;;;[;{;IC;" ;T;[;[;@<;0; @˜;-i;#@„;$I"ydef set_help_dir_if_not_exists return if File::exists?(@local_help_dir) FileUtils.mkdir_p(@local_help_dir, :verbose=>true) Dir.entries(@template_dir).each{|file| next if file=='help_template.org' file_path=File.join(@local_help_dir,file) next if File::exists?(file_path) FileUtils.cp((File.join(@template_dir,file)),@local_help_dir,:verbose=>true) } end;T;%I"#def set_help_dir_if_not_exists;T;&T;.To; ; F; ; ;;;I"MyHelp::Control#show_item;F;[[I" file;T0[I" item;T0;[[@‹i;F;:show_item;;;[;{;IC;" ;T;[;[;@<;0; @¤;-i;#@„;$I"êdef show_item(file, item) file_path=File.join(@local_help_dir,file+'.org') help = auto_load(file_path) select = select_item(help, item) print help[:head][:cont] puts '-'*5+"\n"+select.to_s.red print help[select][:cont] end;T;%I"def show_item(file, item);T;&T;.To; ; F; ; ;;;I" MyHelp::Control#select_item;F;[[I" help;T0[I" item;T0;[[@‹i%;F;:select_item;;;[;{;IC;" ;T;[;[;@<;0; @´;-i;#@„;$I"édef select_item(help, item) o_key = '' help.each_pair do |key, cont| next if key==:license or key==:head if cont[:opts][:short] == item or cont[:opts][:long] == item o_key = key break end end o_key end;T;%I" def select_item(help, item);T;&T;.To; ; F; ; ;;;I"MyHelp::Control#list_help;F;[[I" file;T0;[[@‹i1;F;:list_help;;;[;{;IC;" ;T;[;[;@<;0; @Ä;-i;#@„;$I"Òdef list_help(file) file_path=File.join(@local_help_dir,file+'.org') help = auto_load(file_path) help.each_pair do |key, conts| print conts[:cont] if key==:head disp_opts( conts[:opts] ) end end;T;%I"def list_help(file);T;&T;.To; ; F; ; ;;;I"MyHelp::Control#disp_opts;F;[[I" conts;T0;[[@‹i:;F;:disp_opts;;;[;{;IC;" ;T;[;[;@<;0; @Ò;-i;#@„;$I"def disp_opts( conts ) col = 0 conts.each_pair do |key, item| col_length = case col when 0; print item.rjust(5)+", " when 1; print item.ljust(15)+": " else; print item end col += 1 end print("\n") end;T;%I"def disp_opts( conts );T;&T;.To; ; F; ; ;;;I"MyHelp::Control#list_all;F;[;[[@‹iG;F;: list_all;;;[;{;IC;" ;T;[;[;@<;0; @à;-i;#@„;$I"Adef list_all print "List all helps\n" local_help_entries.each do |file| file_path=File.join(@local_help_dir,file) title = file.split('.')[0] help = auto_load(file_path) next if help.nil? desc = help[:head][:cont].split("\n")[0] print title.rjust(10).blue print ": #{desc}\n".blue end end;T;%I"def list_all;T;&T;.To; ; F; ; ;;;I"MyHelp::Control#edit_help;F;[[I" file;T0;[[@‹iT;F;:edit_help;;;[;{;IC;" ;T;[;[;@<;0; @ì;-i;#@„;$I"def edit_help(file) p target_help = File.join(@local_help_dir,file+'.org') if local_help_entries.member?(file+'.org') system "emacs #{target_help}" else puts "file #{target_help} does not exits in #{@local_help_dir}." puts "init #{file} first." end end;T;%I"def edit_help(file);T;&T;.To; ; F; ; ;;;I"MyHelp::Control#init_help;F;[[I" file;T0;[[@‹i^;F;:init_help;;;[;{;IC;" ;T;[;[;@<;0; @ú;-i;#@„;$I"[def init_help(file) if file.nil? puts "specify NAME".red exit end p target_help=File.join(@local_help_dir,file+'.org') if File::exists?(target_help) puts "File exists. delete it first to initialize it." exit end p template = File.join(@template_dir,'help_template.org') FileUtils::Verbose.cp(template,target_help) end;T;%I"def init_help(file);T;&T;.To; ; F; ; ;;;I" MyHelp::Control#delete_help;F;[[I" file;T0;[[@‹il;F;:delete_help;;;[;{;IC;" ;T;[;[;@<;0; @;-i;#@„;$I"+def delete_help(file) file = File.join(@local_help_dir,file+'.org') print "Are you sure to delete "+file.blue+"?[Ynq] ".red case STDIN.gets.chomp when 'Y' begin FileUtils.rm(file,:verbose=>true) rescue => error puts error.to_s.red end when 'n', 'q' ; exit end end;T;%I"def delete_help(file);T;&T;.To; ; F; ; ;;;I" MyHelp::Control#upload_help;F;[[I" file;T0;[[@‹iz;F;:upload_help;;;[;{;IC;" ;T;[;[;@<;0; @;-i;#@„;$I"âdef upload_help(file) p target_help = File.join(@local_help_dir,file+'.org') puts "miniã®user_nameを入力ã—ã¦ãã ã•ã„." p user_name = STDIN.gets.chomp puts "ä¿å­˜ã™ã‚‹ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªåを入力ã—ã¦ãã ã•ã„." p directory_name = STDIN.gets.chomp if local_help_entries.member?(file+'.org') # if target_help.empty?(file+'.org') # system "scp #{@local_help_dir} tomoko_y@mini:~/our_help/member/tomoko" # else system "scp #{target_help} #{user_name}@mini:~/our_help/member/#{directory_name}" puts "後ã¯ï¼Œminiã§gitã«pushã—ã¦ãã ã•ã„." # end else puts "file #{target_help} does not exits in #{@local_help_dir}." puts "init #{file} first." end end;T;%I"def upload_help(file);T;&T;.To; ; F; ; ;: private;I"'MyHelp::Control#local_help_entries;F;[;[[@‹i;F;:local_help_entries;;;[;{;IC;" ;T;[;[;@<;0; @$;-i;#@„;$I"mdef local_help_entries entries= [] Dir.entries(@local_help_dir).each{|file| # next unless file.include?('_') next if file[0]=='#' or file[-1]=='~' or file[0]=='.' # next if file.match(/(.+)_e\.org/) # OK? # next if file.match(/(.+)\.html/) if file.match(/(.+)\.org$/) # OK? entries << file end } return entries end;T;%I"def local_help_entries;T;&T;.To; ; F; ; ;;T;I"MyHelp::Control#auto_load;F;[[I"file_path;T0;[[@‹iž;F;:auto_load;;;[;{;IC;" ;T;[;[;@<;0; @0;-i;#@„;$I"def auto_load(file_path) case File.extname(file_path) # when '.yml' # cont = YAML.load(File.read(file_path)) when '.org' cont = OrgToYaml.new(file_path).help_cont else puts "Not handling file types of #{file_path}" cont = nil end cont end;T;%I"def auto_load(file_path);T;&T;.T;2@„;3IC;[;2@„;4IC;[;2@„;5IC;6{;7IC;6{;8T; IC;6{;8T;8T;;{;<[;[[@‹i;F;: Control;;;;;[;{;IC;" ;T;[;[;@<;0; @„;-i;#@z;I"MyHelp::Control;F;>o;? ;@0;A0;B0;;C;#@;D0;E;7;&T;2@z;3IC;[;2@z;4IC;[;2@z;5IC;6{;7IC;6{;8T; IC;6{;8T;8T;;{;<[;[[@i[@‹i;F;: MyHelp;;;;;[;{;IC;" ;T;[;[;@<;0; @z;-i;#@;I" MyHelp;F;2@;3IC;[;2@;4IC;[;2@;5IC;6{;7IC;6{;8T; IC;6{;8T;8T;;{;<[;[;F;;;;;;;[;{;IC;" ;T;[;[;@<;0; @;-i;#0;@<;=@:OrgToYaml#help_cont@ :OrgToYaml#help_cont=@:OrgToYaml#initialize@+:OrgToYaml#make_options@?:OrgToYaml#next_cont@M:OrgToYaml#org_to_yaml@[;X@z:MyHelp::VERSION@|:MyHelp::Control@„:MyHelp::Control#initialize@†:/MyHelp::Control#set_help_dir_if_not_exists@˜:MyHelp::Control#show_item@¤: MyHelp::Control#select_item@´:MyHelp::Control#list_help@Ä:MyHelp::Control#disp_opts@Ò:MyHelp::Control#list_all@à:MyHelp::Control#edit_help@ì:MyHelp::Control#init_help@ú: MyHelp::Control#delete_help@: MyHelp::Control#upload_help@:'MyHelp::Control#local_help_entries@$:MyHelp::Control#auto_load@0