Sha256: cda83fbaa84fa6f8e58369670b6d04b809596b800baad3c03f5de7dbd4dec3b6

Contents?: true

Size: 907 Bytes

Versions: 4

Compression:

Stored size: 907 Bytes

Contents

module GemSuit
  class Application < ::Thor::Group
    module Utils
      class Gemfile

        # A simple class which derives a Gemfile

        attr_accessor :source

        def initialize(*files)
          @files = files
        end

        def gems
          @gems ||= begin
            @gems     = {}
            gem_file  = @files.detect{|file| File.exists? file}
            gem_specs = File.readlines(gem_file).join "\n"
            instance_eval gem_specs
            gems
          end
        end

        def source(src)
          source = src
        end

        def gem(name, *args)
          options = (args.pop if args.last.is_a?(Hash)) || {}
          options[:version] = args.first if args.first.is_a?(String)
          @gems[name] = options
        end

        def method_missing(method, *args)
          # e.g. group :test do
          # end
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gem_suit-0.1.3 lib/gem_suit/application/utils/gemfile.rb
gem_suit-0.1.2 lib/gem_suit/application/utils/gemfile.rb
gem_suit-0.1.1 lib/gem_suit/application/utils/gemfile.rb
gem_suit-0.1.0 lib/gem_suit/application/utils/gemfile.rb