Sha256: 5b2ed23c2571f0564cae221c269609afd450b8d82320eca347f2fa91bdf935c9

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

require 'arigato/version'
require 'arigato/cli'
require 'arigato/view'

module Arigato
  class << self
    def themes_dir
      Pathname.new(File.join(File.dirname(__FILE__), 'arigato', 'themes'))
    end

    def specs(file)
      path = Pathname.new(file)
      dsl = Bundler::Dsl.new
      dsl.eval_gemfile(file)
      specs = dsl.to_definition(nil, {}).specs.to_a

      specs.unshift(self.spec('Ruby', 'http://www.ruby-lang.org/', 'Yukihiro Matsumoto'))

      specs.reject { |spec| spec.name == 'arigato' }
    end

    def specs_array(file, labeld = true)
      specs(file).map do |spec|
        {
          name: spec.name,
          homepage: spec.homepage,
          author: spec.author
        }
      end
    end

    def specs_hash(file)
      hash = {}
      specs(file).each do |spec|
        hash[spec.name] = {
          homepage: spec.homepage,
          author: spec.author
        }
      end
      hash
    end

    def spec(name, homepage, author)
      Gem::Specification.new do |gem|
        gem.name          = name
        gem.authors       = [author]
        gem.homepage      = homepage
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arigato-0.1.2 lib/arigato.rb
arigato-0.1.1 lib/arigato.rb
arigato-0.1.0 lib/arigato.rb