Module: Nginxbrew::Local

Defined in:
lib/nginxbrew/local.rb

Defined Under Namespace

Classes: Ngx

Class Method Summary collapse

Class Method Details

.builds(dist_dir) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/nginxbrew/local.rb', line 31

def builds(dist_dir)
    dest = []
    return dest unless FileTest.directory?(dist_dir)
    child_dirs = Pathname.new(dist_dir).children.select{|e| e.directory? }
    child_dirs.inject(dest) do |memo, d|
        version = NamingConvention.version_from_package(File.basename(d))
        is_openresty = NamingConvention.openresty?(version)
        raw_version = is_openresty ?
            NamingConvention.openresty_to_raw_version(version) : version
        $logger.debug("built package: #{d} -> #{is_openresty}, #{raw_version}")
        memo << Ngx.new(
            :is_openresty => is_openresty,
            :raw_version => raw_version,
            :version => version
        )
        memo
    end
end

.count_of_builds(dist_dir) ⇒ Object



57
58
59
# File 'lib/nginxbrew/local.rb', line 57

def count_of_builds(dist_dir)
    builds(dist_dir).size
end

.find(config) ⇒ Object



50
51
52
53
54
55
# File 'lib/nginxbrew/local.rb', line 50

def find(config)
    builds(config.dist_dir).detect do |b|
        b.raw_version == config.ngx_version &&
            b.is_openresty == config.is_openresty
    end
end