Sha256: 1fda616d49e95820c9e0ff5568c00dc106f063763c64de85a61d2855d62d290f

Contents?: true

Size: 1.42 KB

Versions: 48

Compression:

Stored size: 1.42 KB

Contents

class Jeweler
  module Commands
    class PreReleaseToGit
      attr_accessor :gemspec, :version, :repo, :output, :gemspec_helper, :base_dir

      def initialize(attributes = {})
        self.output = $stdout

        attributes.each_pair do |key, value|
          send("#{key}=", value)
        end
      end

      def run
        unless clean_staging_area?
          system "git status"
          raise "Unclean staging area! Be sure to commit or .gitignore everything first. See `git status` above."
        end

        repo.checkout('develop')
        repo.push

        if release_not_tagged?
          output.puts "Tagging #{release_tag}"
          repo.add_tag(release_tag)

          output.puts "Pushing #{release_tag} to origin"
          repo.push('origin', release_tag)
        end
      end

      def clean_staging_area?
        `git ls-files --deleted --modified --others --exclude-standard` == ""
      end

      def release_tag
        "v#{version}"
      end

      def release_not_tagged?
        tag = repo.tag(release_tag) rescue nil
        tag.nil?
      end

      def self.build_for(jeweler)
        command = self.new

        command.base_dir = jeweler.base_dir
        command.gemspec = jeweler.gemspec
        command.version = jeweler.version
        command.repo = jeweler.repo
        command.output = jeweler.output
        command.gemspec_helper = jeweler.gemspec_helper

        command
      end
    end
  end
end

Version data entries

48 entries across 48 versions & 5 rubygems

Version Path
buildr-hx-0.0.8.pre rake/pre_release_to_git.rb
buildr-hx-0.0.7.pre rake/pre_release_to_git.rb
buildr-hx-0.0.6.pre rake/pre_release_to_git.rb
buildr-hx-0.0.5.pre rake/pre_release_to_git.rb
buildr-hx-0.0.4.pre rake/pre_release_to_git.rb
buildr-hx-0.0.3.pre rake/pre_release_to_git.rb
buildr-hx-0.0.2.pre rake/pre_release_to_git.rb
buildr-hx-0.0.1.pre rake/pre_release_to_git.rb
buildr-as3-0.2.30.pre rake/pre_release_to_git.rb
buildr-as3-0.2.29.pre rake/pre_release_to_git.rb
buildr-as3-0.2.28.pre rake/pre_release_to_git.rb
buildr-as3-0.2.27.pre rake/pre_release_to_git.rb
buildr-as3-0.2.26.pre rake/pre_release_to_git.rb
gator-as3-0.0.13.pre rake/pre_release_to_git.rb
gator-0.0.25.pre rake/pre_release_to_git.rb
buildr-as3-0.2.25.pre rake/pre_release_to_git.rb
gator-0.0.24.pre rake/pre_release_to_git.rb
buildr-as3-0.2.24.pre rake/pre_release_to_git.rb
buildr-as3-0.2.23.pre rake/pre_release_to_git.rb
gator-as3-0.0.12.pre rake/pre_release_to_git.rb