Class: Synx::Project

Inherits:
Xcodeproj::Project show all
Defined in:
lib/synx/project.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#delayed_groups_set_pathObject

Returns the value of attribute delayed_groups_set_path.



13
14
15
# File 'lib/synx/project.rb', line 13

def delayed_groups_set_path
  @delayed_groups_set_path
end

#group_exclusionsObject

Returns the value of attribute group_exclusions.



13
14
15
# File 'lib/synx/project.rb', line 13

def group_exclusions
  @group_exclusions
end

#pruneObject

Returns the value of attribute prune.



13
14
15
# File 'lib/synx/project.rb', line 13

def prune
  @prune
end

Instance Method Details

#pathname_is_inside_root_pathname?(grandchild_pathname) ⇒ Boolean

Returns:

  • (Boolean)


76
77
78
# File 'lib/synx/project.rb', line 76

def pathname_is_inside_root_pathname?(grandchild_pathname)
  grandchild_pathname.realpath.to_s =~ /^#{root_pathname.realpath.to_s}/
end

#pathname_to_work_pathname(pathname) ⇒ Object

We build up the new project structure in a temporary workspace, so convert a file path in the project space to one in the temp workspace.



68
69
70
# File 'lib/synx/project.rb', line 68

def pathname_to_work_pathname(pathname)
  work_root_pathname + pathname.relative_path_from(root_pathname)
end

#root_pathnameObject



50
51
52
# File 'lib/synx/project.rb', line 50

def root_pathname
  @root_pathname ||= Pathname(path).parent
end

#sync(options = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/synx/project.rb', line 15

def sync(options={})
  set_options(options)
  Synx::Tabber.increase
  Synx::Tabber.puts "Syncing files that are included in Xcode project...".bold.white
  main_group.all_groups.each { |gr| gr.sync(main_group) }
  puts "\n\n"
  Synx::Tabber.puts "Syncing files that are not included in Xcode project..".bold.white
  main_group.all_groups.each(&:move_entries_not_in_xcodeproj)
  transplant_work_project
  Synx::Tabber.decrease
  save
end

#work_pathname_to_pathname(work_pathname) ⇒ Object



72
73
74
# File 'lib/synx/project.rb', line 72

def work_pathname_to_pathname(work_pathname)
  root_pathname + work_pathname.relative_path_from(work_root_pathname)
end

#work_root_pathnameObject



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/synx/project.rb', line 54

def work_root_pathname
  if @work_root_pathname 
    @work_root_pathname
  else
    @work_root_pathname = Pathname(File.join(SYNXRONIZE_DIR, root_pathname.basename.to_s))
    # Clean up any previous synx and start fresh
    FileUtils.rm_rf(@work_root_pathname.to_s) if @work_root_pathname.exist?
    @work_root_pathname.mkpath
    @work_root_pathname
  end
end