coleslaw 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 +7 -0
- data/.gitignore +20 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/bin/coleslaw +145 -0
- data/coleslaw.gemspec +30 -0
- data/lib/coleslaw/gem.rb +7 -0
- data/lib/coleslaw/gem/version.rb +5 -0
- metadata +124 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 34d90f12c58c35f5be2e5544c4ea7c864364bad1
|
4
|
+
data.tar.gz: d209ea4c1f0ed19b86a4266ed194d070419d4893
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 79ca81c9110c5ce025fbe99f8c827bfa20f1eca77a135f334ba25face6b005361f5480ad6e92642bfbbcc46706434dc42f298da62662c72676010e4627c1184f
|
7
|
+
data.tar.gz: 695f6dfe901fdc57194514971de956011e6aca5f7c4fd5c4f0189bbb863ad8e1375454706d45eadb4ef72d8cc514d905e3f3123d781df1dfad23a234dfca98e3
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Phuong Nguyen+Bang Dao
|
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,29 @@
|
|
1
|
+
# Coleslaw::Gem
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'coleslaw-gem'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install coleslaw-gem
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/coleslaw
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'quickl'
|
6
|
+
require 'rest-client'
|
7
|
+
require 'json'
|
8
|
+
rescue LoadError
|
9
|
+
require 'rubygems'
|
10
|
+
gem 'quickl'
|
11
|
+
gem 'curb'
|
12
|
+
retry
|
13
|
+
end
|
14
|
+
|
15
|
+
#
|
16
|
+
# FIX: overview
|
17
|
+
#
|
18
|
+
# SYNOPSIS
|
19
|
+
# #{command_name} [options] PRODUCT_ID
|
20
|
+
#
|
21
|
+
# OPTIONS
|
22
|
+
# #{summarized_options}
|
23
|
+
#
|
24
|
+
# DESCRIPTION
|
25
|
+
# FIX: description
|
26
|
+
#
|
27
|
+
class Coleslaw < Quickl::Command(__FILE__, __LINE__)
|
28
|
+
|
29
|
+
VERSION = "0.1.0"
|
30
|
+
DEFAULT_FEATURES_DIR = "./features"
|
31
|
+
DEFAULT_REPORTS_DIR = "./features/reports"
|
32
|
+
DEFAULT_SERVER = "http://coleslawapp.com"
|
33
|
+
|
34
|
+
# Install options
|
35
|
+
options do |opt|
|
36
|
+
opt.on_tail('--help', "Show this help message"){ raise Quickl::Help }
|
37
|
+
opt.on_tail('--version', "Show version and exit"){ raise Quickl::Exit, "#{Quickl.program_name} #{VERSION}" }
|
38
|
+
opt.on('--token [TOKEN]', "Set your access token") { |t| @token = t }
|
39
|
+
opt.on('--features-dir [FDIR]', "Set the features directory, default to #{DEFAULT_FEATURES_DIR}") do |features_dir|
|
40
|
+
@features_dir = features_dir
|
41
|
+
end
|
42
|
+
opt.on('--reports-dir [RDIR]', "Set the reports directory, default to #{DEFAULT_REPORTS_DIR}") do |reports_dir|
|
43
|
+
@reports_dir = reports_dir
|
44
|
+
end
|
45
|
+
opt.on('--server [SERVER]', "Set the server, default to #{DEFAULT_SERVER}") do |server|
|
46
|
+
@server = server
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def server
|
51
|
+
@server ||= DEFAULT_SERVER
|
52
|
+
end
|
53
|
+
|
54
|
+
def features_dir
|
55
|
+
@features_dir ||= DEFAULT_FEATURES_DIR
|
56
|
+
end
|
57
|
+
|
58
|
+
def reports_dir
|
59
|
+
@reports_dir ||= DEFAULT_REPORTS_DIR
|
60
|
+
end
|
61
|
+
|
62
|
+
def token
|
63
|
+
@token ||= (
|
64
|
+
t = read_token_from_current_working_dir
|
65
|
+
t ||= read_token_from_home_dir
|
66
|
+
t.strip! unless t.nil?
|
67
|
+
t
|
68
|
+
)
|
69
|
+
end
|
70
|
+
|
71
|
+
def read_token_from_current_working_dir
|
72
|
+
if File.exist?("~/.coleslaw")
|
73
|
+
File.open("~/.coleslaw") do |f|
|
74
|
+
return f.read
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def read_token_from_home_dir
|
80
|
+
if File.exist?(".coleslaw")
|
81
|
+
File.open(".coleslaw") do |f|
|
82
|
+
return f.read
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def execute(args)
|
88
|
+
unless token
|
89
|
+
raise Quickl::InvalidArgument, "Please provide token by either use --token or create .coleslaw file in your current working directory"
|
90
|
+
end
|
91
|
+
|
92
|
+
product_id = args.first.to_i
|
93
|
+
|
94
|
+
unless product_id > 0
|
95
|
+
raise Quickl::InvalidArgument, "Invalid product id"
|
96
|
+
end
|
97
|
+
|
98
|
+
puts "Creating new test result..."
|
99
|
+
if (test_result_id = create_test_result(product_id))
|
100
|
+
test_result_files.each do |test_result_file|
|
101
|
+
puts "Uploading [#{test_result_file}]"
|
102
|
+
upload_test_result_file(product_id, test_result_id, test_result_file)
|
103
|
+
end
|
104
|
+
puts "Successfully created test result ##{test_result_id}"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def request_options
|
109
|
+
{ content_type: :json, :accept => :json, :'Token-Secret' => token }
|
110
|
+
end
|
111
|
+
|
112
|
+
def create_test_result(product_id)
|
113
|
+
response = RestClient.post(
|
114
|
+
server + "/products/#{product_id}/test_results",
|
115
|
+
{},
|
116
|
+
**request_options
|
117
|
+
)
|
118
|
+
|
119
|
+
test_result = JSON.parse(response.body)
|
120
|
+
test_result["id"]
|
121
|
+
rescue => e
|
122
|
+
STDERR.puts e.http_body
|
123
|
+
nil
|
124
|
+
end
|
125
|
+
|
126
|
+
def upload_test_result_file(product_id, test_result_id, test_result_file)
|
127
|
+
RestClient.post(
|
128
|
+
server + "/products/#{product_id}/test_results/#{test_result_id}/test_result_files",
|
129
|
+
{
|
130
|
+
test_result_file: {
|
131
|
+
path: test_result_file,
|
132
|
+
file: File.new(test_result_file, 'rb')
|
133
|
+
}
|
134
|
+
},
|
135
|
+
**request_options
|
136
|
+
)
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_result_files
|
140
|
+
Dir[features_dir + "/**/*.feature"] + Dir[reports_dir + "/**/*.xml"]
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
Coleslaw.run(ARGV)
|
data/coleslaw.gemspec
ADDED
@@ -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 'coleslaw/gem/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "coleslaw"
|
8
|
+
spec.version = Coleslaw::Gem::VERSION
|
9
|
+
spec.authors = ["Phuong Nguyen"]
|
10
|
+
spec.email = ["phuong.nguyen@eastagile.com"]
|
11
|
+
spec.description = %q{A gem that allow you to upload your test results to http://coleslawapp.com}
|
12
|
+
spec.summary = %q{A gem that allow you to upload your test results to http://coleslawapp.com}
|
13
|
+
spec.homepage = "http://github.com/EastAgile/coleslaw-gem"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = ["coleslaw"]
|
18
|
+
spec.test_files = []
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.bindir = "bin"
|
22
|
+
spec.executables = (Dir["bin/*"]).collect { |f| File.basename(f) }
|
23
|
+
|
24
|
+
spec.add_dependency "quickl"
|
25
|
+
spec.add_dependency "rest-client"
|
26
|
+
spec.add_dependency "json"
|
27
|
+
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
29
|
+
spec.add_development_dependency "byebug"
|
30
|
+
end
|
data/lib/coleslaw/gem.rb
ADDED
metadata
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: coleslaw
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Phuong Nguyen
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: quickl
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rest-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: json
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: byebug
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: A gem that allow you to upload your test results to http://coleslawapp.com
|
84
|
+
email:
|
85
|
+
- phuong.nguyen@eastagile.com
|
86
|
+
executables:
|
87
|
+
- coleslaw
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- .gitignore
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE.txt
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- bin/coleslaw
|
97
|
+
- coleslaw.gemspec
|
98
|
+
- lib/coleslaw/gem.rb
|
99
|
+
- lib/coleslaw/gem/version.rb
|
100
|
+
homepage: http://github.com/EastAgile/coleslaw-gem
|
101
|
+
licenses:
|
102
|
+
- MIT
|
103
|
+
metadata: {}
|
104
|
+
post_install_message:
|
105
|
+
rdoc_options: []
|
106
|
+
require_paths:
|
107
|
+
- lib
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
requirements: []
|
119
|
+
rubyforge_project:
|
120
|
+
rubygems_version: 2.0.3
|
121
|
+
signing_key:
|
122
|
+
specification_version: 4
|
123
|
+
summary: A gem that allow you to upload your test results to http://coleslawapp.com
|
124
|
+
test_files: []
|