Class: PPL::Scanner

Inherits:
Object
  • Object
show all
Defined in:
lib/pod-pipeline/util/scanner.rb

Constant Summary collapse

@@linter =
nil
@@name =
nil
@@version =
nil
@@git =
nil
@@remote =
nil
@@branch =
nil
@@workspace =
nil

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(projectPath, channels) ⇒ Scanner

Returns a new instance of Scanner.



18
19
20
21
# File 'lib/pod-pipeline/util/scanner.rb', line 18

def initialize(projectPath, channels)
    @projectPath = projectPath
    @channels = channels
end

Class Method Details

.branchObject



79
80
81
# File 'lib/pod-pipeline/util/scanner.rb', line 79

def self.branch
    @@branch
end

.gitObject



71
72
73
# File 'lib/pod-pipeline/util/scanner.rb', line 71

def self.git
    @@git
end

.linterObject

—————————————-#



59
60
61
# File 'lib/pod-pipeline/util/scanner.rb', line 59

def self.linter
    @@linter
end

.nameObject



63
64
65
# File 'lib/pod-pipeline/util/scanner.rb', line 63

def self.name
    @@name
end

.remoteObject



75
76
77
# File 'lib/pod-pipeline/util/scanner.rb', line 75

def self.remote
    @@remote
end

.versionObject



67
68
69
# File 'lib/pod-pipeline/util/scanner.rb', line 67

def self.version
    @@version
end

.workspaceObject



83
84
85
# File 'lib/pod-pipeline/util/scanner.rb', line 83

def self.workspace
    @@workspace
end

Instance Method Details

#runObject



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
# File 'lib/pod-pipeline/util/scanner.rb', line 23

def run
    @channels = ["all"] if @channels.count.zero?
    
    @channels.each do |channel|
        case channel
        when "all"
            puts "\n[扫描 #{@projectPath.split("/").last} 内容]"
            @@linter = scan_pod @projectPath
            @@name = @@linter.spec.name
            @@version = @@linter.spec.version
            @@git = scan_git @projectPath
            @@remote = @@git.remote
            @@branch = @@git.branches.current.first
            @@workspace = scan_workspace @projectPath
        when "name"
            @@linter = scan_pod @projectPath
            @@name = @@linter.spec.name
        when "version"
            @@linter = scan_pod @projectPath
            @@version = @@linter.spec.version
        when "remote"
            @@git = scan_git @projectPath
            @@remote = @@git.remote
        when "branch"
            @@git = scan_git @projectPath
            @@branch = @@git.branches.current.first
        when "workspace"
            @@workspace = scan_workspace @projectPath
        else
            raise "暂不支持#{channel}内容扫描"
        end
    end
end