Class: Andy::Pint

Inherits:
Object
  • Object
show all
Defined in:
lib/andy/pint.rb

Instance Method Summary collapse

Constructor Details

#initialize(location) ⇒ Pint

Returns a new instance of Pint.



10
11
12
13
14
15
16
17
18
19
# File 'lib/andy/pint.rb', line 10

def initialize(location)
	@location = location
	begin
	  config = YAML.load_file("#{location}/pint.yml")
	rescue
	  raise UnknownPintException.new
	end
     pint_config = Andy::NestedOStruct.new config
     @my_config = pint_config.pint
end

Instance Method Details

#authorObject



37
38
39
# File 'lib/andy/pint.rb', line 37

def author
	@my_config.author
end

#descriptionObject



29
30
31
# File 'lib/andy/pint.rb', line 29

def description
	@my_config.description
end

#generated_filesObject



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/andy/pint.rb', line 49

def generated_files
	my_files = []
	Dir.glob("#{@location}/**/*").each do |file_name|
		file = File.new(file_name)
		if (! File.directory?(file_name))
		  path_name = Pathname.new(file_name).relative_path_from(Pathname.new(@location)).to_s
		  generated_file_name = path_name.end_with?('.erb') ? path_name[0..-5] : path_name
		  my_files << generated_file_name unless generated_file_name == 'pint.yml'
		end
	end
	my_files
end

#locationObject



45
46
47
# File 'lib/andy/pint.rb', line 45

def location
  @location
end

#long_nameObject



25
26
27
# File 'lib/andy/pint.rb', line 25

def long_name
	@my_config.long_name
end

#nameObject



21
22
23
# File 'lib/andy/pint.rb', line 21

def name
	@my_config.name
end

#remoteObject



41
42
43
# File 'lib/andy/pint.rb', line 41

def remote
	@my_config.remote
end

#source_filesObject



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/andy/pint.rb', line 62

def source_files
  my_files = []
  Dir.glob("#{@location}/**/*").each do |file_name|
    file = File.new(file_name)
    if (! File.directory?(file_name))
      path_name = Pathname.new(file_name).relative_path_from(Pathname.new(@location)).to_s
      my_files << path_name unless path_name == 'pint.yml'
    end
  end
  my_files
end

#versionObject



33
34
35
# File 'lib/andy/pint.rb', line 33

def version
	@my_config.version
end