Class: Swoop::Project
- Inherits:
-
Object
- Object
- Swoop::Project
- Defined in:
- lib/swoop/project.rb
Instance Attribute Summary collapse
-
#directory ⇒ Object
readonly
Returns the value of attribute directory.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #filepaths ⇒ Object
-
#initialize(path, directory = 'Classes') ⇒ Project
constructor
A new instance of Project.
Constructor Details
#initialize(path, directory = 'Classes') ⇒ Project
Returns a new instance of Project.
9 10 11 12 |
# File 'lib/swoop/project.rb', line 9 def initialize(path, directory = 'Classes') @path = path @directory = directory end |
Instance Attribute Details
#directory ⇒ Object (readonly)
Returns the value of attribute directory.
7 8 9 |
# File 'lib/swoop/project.rb', line 7 def directory @directory end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/swoop/project.rb', line 7 def path @path end |
Instance Method Details
#filepaths ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/swoop/project.rb', line 14 def filepaths raise "Error: Project path is empty :(" if @path.empty? raise "Error: Can't find .xcodeproj project :(" unless File.exist? @path raise "Error: Invalid .xcodeproj file :(" unless File.extname(@path) == '.xcodeproj' project = Xcodeproj::Project.open @path project_dir = project[directory] raise "Error: Can't find directory :(" if project_dir.nil? filepaths = project_dir .recursive_children .select { |f| valid_file? f } .map(&:real_path) raise "Error: No files are found :(" if filepaths.empty? filepaths end |