mina-ci 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cfce2b48ca849fd415abdd74c7b14d370d5fa18d
4
+ data.tar.gz: 4eae0dddba6be5851a9961a39a08913976ae67e7
5
+ SHA512:
6
+ metadata.gz: 2ef3ae944f934ab6147763219b6d090a1947c247bb698286ab7121fa8d9578308446fab2d404ae926c69404090ccf4ba767351598c40ff6d8949d300b911ceea
7
+ data.tar.gz: 2c5741e4d1e9094ec7f9ea344b47745dd196ef437232a1093870c95370aa0d4d36012f84f401d10a49ae09be3a669913ff7d4feaad2fe911f8010d22697e45c4
data/.gitignore ADDED
@@ -0,0 +1,35 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /vendor/bundle
26
+ /lib/bundler/man/
27
+
28
+ # for a library or gem, you might want to ignore these files since the code is
29
+ # intended to run in multiple environments; otherwise, check them in:
30
+ # Gemfile.lock
31
+ # .ruby-version
32
+ # .ruby-gemset
33
+
34
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
35
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mina-ci.gemspec
4
+ gemspec
data/LICENCE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Sean Dong
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # mina-ci
2
+ Mina recipe for checking Circle CI build status
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require 'rake/testtask'
2
+
3
+ Rake::TestTask.new do |t|
4
+ t.libs << 'test'
5
+ end
6
+
7
+ desc "Run tests"
8
+ task :default => :test
@@ -0,0 +1,50 @@
1
+ require 'json'
2
+
3
+ # # Modules: CI
4
+ # Adds settings and tasks for checking CircleCI status.
5
+ #
6
+ # require 'mina/ci'
7
+ #
8
+ # ## Settings
9
+ #
10
+ # ### circle_token
11
+ # CircleCI API access token.
12
+ #
13
+ # ### circle_username
14
+ # CircleCI username
15
+ #
16
+ # ### circle_project
17
+ # Name by which CircleCI knows your project
18
+ #
19
+
20
+ set_default :circle_token, fail('CircleCI token required')
21
+ set_default :circle_username, fail('CircleCI username required')
22
+ set_default :circle_project, fail('CircleCI project required')
23
+
24
+ namespace :ci do
25
+
26
+ desc 'Verify CircleCI building status.'
27
+ task :verify_status => :evironment do
28
+ queue %[echo "-----> check CircleCI status"]
29
+ unless %w(success fixed).include?(cricle_status)
30
+ die 1, "CircleCI not passed (#{cricle_status}), please check and fix problem first."
31
+ end
32
+ end
33
+
34
+ private
35
+
36
+ def circle_url
37
+ "https://circleci.com/api/v1/project/#{circle_username}/#{circle_project}?circle-token=#{circle_token}"
38
+ end
39
+
40
+ def circle_repsonse
41
+ JSON.parse `curl -H 'Accept: application/json' #{circle_url}`
42
+ end
43
+
44
+ def cricle_status
45
+ @cricle_status ||= begin
46
+ response = circle_repsonse.find { |item| item['branch'] == branch }
47
+ response.nil? ? '' : response['status']
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,5 @@
1
+ module Mina
2
+ module Ci
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
data/lib/mina/ci.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'mina/ci/version'
2
+ require 'mina/ci/tasks'
data/mina-ci.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'mina/ci/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'mina-ci'
7
+ spec.version = Mina::Ci::VERSION
8
+ spec.authors = ['Sean Dong']
9
+ spec.email = ['sindon@gmail.com']
10
+ spec.summary = %q{Mina recipe for checking Circle CI build status}
11
+ spec.description = %q{Mina recipe for checking Circle CI build status of your repo.}
12
+ spec.homepage = 'https://github.com/seandong/mina-ci'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.add_development_dependency 'bundler', '~> 1.6'
21
+ spec.add_development_dependency "minitest", "~> 5.0"
22
+
23
+ spec.add_runtime_dependency 'mina', '~> 0.3', '>= 0.3.0'
24
+ end
@@ -0,0 +1 @@
1
+ require 'test_helper'
@@ -0,0 +1 @@
1
+ require "minitest/autorun"
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mina-ci
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Sean Dong
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: mina
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.3'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 0.3.0
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '0.3'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 0.3.0
61
+ description: Mina recipe for checking Circle CI build status of your repo.
62
+ email:
63
+ - sindon@gmail.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files: []
67
+ files:
68
+ - ".gitignore"
69
+ - Gemfile
70
+ - LICENCE.txt
71
+ - README.md
72
+ - Rakefile
73
+ - lib/mina/ci.rb
74
+ - lib/mina/ci/tasks.rb
75
+ - lib/mina/ci/version.rb
76
+ - mina-ci.gemspec
77
+ - test/ci/tasks_test.rb
78
+ - test/test_helper.rb
79
+ homepage: https://github.com/seandong/mina-ci
80
+ licenses:
81
+ - MIT
82
+ metadata: {}
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.4.5
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: Mina recipe for checking Circle CI build status
103
+ test_files:
104
+ - test/ci/tasks_test.rb
105
+ - test/test_helper.rb