inch_ci-worker 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04e53075ccd7d34e6011b8aeb358c1c6ac390d25
4
- data.tar.gz: 57984ce509324b19a2707cc44adc07bd0ce378c9
3
+ metadata.gz: b2d0b436c7e8623dffd27df2c5964ce72bbd5b1a
4
+ data.tar.gz: e466709de16607c68d949c749a9f2956fa422e5a
5
5
  SHA512:
6
- metadata.gz: 782f8a1c01ff3cf15dc18cf22137f37af335de193e26e143ff9fd44eaf4028d20baec64636a578540de16a1749abe525b59cb6bd8c9553fb3ca89fe95134a542
7
- data.tar.gz: 9126f9f07d25f79bc9da189effdf6897d5abb3ecd057a5e27ee785715605bf0f0cda77e55538e244bbcc6ee2a6b0c474c529eeaf07d8ce634c02f600a5a09472
6
+ metadata.gz: 2d86c389c02ee8ee5b9033ad2ae1521fd3973cc30db7690b470704f5fe447d334af9fc0b62d1acb8a7acde8c1a575778c9e710ab3e834a3c07f9b80eda364502
7
+ data.tar.gz: ccd73a0a0e9298b407b34bb7fa9a60ae714da200d63b3cbb5fad1ce7786005d37554c2ef22aa9226f049924cc1ceb3b8fbb8b4c870f2db0ecddcba4ea55072f4
@@ -22,6 +22,7 @@ module InchCI
22
22
  data['service_name'] = build.service_name.to_s if build.service_name
23
23
  data['user_name'] = build.user_name if build.user_name
24
24
  data['repo_name'] = build.repo_name if build.repo_name
25
+ data['badge_in_readme'] = build.badge_in_readme
25
26
  if build.revision_uid
26
27
  data['revision_uid'] = build.revision_uid
27
28
  data['revision_message'] = build.revision_message
@@ -12,6 +12,7 @@ module InchCI
12
12
  def_delegators :repo, :revision_authored_at
13
13
 
14
14
  attr_accessor :started_at
15
+ attr_accessor :badge_in_readme
15
16
  attr_accessor :finished_at
16
17
  attr_writer :status
17
18
 
@@ -32,7 +32,9 @@ module InchCI
32
32
  if repo.change_branch(branch_name, true)
33
33
  if repo.checkout_revision(revision)
34
34
  if @codebase = parse_codebase(repo.path)
35
- ResultSuccess.new(repo, branch_name, latest_revision, @codebase.objects)
35
+ result = ResultSuccess.new(repo, branch_name, latest_revision, @codebase.objects)
36
+ result.badge_in_readme = badge_in_readme?(result)
37
+ result
36
38
  else
37
39
  ResultParserFailed.new(repo, branch_name, latest_revision, nil)
38
40
  end
@@ -47,6 +49,20 @@ module InchCI
47
49
  end
48
50
  end
49
51
 
52
+ # @param info [#service_name,#user_name,#repo_name]
53
+ def badge_in_readme?(info)
54
+ filename = Dir[repo.path, '*.*'].detect do |f|
55
+ File.basename(f) =~ /\Areadme\./i
56
+ end
57
+ if filename
58
+ contents = File.read(File.join(repo.path, filename))
59
+ pattern = Regexp.escape("inch-ci.org/#{info.service_name}/#{info.user_name}/#{info.repo_name}")
60
+ !!( contents =~ /#{pattern}/mi )
61
+ else
62
+ false
63
+ end
64
+ end
65
+
50
66
  def parse_codebase(path)
51
67
  YARD::Config.options[:safe_mode] = true
52
68
  begin
@@ -1,5 +1,5 @@
1
1
  module InchCI
2
2
  module Worker
3
- VERSION = "0.2.6"
3
+ VERSION = "0.2.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inch_ci-worker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
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: 2014-06-02 00:00:00.000000000 Z
11
+ date: 2014-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler