Sha256: 57d459a2a1f3de6efb0f047bd3e317214f031e130d164ab392106afe9d3fa7b9

Contents?: true

Size: 1.31 KB

Versions: 117

Compression:

Stored size: 1.31 KB

Contents

require 'pathname'

class Jeweler
  module Commands
    module Version
      class Base

        attr_accessor :repo, :version_helper, :gemspec, :commit, :base_dir

        def run
          update_version

          self.version_helper.write
          self.gemspec.version = self.version_helper.to_s

          commit_version if self.repo && self.commit
        end

        def update_version
          raise "Subclasses should implement this"
        end

        def commit_version
          if self.repo
            self.repo.add(working_subdir.join(version_helper.path))
            self.repo.commit("Version bump to #{self.version_helper.to_s}")
          end
        end

        def working_subdir
          return @working_subdir if @working_subdir
          cwd = base_dir_path
          @working_subdir = cwd.relative_path_from(Pathname.new(repo.dir.path))
          @working_subdir
        end

        def base_dir_path
          Pathname.new(base_dir).realpath
        end


        def self.build_for(jeweler)
          command = new
          command.repo = jeweler.repo
          command.version_helper = jeweler.version_helper
          command.gemspec = jeweler.gemspec
          command.commit = jeweler.commit
          command.base_dir = jeweler.base_dir

          command
        end
      end
    end
  end
end

Version data entries

117 entries across 63 versions & 7 rubygems

Version Path
dirty_history-0.2.0 dirty_history/ruby/1.9.1/gems/dirty_history-0.2.0/dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/version/base.rb
dirty_history-0.2.0 dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/version/base.rb
jeweler-1.6.4 lib/jeweler/commands/version/base.rb
jeweler-1.6.3 lib/jeweler/commands/version/base.rb
search_biomodel-1.0.0 search_biomodel/ruby/1.8/gems/jeweler-1.6.2/lib/jeweler/commands/version/base.rb
jeweler-1.6.2 lib/jeweler/commands/version/base.rb
jeweler-1.6.1 lib/jeweler/commands/version/base.rb
dirty_history-0.1.3 dirty_history/ruby/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/version/base.rb
jeweler-1.6.0 lib/jeweler/commands/version/base.rb
jeweler-1.5.2 lib/jeweler/commands/version/base.rb
jeweler-1.5.1 lib/jeweler/commands/version/base.rb
jeweler-1.5.0 lib/jeweler/commands/version/base.rb
jeweler-1.5.0.pre6 lib/jeweler/commands/version/base.rb
jeweler-1.5.0.pre5 lib/jeweler/commands/version/base.rb
jeweler-1.5.0.pre4 lib/jeweler/commands/version/base.rb
jeweler-1.5.0.pre3 lib/jeweler/commands/version/base.rb
jeweler-1.5.0.pre2 lib/jeweler/commands/version/base.rb