Class: HMap::MapFileWriter
- Inherits:
-
Object
- Object
- HMap::MapFileWriter
- Defined in:
- lib/hmap/hmap/hmap_writer.rb
Overview
Helper module which returns handle method from MapFileWriter.
Instance Method Summary collapse
-
#create_hmapfile(clean) ⇒ void
Integrates the projects mapfile associated with the App project and Pods project.
-
#initialize(use_origin, project_root, clean_hmap) ⇒ MapFileWriter
constructor
A new instance of MapFileWriter.
Constructor Details
#initialize(use_origin, project_root, clean_hmap) ⇒ MapFileWriter
Returns a new instance of MapFileWriter.
15 16 17 18 19 20 21 |
# File 'lib/hmap/hmap/hmap_writer.rb', line 15 def initialize(use_origin, project_root, clean_hmap) UserInterface.puts("[hmapfile] Workspace/project root: #{project_root}") UserInterface.puts('[hmapfile] Analyzing dependencies') Resolver.instance.installation_root = project_root Resolver.instance.use_origin = use_origin create_hmapfile(clean_hmap) end |
Instance Method Details
#create_hmapfile(clean) ⇒ void
This method returns an undefined value.
Integrates the projects mapfile associated with the App project and Pods project.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/hmap/hmap/hmap_writer.rb', line 29 def create_hmapfile(clean) # {a,b}– Match pattern a or b. # Though this looks like a regular expression quantifier, it isn't. # For example, in regular expression, the pattern a{1,2} will match 1 or 2 'a' characters. # In globbing, it will match the string a1 or a2. paths = Dir.glob(File.join(Resolver.instance.installation_root, '*.{xcworkspace,xcodeproj}')) || [] workspace_paths = paths.select { |f| File.extname(f) == '.xcworkspace' } xcs = if workspace_paths.empty? project_paths = paths.select { |f| File.extname(f) == '.xcodeproj' } Workspace.new_from_xcprojects(project_paths) unless project_paths.nil? else Workspace.new_from_xcworkspaces(workspace_paths) end if xcs.empty? UserInterface.puts("\n[hmapfile] Gen [ERROR] path: #{Resolver.instance.installation_root} not contain .{xcworkspace,xcodeproj} file!".red) end xcs.each do |xc| if clean xc.remove_hmap_settings! else xc.write_save! end end end |