Sha256: 4bcb050fa190769ead63d2efad5161dfc983c5fe48285e6143c3b4401f6bb6e5

Contents?: true

Size: 998 Bytes

Versions: 4

Compression:

Stored size: 998 Bytes

Contents

#!/usr/bin/env ruby

require File.expand_path(File.join(File.dirname(__FILE__), '../lib/qor_dsl'))

class Gemfile
  include Qor::Dsl
  default_configs [ENV['BUNDLE_GEMFILE'], File.join(File.dirname(__FILE__), 'Gemfile')]

  node :source, :default_value => 'http://rubygems.org'
  node :gem

  node :group do
    node :gem
  end

  node :example do
    node :gem, :inherit => true
  end
end

# Default Value
Gemfile.first(:source)

# Methods for query
Gemfile.first(:gem)
Gemfile.first(:gem, 'unicorn')

Gemfile.find(:gem)
Gemfile.find(:gem, 'rails')
Gemfile.find(:gem) do |n|
  !!n.options[:git].nil?
end

Gemfile.first(:group, 'development').find(:gem)

Gemfile.deep_find(:gem)
Gemfile.deep_find(:gem) do |n|
  # Find all gems used in development environment
  parent = n.parent
  parent.root? || parent.is_node?(:group, :development)
end

# Methods for node
node = Gemfile.find(:gem, 'devise')
node.name
node.value
node.options
node.data
node.config
node.parent
node.parents
node.root
node.root?

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
qor_dsl-0.3.3 example/gemfile.rb
qor_dsl-0.3.2 example/gemfile.rb
qor_dsl-0.3.1 example/gemfile.rb
qor_dsl-0.3.0 example/gemfile.rb