specific_install 0.3.3 → 0.3.4
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.
- checksums.yaml +4 -4
- data/README.md +17 -5
- data/lib/rubygems/commands/specific_install_command.rb +24 -12
- data/lib/specific_install/version.rb +1 -1
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 67fb17da19b930aa9bf3fb9b35cef97e1a97d559
         | 
| 4 | 
            +
              data.tar.gz: 6f7a3649c0128acf2c8c0c6f743a8c2794603dc0
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 9ac4fa8753d88955819d1c38a4f5e41d0fa20d77ff90e27027445702b8cc4b9734584dfc57b3539c52680bebfc72940a3494a56364bdcd82953bb554359b6c6a
         | 
| 7 | 
            +
              data.tar.gz: 2414feaa06887345b6d9eea0d279a0a61cd37a8661b94205d805fd4b17b4ace2d93c4e8863cb024afc5d26e813227dc0d9830aaeb67e44ba346e846e876e4af3
         | 
    
        data/README.md
    CHANGED
    
    | @@ -16,7 +16,7 @@ Or install it yourself as: | |
| 16 16 |  | 
| 17 17 | 
             
            ## Usage
         | 
| 18 18 |  | 
| 19 | 
            -
            A Rubygem plugin that allows you to install an "edge" gem straight from its github repository, | 
| 19 | 
            +
            A Rubygem plugin that allows you to install an "edge" gem straight from its github repository,
         | 
| 20 20 | 
             
              or install one from an arbitrary url web:
         | 
| 21 21 |  | 
| 22 22 | 
             
            ex:
         | 
| @@ -47,12 +47,18 @@ Or a specific branch in an explicit way | |
| 47 47 | 
             
              $ gem specific_install -l http://github.com/githubsvnclone/rdoc.git -b edge
         | 
| 48 48 | 
             
            `
         | 
| 49 49 |  | 
| 50 | 
            -
            Or a specific subdirectory in a repo | 
| 50 | 
            +
            Or a specific subdirectory in a repo
         | 
| 51 51 |  | 
| 52 52 | 
             
            `
         | 
| 53 53 | 
             
              $ gem specific_install https://github.com/orlandohill/waxeye -d src/ruby
         | 
| 54 54 | 
             
            `
         | 
| 55 55 |  | 
| 56 | 
            +
            Or install in the users personal gem directory
         | 
| 57 | 
            +
             | 
| 58 | 
            +
            `
         | 
| 59 | 
            +
              $ gem specific_install https://github.com/orlandohill/waxeye -u
         | 
| 60 | 
            +
            `
         | 
| 61 | 
            +
             | 
| 56 62 | 
             
            The following URI types are accepted:
         | 
| 57 63 |  | 
| 58 64 | 
             
            - http(s)://github.com/rdp/specific_install.git
         | 
| @@ -64,7 +70,7 @@ The following URI types are accepted: | |
| 64 70 |  | 
| 65 71 | 
             
            ### Additional Options
         | 
| 66 72 |  | 
| 67 | 
            -
                -l --location URL of resource | 
| 73 | 
            +
                -l --location URL of resource
         | 
| 68 74 | 
             
                  Formats of URL/Resource
         | 
| 69 75 | 
             
                    * Full URL to HTTP Repo `https://github.com/rdp/specific_install.git`
         | 
| 70 76 | 
             
                    * Full URL to Git Repo  `git@github.com:rdp/specific_install.git`
         | 
| @@ -79,13 +85,19 @@ The following URI types are accepted: | |
| 79 85 |  | 
| 80 86 | 
             
                -d --directory DIRECTORY in source
         | 
| 81 87 | 
             
                  This will change the directory in the downloaded source directory
         | 
| 82 | 
            -
                  before building the gem. | 
| 88 | 
            +
                  before building the gem.
         | 
| 89 | 
            +
             | 
| 90 | 
            +
                -r, --ref COMMIT-ISH to use for Gem creation
         | 
| 91 | 
            +
                  Ref option does a `git reset --hard COMMIT-ISH` before `gem build GEM`
         | 
| 92 | 
            +
             | 
| 93 | 
            +
                -u, --user-install to indicate that the gem should be unpacked into the users personal gem directory.
         | 
| 94 | 
            +
                  This will install the gem in the user folder making it possible to use specific_install without root access.
         | 
