class Gena::Config
Public Class Methods
create()
click to toggle source
# File lib/config/config.rb, line 13 def Config.create hash = Hash.new hash[:plugins_url] = [ '~/Development/gena-plugins' ] hash['sources_dir'] = '/Users/alex/Development/fisho-ios/Sources' File.open('gena.plist', 'w') { |f| f.write hash.to_plist } end
exists?()
click to toggle source
# File lib/config/config.rb, line 9 def Config.exists? File.exists?('gena.plist') end
Public Instance Methods
collapse_to_project(path)
click to toggle source
# File lib/config/config.rb, line 63 def collapse_to_project(path) if path[0] == '/' path = path.dup path["#{$config.project_dir}/"] = '' end path end
data()
click to toggle source
# File lib/config/config.rb, line 31 def data @data end
data=(new_data)
click to toggle source
# File lib/config/config.rb, line 35 def data=(new_data) @data = new_data end
data_without_plugins()
click to toggle source
# File lib/config/config.rb, line 39 def data_without_plugins @data.reject { |k, v| k == GENA_PLUGINS_CONFIG_KEY } end
expand_to_project(path)
click to toggle source
# File lib/config/config.rb, line 55 def expand_to_project(path) if path[0] == '/' path else File.join(self.project_dir, path) end end
header_dir()
click to toggle source
# File lib/config/config.rb, line 43 def header_dir if @data['header'] && !@data['header'].empty? expand_to_project(@data['header']) else '' end end
load_plist_config()
click to toggle source
# File lib/config/config.rb, line 27 def load_plist_config @data = Plist::parse_xml('gena.plist') end
project_dir()
click to toggle source
# File lib/config/config.rb, line 51 def project_dir File.expand_path((!self.data['project_dir'] || self.data['project_dir'].empty?)? '.' : self.data['project_dir']) end
save!()
click to toggle source
# File lib/config/config.rb, line 23 def save! File.open('gena.plist', 'w') { |f| f.write self.data.to_plist } end
sources_dir()
click to toggle source
# File lib/config/config.rb, line 71 def sources_dir self.expand_to_project(self.data['sources_dir']) end
tests_dir()
click to toggle source
# File lib/config/config.rb, line 75 def tests_dir self.expand_to_project(self.data['tests_dir']) end
xcode_project_path()
click to toggle source
# File lib/config/config.rb, line 79 def xcode_project_path path = self.expand_to_project("#{@data['project_name']}.xcodeproj") unless File.exists? path say "Can't find project with name '#{@data['project_name']}.xcodeproj''", Color::RED abort end path end