Module: Phoenx

Defined in:
lib/phoenx/constants.rb,
lib/phoenx/cli/option.rb,
lib/phoenx/cli/command.rb,
lib/phoenx/gem_version.rb,
lib/phoenx/cli/cli_factory.rb,
lib/phoenx/entities/scheme.rb,
lib/phoenx/entities/target.rb,
lib/phoenx/entities/project.rb,
lib/phoenx/entities/workspace.rb,
lib/phoenx/entities/dependency.rb,
lib/phoenx/utilities/files_utils.rb,
lib/phoenx/entities/configuration.rb,
lib/phoenx/use_cases/generate_target.rb,
lib/phoenx/utilities/xcodeproj_utils.rb,
lib/phoenx/use_cases/generate_project.rb,
lib/phoenx/use_cases/target/add_header.rb,
lib/phoenx/use_cases/generate_workspace.rb,
lib/phoenx/validators/project_validator.rb,
lib/phoenx/validators/workspace_validator.rb,
lib/phoenx/use_cases/extract_build_settings.rb,
lib/phoenx/validators/configuration_validator.rb

Defined Under Namespace

Modules: Cli, Target Classes: AbstractTarget, ApplicationTargetBuilder, Configuration, ConfigurationValidator, Dependency, ExtractBuildSettings, FrameworkTargetBuilder, GenerateProject, GenerateWorkspace, Project, ProjectValidator, Scheme, TargetBuilder, TestTarget, TestTargetBuilder, TestableTarget, TestableTargetBuilder, Workspace, WorkspaceValidator

Constant Summary collapse

WORKSPACE_EXTENSION =
"pxworkspace"
PROJECT_EXTENSION =
"pxproject"
XCODE_PROJECT_EXTENSION =
"xcodeproj"
XCODE_WORKSPACE_EXTENSION =
"xcworkspace"
SOURCE_EXTENSIONS =
[".swift", ".m", ".c", ".xcdatamodeld"]
RESOURCES_ROOT =
"Resources"
TESTS_ROOT =
"Tests"
SOURCE_ROOT =
"Source"
FRAMEWORKS_ROOT =
"Frameworks"
CONFIGURATION_ROOT =
"Configuration"
XCTEST_EXTENSION =
"xctest"
ATTRIBUTES_CODE_SIGN_ON_COPY =
{"ATTRIBUTES" => ["CodeSignOnCopy"]}
ATTRIBUTES_PUBLIC_HEADERS =
{"ATTRIBUTES" => [:Public]}
ATTRIBUTES_PRIVATE_HEADERS =
{"ATTRIBUTES" => [:Private]}
ATTRIBUTES_PROJECT_HEADERS =
{"ATTRIBUTES" => [:Project]}
VERSION =
"0.3.3".freeze

Class Method Summary collapse

Class Method Details

.add_groups_for_files(project, files) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/phoenx/utilities/xcodeproj_utils.rb', line 13

def Phoenx.add_groups_for_files(project,files)
	files.each do |path|
		abort "Missing file ".red + path.bold unless File.exists?(path)
		groups = File.dirname(path).split("/")
		concate = ""
		groups.each do |g|
			if Phoenx.is_bundle?(g) || Phoenx.is_translation_folder?(g)
				break
			end
			concate +=  g + "/"
			group_ref = project.main_group.find_subpath(concate, true)
			group_ref.set_path(g)
		end
	end
end

.get_or_add_file(project, file) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/phoenx/utilities/xcodeproj_utils.rb', line 37

def Phoenx.get_or_add_file(project,file)
	abort "Missing file ".red + path.bold unless File.exists?(file)
	filename = File.basename(file)
	dir = File.dirname(file)
	group = project.main_group.find_subpath(dir, false)
	file_ref = group.find_file_by_path(filename)
	unless file_ref != nil
		file_ref = group.new_file(filename)
	end	
	return file_ref

end

.get_or_add_files(project, files) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/phoenx/utilities/xcodeproj_utils.rb', line 29

def Phoenx.get_or_add_files(project, files)
	resources = Phoenx.merge_files_array(files)
	Phoenx.add_groups_for_files(project, resources)
	resources.each do |source|
		Phoenx.get_or_add_file(project,source)
	end
end

.is_bundle?(file) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/phoenx/utilities/xcodeproj_utils.rb', line 5

def Phoenx.is_bundle?(file)
	return file.include?('xcassets') || file.include?('bundle') || file.include?('playground')
end

.is_translation_folder?(file) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/phoenx/utilities/xcodeproj_utils.rb', line 9

def Phoenx.is_translation_folder?(file)
	return file.include?('lproj')
end

.merge_files_array(files, excluded_files = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/phoenx/utilities/files_utils.rb', line 3

def Phoenx.merge_files_array(files, excluded_files = nil)
	if files == nil
		return nil
	end
	resources = []
	files.each do |source|
		resources.concat Dir[source]
	end
	unless excluded_files == nil
		resources -= merge_files_array(excluded_files)
	end
	return resources
end

.set_project_build_settings_defaults(project) ⇒ Object



56
57
58
59
60
# File 'lib/phoenx/utilities/xcodeproj_utils.rb', line 56

def Phoenx.set_project_build_settings_defaults(project)
	project.build_configuration_list.build_configurations.each do |config|
		config.build_settings = {}
	end
end

.set_target_build_settings_defaults(target) ⇒ Object



50
51
52
53
54
# File 'lib/phoenx/utilities/xcodeproj_utils.rb', line 50

def Phoenx.set_target_build_settings_defaults(target)
	target.build_configuration_list.build_configurations.each do |config|
		config.build_settings = {}
	end
end

.target_for_name(project, name) ⇒ Object



62
63
64
65
66
67
68
69
# File 'lib/phoenx/utilities/xcodeproj_utils.rb', line 62

def Phoenx.target_for_name(project,name)
	project.targets.each do |t|
		if t.name == name
			return t
		end
	end
	return nil
end