capistrano-ninetyninetests 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1df1eb4d1b07f1a87d014a63800f950915645ca2
4
+ data.tar.gz: 3ed5a6e550ab9416a81c32d4c2295079ca14ecb5
5
+ SHA512:
6
+ metadata.gz: eb6a300d77ad39275eda8dcad85299f982d0d0155a5326070f8bfccd358c34c9b7c031806624d814a463a0f42836ba88907e0e71e3fef0e49214ba11e66f12d8
7
+ data.tar.gz: 5e69676dc4c0821b0119434cb15800c469dd353499845a6f4c27f4292001485084c9b1a9248fce5736482bd5d348c556438a45f598d699f975e190cb18d0abfb
data/.gitignore ADDED
@@ -0,0 +1,50 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at sushmitha@99tests.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in capistrano-ninetyninetests.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 sushmithavshetty
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Capistrano::Ninetyninetests
2
+
3
+ This gem integrates your project with 99tests CrowdCI.
4
+
5
+ Use this gem to automatically update bugfix status and launch new cycles to test your product.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'capistrano-ninetyninetests', require: false
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install capistrano-ninetyninetests
22
+
23
+ ## Usage
24
+
25
+ To trigger a new test cycle on 99tests, create a TESTME.md file with requirements before you deploy your code.
26
+
27
+ Add bug hastags(e.g. #bug-12543) to your commit messages to automatically mark bugs as fixed everytime you deploy the code.
28
+
29
+ New cycles will be triggered everytime you modify TESTME.md and deploy.
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/capistrano-ninetyninetests. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
34
+
35
+ ## License
36
+
37
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
38
+
39
+ ## Code of Conduct
40
+
41
+ Everyone interacting in the Capistrano::Ninetyninetests project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/capistrano-ninetyninetests/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "capistrano/ninetyninetests"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "capistrano/ninetyninetests/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "capistrano-ninetyninetests"
8
+ spec.version = Capistrano::Ninetyninetests::VERSION
9
+ spec.authors = ["Mahadevan K","Sushmitha Shetty"]
10
+ spec.email = ["maha@99tests.com","sushmitha@99tests.com"]
11
+
12
+ spec.summary = %q{Capistrano 99tests CrowdCI deployment plugin}
13
+ spec.description = %q{Capistrano 99tests CrowdCI deployment plugin}
14
+ spec.homepage = "https://99tests.com"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+
20
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
21
+ f.match(%r{^(test|spec|features)/})
22
+ end
23
+ spec.bindir = "exe"
24
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
+ spec.require_paths = ["lib"]
26
+
27
+ # spec.add_development_dependency "bundler", "~> 1.15"
28
+ # spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "httparty"
30
+ end
@@ -0,0 +1 @@
1
+ load File.expand_path('../tasks/ninetyninetests.rake', __FILE__)
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module Ninetyninetests
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,83 @@
1
+ require 'httparty'
2
+ namespace :ninetyninetests do
3
+ task :crowdci do
4
+ on primary(fetch(:crowdci_roles)) do
5
+ stage = fetch(:crowdci_stage)
6
+ conf = YAML::load(File.open('config/crowdci.yml'))[stage]
7
+ if stage == "production"
8
+ @server_name = "http://99tests.com"
9
+ elsif stage == "staging"
10
+ @server_name = "http://testfolio.in"
11
+ else
12
+ @server_name = "http://localhost:3000"
13
+ end
14
+ response = HTTParty.get("#{@server_name}/api/v1/enterprisecycles?product_id=#{conf['product_id']}",
15
+ :headers => {"X-Auth-User" => "#{conf['email']}", "X-Auth-Key" => "#{conf['api_key']}"})
16
+
17
+ rex = /TESTME.md/
18
+ git_messages = `git log --since="#{response['start_time']}" --name-only`
19
+ unless git_messages.match(rex).nil?
20
+ info "CrowdCI: Found new Test requirements in TESTME.md"
21
+ if Time.now < Time.parse(response["end_time"])
22
+ info "CrowdCI: You currently have a cycle running, not creating a new cycle right now"
23
+ update_fixed_bugs(response,response)
24
+ else
25
+ info "CrowdCI: Creating new test cycle"
26
+ new_cycle = HTTParty.post("#{@server_name}/api/v1/enterprisecycles",
27
+ :body => {enterprisecycle_id: response["id"]}.to_json,
28
+ :headers => {"X-Auth-User" => "#{conf['email']}", "X-Auth-Key" => "#{conf['api_key']}",'Content-Type' => 'application/json'})
29
+ if new_cycle.code == 201
30
+ info "CrowdCI: Cycle successfully created"
31
+ update_fixed_bugs(response,new_cycle,File.read("TESTME.md"))
32
+ else
33
+ info "CrowdCI: Issue creating cycle, admins have been notified"
34
+ end
35
+ end
36
+ else
37
+ info "CrowdCI: Updating current cycle with fixed bugs"
38
+ update_fixed_bugs(response,response)
39
+ end
40
+ info "CrowdCI: Deployment check complete"
41
+ end
42
+ end
43
+ def update_fixed_bugs(from_cycle,to_cycle,initial_requirement=nil)
44
+ # info "updating requirements from cycle #{from_cycle['id']} to #{to_cycle['id']}"
45
+ stage = fetch(:crowdci_stage)
46
+ conf = YAML::load(File.open('config/crowdci.yml'))[stage]
47
+ git_messages = `git log --since="#{from_cycle['start_time']}" --name-only`
48
+ re = /#bug-([0-9]+)/
49
+ bugs_ids = git_messages.scan re
50
+ bugs_ids.flatten!
51
+ bugs_ids.uniq!
52
+ if bugs_ids.length > 0
53
+ info "CrowdCI: Marking bugs " + bugs_ids.join(',') + " as fixed"
54
+ HTTParty.post("#{@server_name}/api/v1/enterprisecycle_bugs",
55
+ :body => {enterprisecycle_id: from_cycle["id"], bugs_ids: bugs_ids}.to_json,
56
+ :headers => {"X-Auth-User" => "#{conf['email']}", "X-Auth-Key" => "#{conf['api_key']}",'Content-Type' => 'application/json'})
57
+ else
58
+ info "CrowdCI: No bug fixes found"
59
+ end
60
+ if initial_requirement
61
+ requirement = "<p> #{initial_requirement} </p>"+ "<p>Bugs fixed in previous cycle</p>"
62
+ else
63
+ cycle_requirement = from_cycle["requirement"] ? from_cycle["requirement"] : ""
64
+ requirement = cycle_requirement + "<p>New Deployment #{Time.now}</p>" + "<p>Bugs fixed</p>"
65
+ end
66
+ url = "#{@server_name}/enterprise-test-cycle/#{from_cycle['id']}/bugs/"
67
+ bugs_ids.each do |bug_id|
68
+ requirement += "<a href = #{url+bug_id}>#{bug_id}</a> "
69
+ end
70
+ HTTParty.put("#{@server_name}/api/v1/enterprisecycles/#{to_cycle['id']}",
71
+ :body => {requirement: requirement}.to_json,
72
+ :headers => {"X-Auth-User" => "#{conf['email']}", "X-Auth-Key" => "#{conf['api_key']}",'Content-Type' => 'application/json'})
73
+ end
74
+ after 'deploy:published', 'ninetyninetests:crowdci' do
75
+ invoke 'ninetyninetests:crowdci'
76
+ end
77
+ end
78
+ namespace :load do
79
+ task :defaults do
80
+ set_if_empty :crowdci_roles, :web
81
+ set_if_empty :crowdci_stage, "production"
82
+ end
83
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-ninetyninetests
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Mahadevan K
8
+ - Sushmitha Shetty
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2017-09-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: httparty
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ description: Capistrano 99tests CrowdCI deployment plugin
29
+ email:
30
+ - maha@99tests.com
31
+ - sushmitha@99tests.com
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - ".gitignore"
37
+ - CODE_OF_CONDUCT.md
38
+ - Gemfile
39
+ - LICENSE
40
+ - LICENSE.txt
41
+ - README.md
42
+ - Rakefile
43
+ - bin/console
44
+ - bin/setup
45
+ - capistrano-ninetyninetests.gemspec
46
+ - lib/capistrano/ninetyninetests.rb
47
+ - lib/capistrano/ninetyninetests/version.rb
48
+ - lib/capistrano/tasks/ninetyninetests.rake
49
+ homepage: https://99tests.com
50
+ licenses:
51
+ - MIT
52
+ metadata: {}
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubyforge_project:
69
+ rubygems_version: 2.4.5.2
70
+ signing_key:
71
+ specification_version: 4
72
+ summary: Capistrano 99tests CrowdCI deployment plugin
73
+ test_files: []