Sha256: 9a1f97b87aeb9b92123c1bf1568fbd0d36f0c0436f95339d212622a94c13f55d

Contents?: true

Size: 1021 Bytes

Versions: 6

Compression:

Stored size: 1021 Bytes

Contents

class Gemspec
	def self.update gemspec_file
		Text.replace_in_file gemspec_file,
                              /('\d{4}-\d{2}-\d{2}')/,
                              "'#{Time.now.strftime('%Y-%m-%d')}'"
	end

	def self.gemfile gemspec_file
		spec=Gem::Specification.load(gemspec_file)
		return "#{spec.name}-#{spec.version}.gem"
	end

    def self.version gemspec_file
    	spec=Gem::Specification.load(gemspec_file)
		return spec.version.to_s
    end

    def self.published_version gemspec_file
  		published_version=''
    	spec=Gem::Specification.load(gemspec_file)
		begin
		  published_version = `gem list -r #{spec.name} -r`.scan(/\((\d+.\d+.\d+)\)/)[0][0]
		rescue
		  published_version=''
		end
		published_version
    end
	def self.published? gemspec_file
		published_version(gemspec_file)==version(gemspec_file) ? true : false
	end

	def self.normalize gemspec_file
		spec=Gem::Specification.load(gemspec_file)
		File.open(gemspec_file,'w'){|f|f.write(spec.to_ruby)}
	end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dev_commands-0.0.31 lib/gemspec.rb
dev_commands-0.0.30 lib/gemspec.rb
dev_commands-0.0.29 lib/gemspec.rb
dev_commands-0.0.28 lib/gemspec.rb
dev_commands-0.0.27 lib/gemspec.rb
dev_commands-0.0.26 lib/gemspec.rb