off_github 1.0.3 → 1.1.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 +7 -1
- data/VERSION +1 -1
- data/bin/off_github +29 -5
- data/lib/off_github.rb +14 -12
- data/off_github.gemspec +2 -2
- metadata +2 -2
    
        data/README.rdoc
    CHANGED
    
    | @@ -6,5 +6,11 @@ A simple tool which helps migrate your locally installed gems from github to gem | |
| 6 6 |  | 
| 7 7 | 
             
              % sudo gem install off_github
         | 
| 8 8 | 
             
              % off_github
         | 
| 9 | 
            -
             | 
| 9 | 
            +
             | 
| 10 10 | 
             
            Follow instructions.
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            == Options
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              Use --help to see available options.
         | 
| 15 | 
            +
              Use --no-sudo to avoid using sudo.
         | 
| 16 | 
            +
              Use --dry to simulate the process.
         | 
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            1. | 
| 1 | 
            +
            1.1.1
         | 
    
        data/bin/off_github
    CHANGED
    
    | @@ -2,8 +2,32 @@ | |
| 2 2 | 
             
            require 'rubygems'
         | 
| 3 3 | 
             
            require 'off_github'
         | 
| 4 4 |  | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
               | 
| 9 | 
            -
             | 
| 5 | 
            +
            allowed_options = %w(--dry --no-sudo --help)
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            if invalid_arg = ARGV.find{ |arg| !allowed_options.include?(arg) }
         | 
| 8 | 
            +
              puts "Unrecognized option #{invalid_arg}"
         | 
| 9 | 
            +
              exit(0)
         | 
| 10 | 
            +
            end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            if ARGV.include? "--help"
         | 
| 13 | 
            +
              puts <<-HELP
         | 
| 14 | 
            +
              
         | 
| 15 | 
            +
            Available options:
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            --dry
         | 
| 18 | 
            +
                Run without actually executing anything.
         | 
| 19 | 
            +
                
         | 
| 20 | 
            +
            --no-sudo
         | 
| 21 | 
            +
                Don't use sudo when executing gem install/uninstall operations.
         | 
| 22 | 
            +
                
         | 
| 23 | 
            +
            --help
         | 
| 24 | 
            +
                Show this text.
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              HELP
         | 
| 27 | 
            +
              exit(0)
         | 
| 28 | 
            +
            end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            options = Hash[*ARGV.map{|arg| [arg.split('--')[1].to_sym, true]}.flatten]
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            puts "Maximize your terminal for better view.\nAnalyzing local and remote gems. This may take a bit...\n\n"
         | 
| 33 | 
            +
            OffGithub::Runner.run options
         | 
    
        data/lib/off_github.rb
    CHANGED
    
    | @@ -125,18 +125,16 @@ module OffGithub | |
| 125 125 | 
             
                def will_not_be_migrated
         | 
| 126 126 | 
             
                  @will_not_be_migrated ||= Hash[*relations.select{|k, v| !v}.flatten].keys
         | 
| 127 127 | 
             
                end
         | 
| 128 | 
            -
             | 
| 128 | 
            +
             | 
| 129 129 | 
             
                def stats
         | 
| 130 130 | 
             
                  <<-STATS
         | 
| 131 | 
            -
             | 
| 132 | 
            -
            GitHub gems found on #{GEMCUTTER_URL} (will be reinstalled):
         | 
| 133 131 | 
             
            #{Hirb::Helpers::AutoTable.render will_be_migrated_with_versions, :headers => [GITHUB_URL, GEMCUTTER_URL, "action"]}
         | 
| 134 132 |  | 
| 135 | 
            -
            reinstall  | 
| 136 | 
            -
             | 
| 137 | 
            -
             | 
| 133 | 
            +
            reinstall: Will reinstall from gemcutter.
         | 
| 134 | 
            +
            uninstall: Non-github gem already installed. Will remove github gem.
         | 
| 135 | 
            +
            skip: Gemcutter version is older. Will not do anything.
         | 
| 138 136 |  | 
| 139 | 
            -
             | 
| 137 | 
            +
            Couldn't find these gems on Gemcutter:
         | 
| 140 138 |  | 
| 141 139 | 
             
            #{will_not_be_migrated.join("\n")}
         | 
| 142 140 |  | 
| @@ -163,7 +161,10 @@ GitHub gems not found on #{GEMCUTTER_URL} (won't be touched): | |
| 163 161 | 
             
              end
         | 
