Class: Rucola::Dependencies::RequiredFile
- Inherits:
-
Object
- Object
- Rucola::Dependencies::RequiredFile
show all
- Defined in:
- lib/rucola/dependencies.rb
Defined Under Namespace
Classes: UnableToResolveFullPathError
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(relative_path) ⇒ RequiredFile
Returns a new instance of RequiredFile.
13
14
15
|
# File 'lib/rucola/dependencies.rb', line 13
def initialize(relative_path)
@relative_path, @full_path = resolve_relative_and_full_path(relative_path)
end
|
Instance Attribute Details
#full_path ⇒ Object
Returns the value of attribute full_path.
11
12
13
|
# File 'lib/rucola/dependencies.rb', line 11
def full_path
@full_path
end
|
#relative_path ⇒ Object
Returns the value of attribute relative_path.
11
12
13
|
# File 'lib/rucola/dependencies.rb', line 11
def relative_path
@relative_path
end
|
Instance Method Details
#==(other) ⇒ Object
39
40
41
|
# File 'lib/rucola/dependencies.rb', line 39
def ==(other)
@full_path == other.full_path
end
|
#copy_to(path) ⇒ Object
29
30
31
32
33
34
35
36
37
|
# File 'lib/rucola/dependencies.rb', line 29
def copy_to(path)
dest_dir = File.join(path, File.dirname(@relative_path))
dest_path = File.expand_path(File.join(dest_dir, File.basename(@relative_path)))
return if File.exist?(dest_path)
FileUtils.mkdir_p(dest_dir) unless File.exist?(dest_dir)
puts " #{@full_path}" if Dependencies.verbose
FileUtils.cp(@full_path, dest_dir)
end
|
#gem_lib? ⇒ Boolean
17
18
19
|
# File 'lib/rucola/dependencies.rb', line 17
def gem_lib?
Gem.path.any? {|load_path| @full_path =~ /^#{load_path}/ }
end
|
#other_lib? ⇒ Boolean
25
26
27
|
# File 'lib/rucola/dependencies.rb', line 25
def other_lib?
!gem_lib? && !standard_lib?
end
|
#standard_lib? ⇒ Boolean
21
22
23
|
# File 'lib/rucola/dependencies.rb', line 21
def standard_lib?
@full_path =~ /^#{Config::CONFIG['rubylibdir']}/
end
|