Class: Workarea::Upgrade::Diff::WorkareaFile
- Inherits:
-
Object
- Object
- Workarea::Upgrade::Diff::WorkareaFile
- Defined in:
- lib/workarea/upgrade/diff/workarea_file.rb
Instance Attribute Summary collapse
-
#relative_path ⇒ Object
readonly
Returns the value of attribute relative_path.
Class Method Summary collapse
Instance Method Summary collapse
- #absolute_path ⇒ Object
-
#initialize(root, relative_path) ⇒ WorkareaFile
constructor
A new instance of WorkareaFile.
Constructor Details
#initialize(root, relative_path) ⇒ WorkareaFile
Returns a new instance of WorkareaFile.
32 33 34 35 |
# File 'lib/workarea/upgrade/diff/workarea_file.rb', line 32 def initialize(root, relative_path) @root = root @relative_path = relative_path end |
Instance Attribute Details
#relative_path ⇒ Object (readonly)
Returns the value of attribute relative_path.
5 6 7 |
# File 'lib/workarea/upgrade/diff/workarea_file.rb', line 5 def relative_path @relative_path end |
Class Method Details
.find_decorators(root) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/workarea/upgrade/diff/workarea_file.rb', line 19 def self.find_decorators(root) Dir.glob("#{root}/app/decorators/**/*") .reject { |file| File.directory?(file) } .map { |file| file.gsub(root, '') } .map { |file| file.gsub('/app/decorators', 'app') } .map { |file| file.gsub('_decorator.rb', '.rb') } .map { |file| new(nil, file) } + Dir.glob("#{root}/app/**/*.decorator") .map { |file| file.gsub("#{root}/", '') } .map { |file| file.gsub('.decorator', '.rb') } .map { |file| new(nil, file) } end |
.find_files(root) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/workarea/upgrade/diff/workarea_file.rb', line 7 def self.find_files(root) Dir.glob("#{root}/**/*") .map { |f| f.gsub("#{root}/", '') } .select do |relative| !File.directory?("#{root}/#{relative}") && !relative.include?('decorators/') && (relative.include?('app/') || relative.include?('lib/')) && !relative.end_with?('.decorator') end .map { |relative| new(root, relative) } end |
Instance Method Details
#absolute_path ⇒ Object
37 38 39 |
# File 'lib/workarea/upgrade/diff/workarea_file.rb', line 37 def absolute_path "#{@root}/#{@relative_path}" end |