| 83 95 |  | 
| 84 96 | 
             
                `git_install` is aliased to the behavior of `specific_install`
         | 
| 85 97 | 
             
                  This alias is shorter and is more intention revealing of the gem's behavior.
         | 
| 86 98 | 
             
            ## Internal Behavior
         | 
| 87 99 |  | 
| 88 | 
            -
            It runs `git clone`, and `rake install,` install the gem, then deletes the temp directory | 
| 100 | 
            +
            It runs `git clone`, and `rake install,` install the gem, then deletes the temp directory.
         | 
| 89 101 |  | 
| 90 102 | 
             
            ## Compatibility
         | 
| 91 103 |  | 
| @@ -1,8 +1,5 @@ | |
| 1 1 | 
             
            require 'rubygems/command_manager'
         | 
| 2 2 | 
             
            require 'rubygems/dependency_installer'
         | 
| 3 | 
            -
            require 'tempfile'
         | 
| 4 | 
            -
            require 'fileutils'
         | 
| 5 | 
            -
            require 'open-uri'
         | 
| 6 3 |  | 
| 7 4 | 
             
            class Gem::Commands::SpecificInstallCommand < Gem::Command
         | 
| 8 5 | 
             
              attr_accessor :output
         | 
| @@ -30,6 +27,10 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command | |
| 30 27 | 
             
                add_option('-r', '--ref COMMIT-ISH', arguments) do |ref, options|
         | 
| 31 28 | 
             
                  options[:ref] = ref
         | 
| 32 29 | 
             
                end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                add_option('-u', '--user-install', arguments) do |userinstall, options|
         | 
| 32 | 
            +
                  options[:userinstall] = userinstall
         | 
| 33 | 
            +
                end
         | 
| 33 34 | 
             
              end
         | 
| 34 35 |  | 
| 35 36 | 
             
              def arguments
         | 
| @@ -49,6 +50,7 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command | |
| 49 50 | 
             
                if @loc.nil?
         | 
| 50 51 | 
             
                  raise ArgumentError, "No location received. Use like `gem specific_install -l http://example.com/rdp/specific_install`"
         | 
| 51 52 | 
             
                end
         | 
| 53 | 
            +
                require 'tempfile' if not defined?(Tempfile)
         | 
| 52 54 | 
             
                Dir.mktmpdir do |dir|
         | 
| 53 55 | 
             
                  if subdir = options[:directory]
         | 
| 54 56 | 
             
                    abort("Subdir '#{subdir}' is not a valid directory") unless valid_subdir?(subdir)
         | 
| @@ -61,6 +63,13 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command | |
| 61 63 | 
             
                end
         | 
| 62 64 | 
             
              end
         | 
| 63 65 |  | 
| 66 | 
            +
              private
         | 
| 67 | 
            +
             | 
| 68 | 
            +
              def git(*commands)
         | 
| 69 | 
            +
                system "git #{commands.join(' ').chomp(' ')}"
         | 
| 70 | 
            +
                raise "'$ git #{commands.join(' ').chomp(' ')}' exited with an error" if $?.exitstatus != 0
         | 
| 71 | 
            +
              end
         | 
| 72 | 
            +
             | 
| 64 73 | 
             
              def break_unless_git_present
         | 
| 65 74 | 
             
                unless system("which git") || system("where git")
         | 
| 66 75 | 
             
                  abort("Please install git before using a git based link for specific_install")
         | 
| @@ -105,7 +114,7 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command | |
| 105 114 | 
             
                @loc = [@loc, '.git'].join unless @loc[/\.git$/]
         | 
| 106 115 |  | 
| 107 116 | 
             
                redirect_for_specs = ENV.fetch( "SPECIFIC_INSTALL_SPEC" ) { "" }
         | 
| 108 | 
            -
                 | 
| 117 | 
            +
                git "clone", @loc, @top_dir, redirect_for_specs
         | 
| 109 118 | 
             
                install_from_git(@src_dir)
         | 
| 110 119 | 
             
              end
         | 
| 111 120 |  | 
| @@ -117,7 +126,7 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command | |
| 117 126 | 
             
                output.puts 'git installing from ' + @loc
         | 
| 118 127 |  | 
| 119 128 | 
             
                redirect_for_specs = ENV.fetch( "SPECIFIC_INSTALL_SPEC" ) { "" }
         | 
| 120 | 
            -
                 | 
