Module: Mactag::Config

Defined in:
lib/mactag/config.rb

Class Method Summary collapse

Class Method Details

.add_config(name, &block) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/mactag/config.rb', line 8

def add_config(name, &block)
  unless respond_to?(name)
    class_eval "      def self.\#{name}\n        @\#{name}\n      end\n    RUBY\n  end\n\n  unless respond_to?(\"\#{name}=\")\n    class_eval <<-RUBY, __FILE__, __LINE__ + 1\n      def self.\#{name}=(value)\n        @\#{name} = value\n      end\n    RUBY\n  end\nend\n", __FILE__, __LINE__ + 1

.binary=(binary) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/mactag/config.rb', line 42

def binary=(binary)
  if binary.include?('{INPUT}') && binary.include?('{OUTPUT}')
    @binary = binary
  else
    raise Mactag::MactagError.new("Binary command must include '{INPUT}' and '{OUTPUT}'")
  end
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



4
5
6
# File 'lib/mactag/config.rb', line 4

def configure(&block)
  yield self
end

.gem_homeObject



26
27
28
29
30
31
32
# File 'lib/mactag/config.rb', line 26

def gem_home
  if rvm
    File.join(ENV['GEM_HOME'], 'gems')
  else
    @gem_home
  end
end

.reset_configObject



50
51
52
53
54
55
56
57
# File 'lib/mactag/config.rb', line 50

def reset_config
  configure do |config|
    config.binary = 'ctags -o {OUTPUT} -e {INPUT}'
    config.tags_file = 'TAGS'
    config.rvm = true
    config.gem_home = '/Library/Ruby/Gems/1.8/gems'
  end
end

.rvm=(rvm) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/mactag/config.rb', line 34

def rvm=(rvm)
  if rvm == true || rvm == false
    @rvm = rvm
  else
    raise Mactag::MactagError.new("RVM must be either true or false")
  end
end