summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2015-05-20 12:57:29 +0000
committerValery Sizov <valery@gitlab.com>2015-05-20 12:57:29 +0000
commit1776dc536302257af9201c93e8810a1783af5e02 (patch)
tree3def9b680bad496e4d12d694845a7c2696c3901f
parent1f82dda74c6e24b6ad0a6f91312a5da72a93537c (diff)
parent1c9337600dd62fbf333cc61f937e6e5d50dee5c9 (diff)
downloadgitlab-ci-1776dc536302257af9201c93e8810a1783af5e02.tar.gz
Merge branch 'nice-badges' into 'master'
Use retina-ready standard badges Fixes https://dev.gitlab.org/gitlab/gitlab-ci/issues/233. Generated with http://shields.io/ ![wow](https://gitlab.com/gitlab-org/gitlab-ci/uploads/a8fc87975f9c045077421f0242c82ebf/wow.png) See merge request !108
-rw-r--r--app/controllers/projects_controller.rb2
-rw-r--r--app/services/image_for_build_service.rb10
-rw-r--r--public/build-canceled.svg1
-rw-r--r--public/build-failed.svg1
-rw-r--r--public/build-pending.svg1
-rw-r--r--public/build-running.svg1
-rw-r--r--public/build-success.svg1
-rw-r--r--public/build-unknown.svg1
-rw-r--r--public/canceled.pngbin4329 -> 0 bytes
-rw-r--r--public/failed.pngbin1311 -> 0 bytes
-rw-r--r--public/pending.pngbin4189 -> 0 bytes
-rw-r--r--public/running.pngbin1210 -> 0 bytes
-rw-r--r--public/success.pngbin1324 -> 0 bytes
-rw-r--r--public/unknown.pngbin1415 -> 0 bytes
-rw-r--r--spec/services/image_for_build_service_spec.rb16
15 files changed, 18 insertions, 16 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 4c4d34e..ad5b120 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -99,7 +99,7 @@ class ProjectsController < ApplicationController
def badge
image = ImageForBuildService.new.execute(@project, params)
- send_file image.path, filename: image.name, disposition: 'inline'
+ send_file image.path, filename: image.name, disposition: 'inline', type:"image/svg+xml"
end
def toggle_shared_runners
diff --git a/app/services/image_for_build_service.rb b/app/services/image_for_build_service.rb
index 382e969..50e5531 100644
--- a/app/services/image_for_build_service.rb
+++ b/app/services/image_for_build_service.rb
@@ -8,7 +8,7 @@ class ImageForBuildService
commit = project.last_commit_for_ref(params[:ref])
image_for_commit(commit)
else
- 'unknown.png'
+ 'build-unknown.svg'
end
image_path = Rails.root.join('public', image_name)
@@ -22,12 +22,8 @@ class ImageForBuildService
private
def image_for_commit(commit)
- return 'unknown.png' unless commit
+ return 'build-unknown.svg' unless commit
- if commit.status == 'pending'
- 'running.png'
- else
- commit.status + ".png"
- end
+ 'build-' + commit.status + ".svg"
end
end
diff --git a/public/build-canceled.svg b/public/build-canceled.svg
new file mode 100644
index 0000000..922e28b
--- /dev/null
+++ b/public/build-canceled.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="97" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="a"><rect width="97" height="20" rx="3" fill="#fff"/></mask><g mask="url(#a)"><path fill="#555" d="M0 0h37v20H0z"/><path fill="#9f9f9f" d="M37 0h60v20H37z"/><path fill="url(#b)" d="M0 0h97v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"><text x="18.5" y="15" fill="#010101" fill-opacity=".3">build</text><text x="18.5" y="14">build</text><text x="66" y="15" fill="#010101" fill-opacity=".3">canceled</text><text x="66" y="14">canceled</text></g></svg> \ No newline at end of file
diff --git a/public/build-failed.svg b/public/build-failed.svg
new file mode 100644
index 0000000..1aefd3f
--- /dev/null
+++ b/public/build-failed.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="78" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="a"><rect width="78" height="20" rx="3" fill="#fff"/></mask><g mask="url(#a)"><path fill="#555" d="M0 0h37v20H0z"/><path fill="#e05d44" d="M37 0h41v20H37z"/><path fill="url(#b)" d="M0 0h78v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"><text x="18.5" y="15" fill="#010101" fill-opacity=".3">build</text><text x="18.5" y="14">build</text><text x="56.5" y="15" fill="#010101" fill-opacity=".3">failed</text><text x="56.5" y="14">failed</text></g></svg> \ No newline at end of file
diff --git a/public/build-pending.svg b/public/build-pending.svg
new file mode 100644
index 0000000..536931a
--- /dev/null
+++ b/public/build-pending.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="92" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="a"><rect width="92" height="20" rx="3" fill="#fff"/></mask><g mask="url(#a)"><path fill="#555" d="M0 0h37v20H0z"/><path fill="#dfb317" d="M37 0h55v20H37z"/><path fill="url(#b)" d="M0 0h92v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"><text x="18.5" y="15" fill="#010101" fill-opacity=".3">build</text><text x="18.5" y="14">build</text><text x="63.5" y="15" fill="#010101" fill-opacity=".3">pending</text><text x="63.5" y="14">pending</text></g></svg> \ No newline at end of file
diff --git a/public/build-running.svg b/public/build-running.svg
new file mode 100644
index 0000000..0d71eef
--- /dev/null
+++ b/public/build-running.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="90" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="a"><rect width="90" height="20" rx="3" fill="#fff"/></mask><g mask="url(#a)"><path fill="#555" d="M0 0h37v20H0z"/><path fill="#dfb317" d="M37 0h53v20H37z"/><path fill="url(#b)" d="M0 0h90v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"><text x="18.5" y="15" fill="#010101" fill-opacity=".3">build</text><text x="18.5" y="14">build</text><text x="62.5" y="15" fill="#010101" fill-opacity=".3">running</text><text x="62.5" y="14">running</text></g></svg> \ No newline at end of file
diff --git a/public/build-success.svg b/public/build-success.svg
new file mode 100644
index 0000000..43b67e4
--- /dev/null
+++ b/public/build-success.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="91" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="a"><rect width="91" height="20" rx="3" fill="#fff"/></mask><g mask="url(#a)"><path fill="#555" d="M0 0h37v20H0z"/><path fill="#4c1" d="M37 0h54v20H37z"/><path fill="url(#b)" d="M0 0h91v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"><text x="18.5" y="15" fill="#010101" fill-opacity=".3">build</text><text x="18.5" y="14">build</text><text x="63" y="15" fill="#010101" fill-opacity=".3">success</text><text x="63" y="14">success</text></g></svg> \ No newline at end of file
diff --git a/public/build-unknown.svg b/public/build-unknown.svg
new file mode 100644
index 0000000..c72a2f5
--- /dev/null
+++ b/public/build-unknown.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="98" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="a"><rect width="98" height="20" rx="3" fill="#fff"/></mask><g mask="url(#a)"><path fill="#555" d="M0 0h37v20H0z"/><path fill="#9f9f9f" d="M37 0h61v20H37z"/><path fill="url(#b)" d="M0 0h98v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"><text x="18.5" y="15" fill="#010101" fill-opacity=".3">build</text><text x="18.5" y="14">build</text><text x="66.5" y="15" fill="#010101" fill-opacity=".3">unknown</text><text x="66.5" y="14">unknown</text></g></svg> \ No newline at end of file
diff --git a/public/canceled.png b/public/canceled.png
deleted file mode 100644
index 2d6f467..0000000
--- a/public/canceled.png
+++ /dev/null
Binary files differ
diff --git a/public/failed.png b/public/failed.png
deleted file mode 100644
index e751ade..0000000
--- a/public/failed.png
+++ /dev/null
Binary files differ
diff --git a/public/pending.png b/public/pending.png
deleted file mode 100644
index 69e18f3..0000000
--- a/public/pending.png
+++ /dev/null
Binary files differ
diff --git a/public/running.png b/public/running.png
deleted file mode 100644
index 2398b4d..0000000
--- a/public/running.png
+++ /dev/null
Binary files differ
diff --git a/public/success.png b/public/success.png
deleted file mode 100644
index 83eef5c..0000000
--- a/public/success.png
+++ /dev/null
Binary files differ
diff --git a/public/unknown.png b/public/unknown.png
deleted file mode 100644
index 04a43e8..0000000
--- a/public/unknown.png
+++ /dev/null
Binary files differ
diff --git a/spec/services/image_for_build_service_spec.rb b/spec/services/image_for_build_service_spec.rb
index 01a48e7..4c70941 100644
--- a/spec/services/image_for_build_service_spec.rb
+++ b/spec/services/image_for_build_service_spec.rb
@@ -14,16 +14,16 @@ describe ImageForBuildService do
let(:image) { service.execute(project, ref: 'master') }
it { image.should be_kind_of(OpenStruct) }
- it { image.path.to_s.should include('public/running.png') }
- it { image.name.should == 'running.png' }
+ it { image.path.to_s.should include('public/build-running.svg') }
+ it { image.name.should == 'build-running.svg' }
end
context 'unknown branch name' do
let(:image) { service.execute(project, ref: 'feature') }
it { image.should be_kind_of(OpenStruct) }
- it { image.path.to_s.should include('public/unknown.png') }
- it { image.name.should == 'unknown.png' }
+ it { image.path.to_s.should include('public/build-unknown.svg') }
+ it { image.name.should == 'build-unknown.svg' }
end
context 'commit sha' do
@@ -31,16 +31,16 @@ describe ImageForBuildService do
let(:image) { service.execute(project, sha: build.sha) }
it { image.should be_kind_of(OpenStruct) }
- it { image.path.to_s.should include('public/running.png') }
- it { image.name.should == 'running.png' }
+ it { image.path.to_s.should include('public/build-running.svg') }
+ it { image.name.should == 'build-running.svg' }
end
context 'unknown commit sha' do
let(:image) { service.execute(project, sha: '0000000') }
it { image.should be_kind_of(OpenStruct) }
- it { image.path.to_s.should include('public/unknown.png') }
- it { image.name.should == 'unknown.png' }
+ it { image.path.to_s.should include('public/build-unknown.svg') }
+ it { image.name.should == 'build-unknown.svg' }
end
end
end