| 129 | 
            +
                git "clone", @loc, @top_dir, redirect_for_specs
         | 
| 121 130 | 
             
                install_from_git(@src_dir)
         | 
| 122 131 | 
             
              end
         | 
| 123 132 |  | 
| @@ -125,11 +134,12 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command | |
| 125 134 | 
             
                output.puts "Installing from git@github.com:#{@loc}.git"
         | 
| 126 135 |  | 
| 127 136 | 
             
                redirect_for_specs = ENV.fetch( "SPECIFIC_INSTALL_SPEC" ) { "" }
         | 
| 128 | 
            -
                 | 
| 137 | 
            +
                git "clone", "git@github.com:#{@loc}.git", @topdir, redirect_for_specs
         | 
| 129 138 | 
             
                install_from_git(@src_dir)
         | 
| 130 139 | 
             
              end
         | 
| 131 140 |  | 
| 132 141 | 
             
              def download( full_url, output_name )
         | 
| 142 | 
            +
                require 'open-uri' if not defined?(OpenURI)
         | 
| 133 143 | 
             
                File.open(output_name, "wb") do |output_file|
         | 
| 134 144 | 
             
                  uri = URI.parse(full_url)
         | 
| 135 145 | 
             
                  output_file.write(uri.read)
         | 
| @@ -140,7 +150,7 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command | |
| 140 150 | 
             
                Dir.chdir @top_dir do
         | 
| 141 151 | 
             
                  change_to_branch(@branch) if @branch
         | 
| 142 152 | 
             
                  reset_to_commit(@ref) if @ref
         | 
| 143 | 
            -
                   | 
| 153 | 
            +
                  git "submodule", "update", "--init", "--recursive" # Issue 25
         | 
| 144 154 | 
             
                end
         | 
| 145 155 |  | 
| 146 156 | 
             
                Dir.chdir dir do
         | 
| @@ -181,7 +191,9 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command | |
| 181 191 | 
             
              def install_gemspec
         | 
| 182 192 | 
             
                gem = find_or_build_gem
         | 
| 183 193 | 
             
                if gem
         | 
| 184 | 
            -
                   | 
| 194 | 
            +
                  install_options = {}
         | 
| 195 | 
            +
                  install_options[:user_install] = options[:userinstall].nil? ? nil : true
         | 
| 196 | 
            +
                  inst = Gem::DependencyInstaller.new install_options
         | 
| 185 197 | 
             
                  inst.install gem
         | 
| 186 198 | 
             
                else
         | 
| 187 199 | 
             
                  nil
         | 
| @@ -220,13 +232,13 @@ class Gem::Commands::SpecificInstallCommand < Gem::Command | |
| 220 232 | 
             
              end
         | 
| 221 233 |  | 
| 222 234 | 
             
              def change_to_branch(branch)
         | 
| 223 | 
            -
                 | 
| 224 | 
            -
                 | 
| 235 | 
            +
                git "checkout", branch
         | 
| 236 | 
            +
                git "branch"
         | 
| 225 237 | 
             
              end
         | 
| 226 238 |  | 
| 227 239 | 
             
              def reset_to_commit(ref)
         | 
| 228 | 
            -
                 | 
| 229 | 
            -
                 | 
| 240 | 
            +
                git "reset", "--hard", ref
         | 
| 241 | 
            +
                git "show", "-q"
         | 
| 230 242 | 
             
              end
         | 
| 231 243 |  | 
| 232 244 | 
             
              DOTDOT_REGEX = /(?:#{File::PATH_SEPARATOR}|\A)\.\.(?:#{File::PATH_SEPARATOR}|\z)/.freeze
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: specific_install
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.3. | 
| 4 | 
            +
              version: 0.3.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Roger Pack
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date:  | 
| 12 | 
            +
            date: 2018-07-28 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: rspec
         | 
| @@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 137 137 | 
             
                  version: '0'
         | 
| 138 138 | 
             
            requirements: []
         | 
| 139 139 | 
             
            rubyforge_project: "[none]"
         | 
| 140 | 
            -
            rubygems_version: 2.5.2
         | 
| 140 | 
            +
            rubygems_version: 2.5.2.3
         | 
| 141 141 | 
             
            signing_key: 
         | 
| 142 142 | 
             
            specification_version: 4
         | 
| 143 143 | 
             
            summary: rubygems plugin that allows you you to install a gem from from its github
         |