Sha256: 59013aacaae2cd3227e659cfed7ee5f40dbd17a11cd1b20c1762d30d668f6842

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

class Jeweler
  module Commands
    class BuildGem
      attr_accessor :base_dir, :gemspec_helper, :file_utils, :version_helper

      def initialize
        self.file_utils = FileUtils
      end

      def run
        gemspec_helper.update_version(version_helper) unless gemspec_helper.has_version?

        gemspec = gemspec_helper.parse

        if Gem::Version.new(`gem -v`) >= Gem::Version.new("2.0.0.a")
          gem_file_name = Gem::Package.build(gemspec)
        else
          require "rubygems/builder"
          gem_file_name = Gem::Builder.new(gemspec).build
        end

        pkg_dir = File.join(base_dir, 'pkg')
        file_utils.mkdir_p pkg_dir

        gem_file_name = File.join(base_dir, gem_file_name)
        file_utils.mv gem_file_name, pkg_dir
      end

      def self.build_for(jeweler)
        command = new

        command.base_dir = jeweler.base_dir
        command.gemspec_helper = jeweler.gemspec_helper
        command.version_helper = jeweler.version_helper

        command
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
jeweler-2.1.1 lib/jeweler/commands/build_gem.rb
jeweler-2.0.1 lib/jeweler/commands/build_gem.rb
jeweler-2.0.0 lib/jeweler/commands/build_gem.rb
jeweler-1.8.8 lib/jeweler/commands/build_gem.rb
jeweler-1.8.7 lib/jeweler/commands/build_gem.rb
jeweler-1.8.6 lib/jeweler/commands/build_gem.rb
jeweler-1.8.5 lib/jeweler/commands/build_gem.rb