Class: Docker::Template::Parser
- Inherits:
-
Object
- Object
- Docker::Template::Parser
- Defined in:
- lib/docker/template/parser.rb
Constant Summary collapse
- SLASH_REGEXP =
/\//- SPLIT_REGEXP =
/:|\//- COLON_REGEXP =
/:/
Instance Method Summary collapse
-
#all ⇒ Object
———————————————————————- Return
raw_reposif you send us a list of repos you wish to build, otherwise we get the children of the repo folder and ship that off so you can build every repo, I don’t know if you want that. -
#initialize(raw_repos = [], argv = {}) ⇒ Parser
constructor
A new instance of Parser.
-
#parse ⇒ Object
———————————————————————-.
Constructor Details
#initialize(raw_repos = [], argv = {}) ⇒ Parser
Returns a new instance of Parser.
14 15 16 17 |
# File 'lib/docker/template/parser.rb', line 14 def initialize(raw_repos = [], argv = {}) @raw_repos = raw_repos @argv = argv end |
Instance Method Details
#all ⇒ Object
Return raw_repos if you send us a list of repos you wish to build, otherwise we get the children of the repo folder and ship that off so you can build every repo, I don’t know if you want that.
25 26 27 28 29 30 31 32 33 |
# File 'lib/docker/template/parser.rb', line 25 def all return @raw_repos unless @raw_repos.empty? Template.root.join(Metadata.new({}).repos_dir).children.map do |path| path.basename.to_s end rescue Errno::ENOENT then raise Error::RepoNotFound end |
#parse ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/docker/template/parser.rb', line 37 def parse repos = { :scratch => [], :simple => [], :aliases => [] } all.each do |v| hash = to_repo_hash(v) if hash.empty? raise Docker::Template::Error::BadRepoName, v else Repo.new(hash, @argv).to_repos.each do |r| r.alias?? repos[:aliases] << r : r.builder.scratch?? \ repos[:scratch] << r : repos[:simple] << r end end end repos.values.reduce( :| ) end |