Module: Quaker

Defined in:
lib/quaker.rb,
lib/quaker/include.rb,
lib/quaker/version.rb,
lib/quaker/templates.rb,
lib/quaker/tag_filter.rb,
lib/quaker/tag_matcher.rb,
lib/quaker/compose_file.rb,
lib/quaker/git_resolver.rb,
lib/quaker/path_extensions.rb

Defined Under Namespace

Modules: TagMatcher Classes: ComposeFile, GitResolver, Include, PathExtensions, TagFilter, Templates

Constant Summary collapse

VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.runObject



12
13
14
15
16
17
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
# File 'lib/quaker.rb', line 12

def self.run
  Clamp do
    parameter "[SPEC_FILE]", "Extended docker-compose file"
    option %w(--tags -t), "TAGS", "Filter services (and dependencies) by tag", multivalued: true
    option %w(--dir -d), "DIR", "Specify base directory"

    def default_spec_file
      File.expand_path('docker/services/all.yml', dir)
    end

    def default_dir
      Dir.pwd
    end

    def dump_params
      puts "Spec: #{spec_file}"
      puts "Dir: #{dir}"
    end

    def execute
      # dump_params

      Dir.chdir dir

      spec = Include.new.process spec_file
      spec = Templates.new.apply spec
      spec = TagFilter.new.filter spec, tags_list
      spec = GitResolver.new.resolve spec
      spec = PathExtensions.new.expand spec
      spec = ComposeFile.new.build spec
      puts spec
    end
  end
end