inch_ci-worker 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/bin/inch_ci-worker +11 -2
- data/lib/inch_ci/worker/build/result.rb +15 -0
- data/lib/inch_ci/worker/build/task.rb +37 -7
- data/lib/inch_ci/worker/version.rb +1 -1
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NjQ0NzIzNzE2YjZkZTk3OTA3M2FhZDNhZTliNGVlZTQ5YWE2MTYzYg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0ade87de9c7f292e99bfa6f398110e81e3f00048
|
4
|
+
data.tar.gz: e1179552ffe534a839bb9eb0408b59171b19f249
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
NjRkNDNmYzk4NDFkNTdkODVkMzAzMTQ4NjlhMThhYzQ5YTRlYTdiMDUzOTJk
|
11
|
-
ZTUwNmNmNTg1OWVkNTU4ZWE3MTQ1OTFhYjJmMzAyYTk0YzYzYWI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NWEzZDU1MDA3YWRlMmYyMzE2NTk3ZjM0ZjE4YTE5M2ZiOThiNzM2YWNiNDVi
|
14
|
-
YzQzOWQ1NzY2ODdiMzk3ZTM4OTQ5ZDBhNTVmN2Y5NzViNzY0NjkwMjFiODA0
|
15
|
-
YmQ4NGMzOGU4YmU3NDU3YWVmNzg5NTE2MGZkNTUwNjZiMDA5NmQ=
|
6
|
+
metadata.gz: 5e10993f315b60064b839eb8ada7222ce8ace7ddfe78e88204ef7d621c34aeae5d577464a568baca7bae013a2b250eaee2eebe1165238aba8f326738902e523c
|
7
|
+
data.tar.gz: 343731654428479292ca501e239d83f1be732c65b48ec86b90c25e42d21783847c6fac6537468d5763e662dd516a7fd203c5703fc0102f55e5872af575bd3224
|
data/bin/inch_ci-worker
CHANGED
@@ -16,8 +16,17 @@ require 'inch_ci/worker'
|
|
16
16
|
|
17
17
|
class Command
|
18
18
|
class Build
|
19
|
-
def initialize(url, branch_name = nil,
|
20
|
-
|
19
|
+
def initialize(url, branch_name = nil, *args)
|
20
|
+
revision, language = nil
|
21
|
+
args.each do |arg|
|
22
|
+
if arg =~ /^--language=(.+)$/
|
23
|
+
language = $1
|
24
|
+
else
|
25
|
+
revision = arg
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
InchCI::Worker::Build::Task.new(url, branch_name, revision, language)
|
21
30
|
end
|
22
31
|
end
|
23
32
|
|
@@ -39,6 +39,21 @@ module InchCI
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
+
class ResultDeffered < Result
|
43
|
+
def revision_uid; nil; end
|
44
|
+
def revision_message; nil; end
|
45
|
+
def revision_author_name; nil; end
|
46
|
+
def revision_author_email; nil; end
|
47
|
+
def revision_authored_at; nil; end
|
48
|
+
def tag_uid; nil; end
|
49
|
+
def service_name; nil; end
|
50
|
+
def user_name; nil; end
|
51
|
+
def repo_name; nil; end
|
52
|
+
def status
|
53
|
+
'deffered'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
42
57
|
class ResultFail < Result
|
43
58
|
def revision_uid; nil; end
|
44
59
|
def revision_message; nil; end
|
@@ -11,14 +11,14 @@ module InchCI
|
|
11
11
|
module Worker
|
12
12
|
module Build
|
13
13
|
class Task
|
14
|
-
def initialize(url, branch_name = 'master', revision = nil)
|
14
|
+
def initialize(url, branch_name = 'master', revision = nil, language = nil)
|
15
15
|
@work_dir = Dir.mktmpdir
|
16
16
|
if revision.nil?
|
17
17
|
revision = 'HEAD'
|
18
18
|
@latest_revision = true
|
19
19
|
end
|
20
20
|
started_at = Time.now
|
21
|
-
@result = build(url, branch_name, revision, !!@latest_revision)
|
21
|
+
@result = build(url, branch_name, revision, !!@latest_revision, language)
|
22
22
|
@result.finished_at = Time.now
|
23
23
|
@result.started_at = started_at
|
24
24
|
puts Report.new(@result).to_yaml
|
@@ -33,12 +33,12 @@ module InchCI
|
|
33
33
|
BadgeDetector.in_readme?(repo, info)
|
34
34
|
end
|
35
35
|
|
36
|
-
def build(url, branch_name, revision, latest_revision)
|
36
|
+
def build(url, branch_name, revision, latest_revision, language)
|
37
37
|
@url = url
|
38
38
|
if retrieve_repo
|
39
39
|
if repo.change_branch(branch_name, true)
|
40
40
|
if repo.checkout_revision(revision)
|
41
|
-
if @codebase = parse_codebase(repo.path)
|
41
|
+
if @codebase = parse_codebase(language, repo.path)
|
42
42
|
result = ResultSuccess.new(repo, branch_name, latest_revision, @codebase.objects)
|
43
43
|
result.badge_in_readme = badge_in_readme?(result)
|
44
44
|
result
|
@@ -56,18 +56,48 @@ module InchCI
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
def parse_codebase(path)
|
59
|
+
def parse_codebase(language, path)
|
60
|
+
if language.to_s.downcase == 'javascript'
|
61
|
+
parse_javascript_codebase(path)
|
62
|
+
else
|
63
|
+
parse_ruby_codebase(path)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def parse_javascript_codebase(path)
|
68
|
+
dump_file = prepare_javascript_codebase(path)
|
69
|
+
return if dump_file.nil? # this causes ResultParserFailed
|
70
|
+
|
71
|
+
config = to_config(:javascript, path)
|
72
|
+
config.read_dump_file = dump_file
|
73
|
+
begin
|
74
|
+
::Inch::Codebase.parse(path, config)
|
75
|
+
rescue Exception => e
|
76
|
+
warn e.inspect
|
77
|
+
nil
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def parse_ruby_codebase(path)
|
60
82
|
YARD::Config.options[:safe_mode] = true
|
61
83
|
|
62
84
|
begin
|
63
|
-
|
64
|
-
::Inch::Codebase.parse(path, to_config(language, path))
|
85
|
+
::Inch::Codebase.parse(path, to_config(:ruby, path))
|
65
86
|
rescue Exception => e
|
66
87
|
warn e.inspect
|
67
88
|
nil
|
68
89
|
end
|
69
90
|
end
|
70
91
|
|
92
|
+
def prepare_javascript_codebase(path)
|
93
|
+
old_path = Dir.pwd
|
94
|
+
Dir.chdir path
|
95
|
+
`npm install inchjs && inchjs --dry-run`
|
96
|
+
Dir.chdir old_path
|
97
|
+
dump_file = File.join(path, 'docs.json')
|
98
|
+
File.exist?(dump_file) ? dump_file : nil
|
99
|
+
end
|
100
|
+
|
71
101
|
def repo
|
72
102
|
@repo ||= Repomen::Retriever.new(@url, :work_dir => @work_dir)
|
73
103
|
end
|
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inch_ci-worker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- René Föhring
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.6'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: simplecov
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pry
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: inch
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: repomen
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 0.2.0.rc1
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.2.0.rc1
|
97
97
|
description: ''
|
@@ -102,9 +102,9 @@ executables:
|
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
-
- .gitignore
|
106
|
-
- .ruby-gemset
|
107
|
-
- .ruby-version
|
105
|
+
- ".gitignore"
|
106
|
+
- ".ruby-gemset"
|
107
|
+
- ".ruby-version"
|
108
108
|
- Gemfile
|
109
109
|
- LICENSE.txt
|
110
110
|
- README.md
|
@@ -140,17 +140,17 @@ require_paths:
|
|
140
140
|
- lib
|
141
141
|
required_ruby_version: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
147
|
requirements:
|
148
|
-
- -
|
148
|
+
- - ">="
|
149
149
|
- !ruby/object:Gem::Version
|
150
150
|
version: '0'
|
151
151
|
requirements: []
|
152
152
|
rubyforge_project:
|
153
|
-
rubygems_version: 2.
|
153
|
+
rubygems_version: 2.2.2
|
154
154
|
signing_key:
|
155
155
|
specification_version: 4
|
156
156
|
summary: Worker for the Inch CI project
|