Class: MetaModel::Command::Install
Defined Under Namespace
Classes: Validator
Constant Summary
METAMODEL_COMMAND_ALIAS, METAMODEL_OPTION_ALIAS
Instance Attribute Summary collapse
Instance Method Summary
collapse
#config
#installer_for_config, options, run
Constructor Details
#initialize(argv) ⇒ Install
15
16
17
18
|
# File 'lib/metamodel/command/install.rb', line 15
def initialize(argv)
validate!
super
end
|
Instance Attribute Details
#models ⇒ Object
Returns the value of attribute models.
13
14
15
|
# File 'lib/metamodel/command/install.rb', line 13
def models
@models
end
|
Instance Method Details
#clone_project ⇒ Object
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/metamodel/command/install.rb', line 36
def clone_project
if File.exist? config.metamodel_xcode_project
UI.message "Existing project `#{config.metamodel_xcode_project}`"
else
UI.section "Cloning MetaModel project into `./metamodel` folder" do
Git.clone(config.metamodel_template_uri, 'metamodel', :depth => 1)
UI.message "Using `#{config.metamodel_xcode_project}` to build module"
end
end
end
|
#integrate_to_project ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/metamodel/command/install.rb', line 47
def integrate_to_project
xcodeprojs = Dir.glob("#{config.installation_root}/*.xcodeproj")
project = Xcodeproj::Project.open(xcodeprojs.first)
target = project.targets.first
return if target.build_phases.find { |build_phase| build_phase.to_s == "[MetaModel] Embedded Frameworks"}
frameworks_group = project.main_group.find_subpath('MetaModel', true)
frameworks_group.clear
frameworks_group.set_source_tree('SOURCE_ROOT')
frameworks_build_phase = target.build_phases.find { |build_phase| build_phase.to_s == 'FrameworksBuildPhase' }
embedded_frameworks_build_phase = project.new(Xcodeproj::Project::Object::PBXCopyFilesBuildPhase)
embedded_frameworks_build_phase.name = '[MetaModel] Embedded Frameworks'
embedded_frameworks_build_phase.symbol_dst_subfolder_spec = :frameworks
target.build_phases << embedded_frameworks_build_phase
framework_ref = frameworks_group.new_file("./MetaModel.framework")
build_file = embedded_frameworks_build_phase.add_file_reference(framework_ref)
frameworks_build_phase.add_file_reference(framework_ref)
build_file.settings = { 'ATTRIBUTES' => ['CodeSignOnCopy', 'RemoveHeadersOnCopy'] }
project.save
end
|
#prepare ⇒ Object
32
33
34
|
# File 'lib/metamodel/command/install.rb', line 32
def prepare
clone_project
end
|
#run ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/metamodel/command/install.rb', line 20
def run
UI.section "Building MetaModel.framework in project" do
prepare
installer = installer_for_config
installer.install!
end
UI.section "Copying MetaModel.framework into Embedded Binaries phrase." do
integrate_to_project
end
end
|
#validate! ⇒ Object
73
74
75
76
|
# File 'lib/metamodel/command/install.rb', line 73
def validate!
raise Informative, 'No Metafile in current directory' unless config.metafile_in_dir(Pathname.pwd)
end
|