lib/synx/project.rb in synx-0.0.4 vs lib/synx/project.rb in synx-0.0.5
- old
+ new
@@ -12,10 +12,11 @@
attr_accessor :delayed_groups_set_path, :group_exclusions, :prune
def sync(options={})
set_options(options)
+ presync_check
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
@@ -23,10 +24,22 @@
transplant_work_project
Synx::Tabber.decrease
save
end
+ def presync_check
+ forward_slash_groups = main_group.groups_containing_forward_slash
+ unless forward_slash_groups.empty?
+ Synx::Tabber.puts "Synx cannot sync projects with groups that contain '/'. Please rename the following groups before running synx again:".yellow
+ Synx::Tabber.increase
+ forward_slash_groups.each do |group|
+ Synx::Tabber.puts group.hierarchy_path
+ end
+ abort
+ end
+ end
+
def set_options(options)
self.prune = options[:prune]
if options[:no_default_exclusions]
self.group_exclusions = []
@@ -77,14 +90,16 @@
grandchild_pathname.realpath.to_s =~ /^#{root_pathname.realpath.to_s}/
end
def group_exclusions=(new_exclusions)
new_exclusions.each do |exclusion|
+ # Group paths always start with a '/', so put one there if it isn't already.
+ exclusion.prepend("/") unless exclusion[0] == "/"
# Don't check our own default exclusions -- they may not have it in their project.
unless DEFAULT_EXCLUSIONS.include?(exclusion)
# remove leading '/' for this check
exclusion = exclusion.dup
- exclusion[0] = '' if exclusion[0] == '/'
+ exclusion[0] = ''
unless self[exclusion]
raise IndexError, "No group #{exclusion} exists"
end
end
end