Sha256: 2ab1cdf9d5f57ba7565a8a44bf5ef9386723ce5da00402f1b492c73a71cc5535

Contents?: true

Size: 980 Bytes

Versions: 6

Compression:

Stored size: 980 Bytes

Contents

class Jeweler

  class GemSpecHelper

    attr_accessor :spec, :base_dir

    def initialize(spec, base_dir = nil)
      self.spec = spec
      self.base_dir = base_dir || ''

      yield spec if block_given?
    end

    def valid?
      begin
        parse
        true
      rescue
        false
      end
    end
    
    def write
      File.open(path, 'w') do |f|
        f.write @spec.to_ruby
      end 
    end

    def path
      denormalized_path = File.join(@base_dir, "#{@spec.name}.gemspec")
      absolute_path = File.expand_path(denormalized_path)
      absolute_path.gsub(Dir.getwd + File::SEPARATOR, '') 
    end

    def parse
      data = File.read(path)
      parsed_gemspec = nil
      Thread.new { parsed_gemspec = eval("$SAFE = 3\n#{data}", binding, path) }.join 
      parsed_gemspec
    end

    def gem_path
      File.join(@base_dir, 'pkg', parse.file_name)
    end

    def update_version(version)
      @spec.version = version.to_s
    end

  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
dima-jeweler-0.9.2 lib/jeweler/gemspec_helper.rb
technicalpickles-jeweler-0.10.0 lib/jeweler/gemspec_helper.rb
technicalpickles-jeweler-0.10.1 lib/jeweler/gemspec_helper.rb
technicalpickles-jeweler-0.10.2 lib/jeweler/gemspec_helper.rb
technicalpickles-jeweler-0.9.1 lib/jeweler/gemspec_helper.rb
jeweler-0.10.2 lib/jeweler/gemspec_helper.rb