| 164 162 |  | 
| 165 163 | 
             
              class Runner
         | 
| 166 | 
            -
                def self.run( | 
| 164 | 
            +
                def self.run(options = {})
         | 
| 165 | 
            +
                  @use_sudo = !options[:"no-sudo"]
         | 
| 166 | 
            +
                  @wet = !options[:dry]
         | 
| 167 | 
            +
                  
         | 
| 167 168 | 
             
                  unless Gem.sources.find{|g| g =~ /gemcutter/}
         | 
| 168 169 | 
             
                    puts "Looks like you don't have gemcutter installed as a source. Follow instructions at #{GEMCUTTER_URL} before running this tool.\n\n"
         | 
| 169 170 | 
             
                    return
         | 
| @@ -186,8 +187,8 @@ GitHub gems not found on #{GEMCUTTER_URL} (won't be touched): | |
| 186 187 | 
             
                        proceed = dont_ask ? "y" : STDIN.gets.strip
         | 
| 187 188 |  | 
| 188 189 | 
             
                        if proceed =~ /^[ya]$/
         | 
| 189 | 
            -
                          cmd " | 
| 190 | 
            -
                          cmd " | 
| 190 | 
            +
                          cmd "gem uninstall -axq --user-install #{github_gem}"
         | 
| 191 | 
            +
                          cmd "gem install #{gemcutter_gem} -s #{GEMCUTTER_URL}"
         | 
| 191 192 | 
             
                          puts "\n"
         | 
| 192 193 | 
             
                        end
         | 
| 193 194 | 
             
                      else
         | 
| @@ -195,7 +196,7 @@ GitHub gems not found on #{GEMCUTTER_URL} (won't be touched): | |
| 195 196 | 
             
                        proceed = dont_ask ? "y" : STDIN.gets.strip
         | 
| 196 197 |  | 
| 197 198 | 
             
                        if proceed =~ /^[ya]$/
         | 
| 198 | 
            -
                          cmd " | 
| 199 | 
            +
                          cmd "gem uninstall -axq --user-install #{github_gem}"
         | 
| 199 200 | 
             
                          puts "\n"
         | 
| 200 201 | 
             
                        end
         | 
| 201 202 | 
             
                      end
         | 
| @@ -211,8 +212,9 @@ GitHub gems not found on #{GEMCUTTER_URL} (won't be touched): | |
| 211 212 |  | 
| 212 213 | 
             
                private
         | 
| 213 214 | 
             
                def self.cmd(cmd, wet = false)
         | 
| 215 | 
            +
                  cmd = "sudo #{cmd}" if @use_sudo
         | 
| 214 216 | 
             
                  puts "running: #{cmd}"
         | 
| 215 | 
            -
                  system(cmd) if wet
         | 
| 217 | 
            +
                  system("sudo " + cmd) if @wet
         | 
| 216 218 | 
             
                end
         | 
| 217 219 | 
             
              end
         | 
| 218 220 | 
             
            end
         | 
    
        data/off_github.gemspec
    CHANGED
    
    | @@ -5,11 +5,11 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = %q{off_github}
         | 
| 8 | 
            -
              s.version = "1. | 
| 8 | 
            +
              s.version = "1.1.1"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Maxim Chernyak"]
         | 
| 12 | 
            -
              s.date = %q{2009- | 
| 12 | 
            +
              s.date = %q{2009-11-04}
         | 
| 13 13 | 
             
              s.default_executable = %q{off_github}
         | 
| 14 14 | 
             
              s.description = %q{A simple tool which helps migrate your locally installed gems from github to gemcutter. It will find all the gems installed from github and recognize them on gemcutter using some recursive string matching. It will then present you with a list of everything it will migrate and ask for permission before touching anything.}
         | 
| 15 15 | 
             
              s.email = %q{max@bitsonnet.com}
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: off_github
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.1.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors: 
         | 
| 7 7 | 
             
            - Maxim Chernyak
         | 
| @@ -9,7 +9,7 @@ autorequire: | |
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 11 |  | 
| 12 | 
            -
            date: 2009- | 
| 12 | 
            +
            date: 2009-11-04 00:00:00 -05:00
         | 
| 13 13 | 
             
            default_executable: off_github
         | 
| 14 14 | 
             
            dependencies: 
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency 
         |