Module: Squared::Workspace::Repo
- Included in:
- Application
- Defined in:
- lib/squared/workspace/repo.rb
Instance Attribute Summary collapse
-
#manifest ⇒ Object
readonly
Returns the value of attribute manifest.
-
#manifest_url ⇒ Object
readonly
Returns the value of attribute manifest_url.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#manifest ⇒ Object (readonly)
Returns the value of attribute manifest.
16 17 18 |
# File 'lib/squared/workspace/repo.rb', line 16 def manifest @manifest end |
#manifest_url ⇒ Object (readonly)
Returns the value of attribute manifest_url.
16 17 18 |
# File 'lib/squared/workspace/repo.rb', line 16 def manifest_url @manifest_url end |
Class Method Details
.read_manifest(path) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/squared/workspace/repo.rb', line 7 def read_manifest(path) require 'rexml/document' return unless (file = path.join('.repo/manifest.xml')).exist? doc = REXML::Document.new(file.read) doc.elements['manifest/include'].attributes['name']&.sub('.xml', '') end |
Instance Method Details
#repo(url, manifest = 'latest', run: nil, script: nil, args: nil, dev: nil, prod: nil, ref: @ref, group: @group) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/squared/workspace/repo.rb', line 18 def repo(url, manifest = 'latest', run: nil, script: nil, args: nil, dev: nil, prod: nil, ref: @ref, group: @group) @home = if (val = env('REPO_HOME')) path = Pathname.new(val) if main == path.basename.to_s @root = path.parent if path.exist? @root = nil unless path.directory? elsif !@root.exist? @root.mkpath elsif !repo_install? @root = nil unless repo_confirm end end raise_error('REPO_HOME', val, hint: 'invalid') unless @root path.realdirpath elsif (val = env('REPO_ROOT')) @root = Pathname.new(val).realdirpath if !@root.exist? @root.mkpath elsif !repo_install?(parent: true) raise_error('REPO_ROOT', val, hint: 'exist') unless repo_confirm end @root.join(main).realdirpath elsif repo_install?(parent: true) && (!@home.exist? || @root.join(main) == @home) @home elsif repo_install?(@home) @home.join(main) else (path = pwd) == @home || !repo_install?(path) ? @home : path.join(main) end @root = @home.parent @manifest_url = url @manifest = manifest data = scriptobj if repo? if script if (val = env('REPO_BUILD')) data[:script] = case val when 'verbose' @verbose = 1 if script.is_a?(Array) script[0] = task_join(script[0], 'verbose') script else task_join(script, 'verbose') end when 'silent' @verbose = false @warning = false script else val end data[:env] = true else data[:script] = script end data[:args] = (val = env('REPO_SCRIPT')) ? shell_split(val, join: true) : args elsif (val = env('REPO_BUILD')) data[:run] = val data[:env] = true else data[:run] = run end data[:global] = true data[:dev] = env_match('REPO_DEV', dev) data[:prod] = env_match('REPO_PROD', prod) if (val = env('REPO_GROUP')) script_set(data, group: val.split(',')) found = true end if (val = env('REPO_REF')) script_set(data, ref: val.split(',')) found = true end script_set(data, group: group, ref: ref) unless found @warning = env_match('REPO_WARN', @warning && !root?(@root, pass: ['.repo'])) != false @extensions << :__repo__ elsif script || run if script data[:script] = script data[:args] = args else data[:run] = run end data[:dev] = dev data[:prod] = prod script_set(data, group: group, ref: ref) end self end |