yac 1.0.0 → 1.0.1
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/README.rdoc +2 -2
- data/lib/yac.rb +15 -10
- data/yac.gemspec +1 -1
- metadata +1 -1
    
        data/README.rdoc
    CHANGED
    
    | @@ -3,13 +3,13 @@ | |
| 3 3 |  | 
| 4 4 | 
             
            == What?
         | 
| 5 5 | 
             
              Cheat sheet is a concise set of notes used for quick reference.
         | 
| 6 | 
            -
              YAC is a simple sexy command line tool for easy control cheatsheet.
         | 
| 6 | 
            +
              YAC is a simple sexy command line tool for easy control cheatsheet.(Images can be found here: http://picasaweb.google.com/wosmvp/YacYetAnotherCheat)
         | 
| 7 7 | 
             
              Yes,It's support Image,PDF,Text, and can be easily enhance :)
         | 
| 8 8 | 
             
              Install, Use, Enjoy :)
         | 
| 9 9 |  | 
| 10 10 | 
             
            == Install
         | 
| 11 11 | 
             
               Make sure you have ruby,git in your system . then:
         | 
| 12 | 
            -
               $ (sudo) gem install yac -s http://gems.github.com | 
| 12 | 
            +
               $ (sudo) gem install yac -s http://gems.github.com
         | 
| 13 13 |  | 
| 14 14 | 
             
            == How To Use
         | 
| 15 15 |  | 
    
        data/lib/yac.rb
    CHANGED
    
    | @@ -117,8 +117,9 @@ module  Yac | |
| 117 117 | 
             
              def rename(args)
         | 
| 118 118 | 
             
                (colorful("Usage:\nyac mv [orign_name] [new_name]\n\nTry `yac -h` for more help","warn");exit) unless args.size == 2
         | 
| 119 119 | 
             
                file = search_name(args[0],"Rename")
         | 
| 120 | 
            -
                new_name =  | 
| 120 | 
            +
                new_name = add_file(args[1].sub(/^(@)?/,file =~ /^#{@main_path}/ ? "@":""),file.sub(/.*(\..*)/,'\1'))
         | 
| 121 121 | 
             
                if confirm("You Are Renaming #{file} To #{new_name}")
         | 
| 122 | 
            +
                  prepare_dir(new_name)
         | 
| 122 123 | 
             
                  `mv "#{file}" "#{new_name}"`
         | 
| 123 124 | 
             
                  @working_git.add
         | 
| 124 125 | 
             
                  @working_git.commit_all("#{clean_filename(file)} Renamed to #{clean_filename(new_name)}")
         | 
| @@ -127,21 +128,25 @@ module  Yac | |
| 127 128 |  | 
| 128 129 | 
             
              protected
         | 
| 129 130 | 
             
              def add_single(args)
         | 
| 131 | 
            +
                file = add_file(args)
         | 
| 132 | 
            +
                if confirm("You Are Adding #{file}")
         | 
| 133 | 
            +
                  edit_text(file)
         | 
| 134 | 
            +
                  @working_git.add
         | 
| 135 | 
            +
                  @working_git.commit_all("#{clean_filename(file)} Added")
         | 
| 136 | 
            +
                end
         | 
| 137 | 
            +
              end
         | 
| 138 | 
            +
             | 
| 139 | 
            +
              def add_file(args,suffix = ".ch")
         | 
| 130 140 | 
             
                if args.include?('/') && args =~ /(@?)(?:(.*)\/)(.+)/
         | 
| 131 141 | 
             
                  path = $1.empty? ? @pri_path : @main_path
         | 
| 132 142 | 
             
                  all_path = %x{
         | 
| 133 143 | 
             
                    find #{path} -type d -iwholename '#{path}*#{$2}*' -not -iwholename '*.git*'| sed 's/^.*\\(private\\|main\\)\\//#{$1}/'
         | 
| 134 144 | 
             
                  }.to_a
         | 
| 135 | 
            -
             | 
| 136 | 
            -
             | 
| 137 | 
            -
             | 
| 138 | 
            -
                end
         | 
| 139 | 
            -
                file = full_path(args+".ch")
         | 
| 140 | 
            -
                if confirm("You Are Adding #{file}")
         | 
| 141 | 
            -
                  edit_text(file)
         | 
| 142 | 
            -
                  @working_git.add
         | 
| 143 | 
            -
                  @working_git.commit_all("#{clean_filename(file)} Added")
         | 
| 145 | 
            +
                    colorful("Which directory do you want to use:","notice") if all_path.size >1
         | 
| 146 | 
            +
                    choosed_path = choose_one(all_path.concat([$1+$2]).uniq)
         | 
| 147 | 
            +
                    args = choosed_path + "/" + $3 if choosed_path
         | 
| 144 148 | 
             
                end
         | 
| 149 | 
            +
                file = full_path(args+suffix)
         | 
| 145 150 | 
             
              end
         | 
| 146 151 |  | 
| 147 152 | 
             
              def show_single(args)
         | 
    
        data/yac.gemspec
    CHANGED