Class: MetaModel::Command::Install
- Inherits:
-
MetaModel::Command
- Object
- CLAide::Command
- MetaModel::Command
- MetaModel::Command::Install
- Includes:
- MetaModel::Config::Mixin
- Defined in:
- lib/metamodel/command/install.rb,
lib/metamodel/installer/validator.rb
Defined Under Namespace
Classes: Validator
Constant Summary
Constants inherited from MetaModel::Command
METAMODEL_COMMAND_ALIAS, METAMODEL_OPTION_ALIAS
Instance Attribute Summary collapse
-
#models ⇒ Object
Returns the value of attribute models.
Instance Method Summary collapse
- #clone_project ⇒ Object
-
#initialize(argv) ⇒ Install
constructor
A new instance of Install.
- #integrate_to_project ⇒ Object
- #prepare ⇒ Object
- #run ⇒ Object
- #validate! ⇒ Object
Methods included from MetaModel::Config::Mixin
Methods inherited from MetaModel::Command
#installer_for_config, options, run
Constructor Details
#initialize(argv) ⇒ Install
Returns a new instance of 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. UI. "Existing project `#{config.}`" else UI.section "Cloning MetaModel project into `./metamodel` folder" do Git.clone(config., 'metamodel', :depth => 1) UI. "Using `#{config.}` 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"} # Get useful variables 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' } # Add new "Embed Frameworks" build phase to target = project.new(Xcodeproj::Project::Object::PBXCopyFilesBuildPhase) .name = '[MetaModel] Embedded Frameworks' .symbol_dst_subfolder_spec = :frameworks target.build_phases << # Add framework to target as "Embedded Frameworks" framework_ref = frameworks_group.new_file("./MetaModel.framework") build_file = .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 # UI.notice "Please drag MetaModel.framework into Embedded Binaries phrase.\n" end |
#validate! ⇒ Object
73 74 75 76 |
# File 'lib/metamodel/command/install.rb', line 73 def validate! # super raise Informative, 'No Metafile in current directory' unless config.(Pathname.pwd) end |