Class: XcodeProject::Project
- Inherits:
-
Object
- Object
- XcodeProject::Project
- Defined in:
- lib/xcodeproject/project.rb
Instance Attribute Summary collapse
-
#builder ⇒ Object
readonly
Returns the value of attribute builder.
-
#bundle_path ⇒ Object
readonly
Returns the value of attribute bundle_path.
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #archive ⇒ Object
- #build ⇒ Object
- #change {|data| ... } ⇒ Object
- #clean ⇒ Object
- #doctor ⇒ Object
-
#initialize(path) ⇒ Project
constructor
A new instance of Project.
- #read ⇒ Object
- #write(data) ⇒ Object
Constructor Details
#initialize(path) ⇒ Project
Returns a new instance of Project.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/xcodeproject/project.rb', line 43 def initialize (path) path = Pathname.new(path) raise FilePathError.new("No such project file '#{path}'.") unless path.exist? @bundle_path = path @file_path = bundle_path.join('project.pbxproj') @name = bundle_path.basename('.*').to_s @builder = Builder.new do |t| t.project_name = path.basename t.invoke_from_within = path.dirname t.formatter = XcodeBuild::Formatters::ProgressFormatter.new end end |
Instance Attribute Details
#builder ⇒ Object (readonly)
Returns the value of attribute builder.
30 31 32 |
# File 'lib/xcodeproject/project.rb', line 30 def builder @builder end |
#bundle_path ⇒ Object (readonly)
Returns the value of attribute bundle_path.
31 32 33 |
# File 'lib/xcodeproject/project.rb', line 31 def bundle_path @bundle_path end |
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
32 33 34 |
# File 'lib/xcodeproject/project.rb', line 32 def file_path @file_path end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
33 34 35 |
# File 'lib/xcodeproject/project.rb', line 33 def name @name end |
Class Method Details
Instance Method Details
#archive ⇒ Object
82 83 84 |
# File 'lib/xcodeproject/project.rb', line 82 def archive builder.archive end |
#build ⇒ Object
74 75 76 |
# File 'lib/xcodeproject/project.rb', line 74 def build builder.build end |
#change {|data| ... } ⇒ Object
58 59 60 61 62 |
# File 'lib/xcodeproject/project.rb', line 58 def change data = read yield data write data end |
#clean ⇒ Object
78 79 80 |
# File 'lib/xcodeproject/project.rb', line 78 def clean builder.clean end |
#doctor ⇒ Object
86 87 88 |
# File 'lib/xcodeproject/project.rb', line 86 def doctor change {|data| data.doctor } end |
#read ⇒ Object
64 65 66 |
# File 'lib/xcodeproject/project.rb', line 64 def read Data.new(JSON.parse(`plutil -convert json -o - "#{file_path}"`), bundle_path.dirname) end |
#write(data) ⇒ Object
68 69 70 71 72 |
# File 'lib/xcodeproject/project.rb', line 68 def write (data) File.open(file_path, "w") do |file| file.write(data.to_plist) end end |