Class: App

Inherits:
Object
  • Object
show all
Defined in:
lib/kody/app.rb

Constant Summary collapse

@@log =
nil
@@spec =
nil
@@abbreviations =
nil

Class Method Summary collapse

Class Method Details

.abbreviationsObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/kody/app.rb', line 46

def self.abbreviations
	return @@abbreviations unless @@abbreviations.nil?

	properties_filename = "abbreviations.properties"

	return Array.new unless File.exists? properties_filename

	App.logger.info "Loading property file #{properties_filename}..."

    @@abbreviations = {}
    File.open(properties_filename, 'r') do |properties_file|
      properties_file.read.each_line do |line|
        line.strip!.downcase!
        if (line[0] != ?# and line[0] != ?=)
          i = line.index('=')
          if (i)
            @@abbreviations[line[0..i - 1].strip.downcase] = line[i + 1..-1].strip.downcase
          else
            @@abbreviations[line] = ''
          end
        end
      end
    end

	@@abbreviations		
end

.loggerObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/kody/app.rb', line 10

def self.logger
	
	return @@log unless @@log.nil?

	@@log = Logger.new($stdout)
	@@log.level = Logger::DEBUG
	@@log.formatter = proc do |severity, datetime, progname, msg|
	  "[#{severity}] - #{msg}\n"
	end
	@@log
end

.specificationObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/kody/app.rb', line 22

def self.specification

	return @@spec unless @@spec.nil?

	@@spec = Gem::Specification.new do |s|
	  s.name        = 'kody'
	  s.version     = '0.0.2'
	  s.licenses    = ['LGPL']
	  s.add_runtime_dependency "thor", '~> 0.18', '>= 0.18.1'
	  s.add_runtime_dependency "rake", '~> 0.9', '>= 0.9.2'
	  s.add_runtime_dependency "nokogiri", '~> 1.6', '>= 1.6.0'
	  s.add_runtime_dependency "liquid", '~> 2.5', '>= 2.5.0'
	  s.add_runtime_dependency "xmimodel", '~> 0.2', '>= 0.2.0'
	  s.date        = '2014-06-02'
	  s.summary     = "Kody"
	  s.description = "A quick code generator."
	  s.authors     = ["Marcus Siqueira"]
	  s.email       = '[email protected]'
	  s.files       = FileList['lib/*.rb', 'lib/**/*.rb', 'lib/**/*'].to_a
	  s.homepage    = 'https://github.com/marvinsiq/kody'
	  s.executables << 'kody'
	end
end