ki_youtrack 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.
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +2 -0
- data/Rakefile +23 -0
- data/bin/ki_youtrack +58 -0
- data/ki_youtrack.gemspec +31 -0
- data/lib/ki_youtrack/api.rb +21 -0
- data/lib/ki_youtrack/creds.rb +10 -0
- data/lib/ki_youtrack/issue_filter.rb +25 -0
- data/lib/ki_youtrack/kiseru.rb +48 -0
- data/lib/ki_youtrack/session.rb +52 -0
- data/lib/ki_youtrack/version.rb +3 -0
- data/lib/ki_youtrack.rb +20 -0
- data/spec/integration/get_bug_spec.rb +24 -0
- data/spec/spec_helper.rb +43 -0
- data/spec/unit/issue_filter_spec.rb +68 -0
- data/spec/unit/kiseru_spec.rb +28 -0
- data/spec/unit/session_spec.rb +42 -0
- metadata +205 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Ben Brinckerhoff
|
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
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
|
5
|
+
desc 'Default: run specs.'
|
6
|
+
task :default => :spec
|
7
|
+
|
8
|
+
desc "Run specs"
|
9
|
+
RSpec::Core::RakeTask.new do |t|
|
10
|
+
t.pattern = "./spec/**/*_spec.rb"
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Generate code coverage"
|
14
|
+
RSpec::Core::RakeTask.new("spec:coverage") do |t|
|
15
|
+
ENV['COVERAGE'] = "true"
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "Delete *all* VCR cassettes (!)"
|
19
|
+
namespace :spec do
|
20
|
+
task :vcr_wipe do
|
21
|
+
FileUtils.rm_rf('spec/fixtures/vcr_cassettes')
|
22
|
+
end
|
23
|
+
end
|
data/bin/ki_youtrack
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# 1.9 adds realpath to resolve symlinks; 1.8 doesn't
|
3
|
+
# have this method, so we add it so we get resolved symlinks
|
4
|
+
# and compatibility
|
5
|
+
unless File.respond_to? :realpath
|
6
|
+
class File #:nodoc:
|
7
|
+
def self.realpath path
|
8
|
+
return realpath(File.readlink(path)) if symlink?(path)
|
9
|
+
path
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
$LOAD_PATH << File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../lib')
|
15
|
+
|
16
|
+
require 'rubygems'
|
17
|
+
require 'gli'
|
18
|
+
require 'ki_youtrack'
|
19
|
+
|
20
|
+
include GLI
|
21
|
+
|
22
|
+
program_desc 'A command-line interface to YouTrack'
|
23
|
+
|
24
|
+
version KiYoutrack::VERSION
|
25
|
+
|
26
|
+
# pre do |global_options,command,options,args|
|
27
|
+
# end
|
28
|
+
|
29
|
+
desc 'Get a issue'
|
30
|
+
arg_name '[issue id]'
|
31
|
+
command :issue do |c|
|
32
|
+
c.action do |global_options, options, args|
|
33
|
+
pretty = $stdout.tty?
|
34
|
+
|
35
|
+
id = args.first
|
36
|
+
json = KiYoutrack::Api.issue(id, :pretty => pretty)
|
37
|
+
$stdout.puts(json)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
desc 'Set up config file'
|
42
|
+
command :setup do |c|
|
43
|
+
c.action do |global_options, options, args|
|
44
|
+
config = Kiseru::Config[:ki_youtrack]
|
45
|
+
|
46
|
+
ui = HighLine.new
|
47
|
+
|
48
|
+
username = config.read(:username) || ui.ask("Username: ")
|
49
|
+
password = config.read(:password) || ui.ask("Password: ") { |q| q.echo = false }
|
50
|
+
subdomain = config.read(:subdomain) || ui.ask("Subdomain: ")
|
51
|
+
|
52
|
+
config.write(:username, username)
|
53
|
+
config.write(:password, password)
|
54
|
+
config.write(:subdomain, subdomain)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
exit GLI.run(ARGV)
|
data/ki_youtrack.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/ki_youtrack/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Ben Brinckerhoff", "Aaron Cronin"]
|
6
|
+
gem.email = ["ben@freeagent.com", "aaron@freeagent.com"]
|
7
|
+
gem.description = %q{Kiseru YouTrack client}
|
8
|
+
gem.summary = %q{Kiseru YouTrack client}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "ki_youtrack"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = KiYoutrack::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency('gli')
|
19
|
+
gem.add_dependency('faraday')
|
20
|
+
gem.add_dependency('faraday_middleware')
|
21
|
+
gem.add_dependency('multi_xml')
|
22
|
+
gem.add_dependency('multi_json')
|
23
|
+
gem.add_dependency('highline')
|
24
|
+
|
25
|
+
gem.add_development_dependency('debugger')
|
26
|
+
gem.add_development_dependency('rspec')
|
27
|
+
gem.add_development_dependency('simplecov')
|
28
|
+
gem.add_development_dependency('test-construct')
|
29
|
+
gem.add_development_dependency('vcr')
|
30
|
+
gem.add_development_dependency('webmock')
|
31
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module KiYoutrack
|
2
|
+
|
3
|
+
class Api
|
4
|
+
|
5
|
+
def self.issue(id, opts = {})
|
6
|
+
config = Kiseru::Config[:ki_youtrack]
|
7
|
+
username = config.read(:username)
|
8
|
+
password = config.read(:password)
|
9
|
+
subdomain = config.read(:subdomain)
|
10
|
+
ssl = config.read(:ssl)
|
11
|
+
session = Session.new(username, password, subdomain, :ssl => ssl)
|
12
|
+
session.init
|
13
|
+
response = session.get_bug(id)
|
14
|
+
|
15
|
+
filtered_data = IssueFilter.filter(response.body['issue'])
|
16
|
+
MultiJson.dump(filtered_data, :pretty => opts[:pretty])
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module KiYoutrack
|
2
|
+
|
3
|
+
class IssueFilter
|
4
|
+
|
5
|
+
def self.filter(data)
|
6
|
+
new_data = {}
|
7
|
+
new_data['id']= data['id']
|
8
|
+
|
9
|
+
data['field'].each do |field|
|
10
|
+
new_data[field['name']] = field['value']
|
11
|
+
end
|
12
|
+
# TODO - this should not know about the config here!
|
13
|
+
# If filter needs data, it should be passed in!
|
14
|
+
config = Kiseru::Config[:ki_youtrack]
|
15
|
+
subdomain = config.read(:subdomain)
|
16
|
+
ssl = config.read(:ssl)
|
17
|
+
new_data['issue_url'] = Session.url(subdomain, ssl) + '/youtrack/issues/' + data['id']
|
18
|
+
new_data['ki_type'] = 'youtrack_issue'
|
19
|
+
|
20
|
+
new_data
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Kiseru
|
2
|
+
|
3
|
+
class ConfigDir
|
4
|
+
|
5
|
+
DIR_NAME = '.kiseru'
|
6
|
+
|
7
|
+
attr_reader :path
|
8
|
+
|
9
|
+
def initialize(opts = {})
|
10
|
+
root = Pathname.new(File.expand_path(opts.fetch(:root) { '~' }))
|
11
|
+
@path = root + DIR_NAME
|
12
|
+
unless File.directory?(@path)
|
13
|
+
Dir.mkdir(@path)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def config(app_name)
|
18
|
+
Config.new(@path, app_name)
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
class Config
|
24
|
+
|
25
|
+
def self.[](key)
|
26
|
+
ConfigDir.new.config(key)
|
27
|
+
end
|
28
|
+
|
29
|
+
def initialize(root_path, app_name)
|
30
|
+
file_path = (root_path + "#{app_name}.yml").to_s
|
31
|
+
@store = YAML::Store.new(file_path)
|
32
|
+
end
|
33
|
+
|
34
|
+
def write(key, time)
|
35
|
+
@store.transaction do
|
36
|
+
@store[key] = time
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def read(key)
|
41
|
+
@store.transaction(read_only=true) do
|
42
|
+
@store[key]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module KiYoutrack
|
2
|
+
|
3
|
+
class Session
|
4
|
+
|
5
|
+
attr_reader :session_cookies, :api_url
|
6
|
+
|
7
|
+
# TODO - hacky, remove this
|
8
|
+
# TODO - the default for SSL should be in ONE place
|
9
|
+
def self.url(subdomain, ssl)
|
10
|
+
ssl = true if ssl.nil?
|
11
|
+
protocol = ssl ? "https" : "http"
|
12
|
+
"#{protocol}://#{subdomain}.myjetbrains.com"
|
13
|
+
end
|
14
|
+
|
15
|
+
def initialize(username, password, subdomain, opts = {})
|
16
|
+
ssl = opts.fetch(:ssl, true)
|
17
|
+
@username = username
|
18
|
+
@password = password
|
19
|
+
@api_url = Session.url(subdomain, ssl)
|
20
|
+
end
|
21
|
+
|
22
|
+
def init
|
23
|
+
response = connection.post("/youtrack/rest/user/login",
|
24
|
+
:login => @username,
|
25
|
+
:password => @password)
|
26
|
+
@session_cookies = response.headers['set-cookie']
|
27
|
+
response
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_bug(id)
|
31
|
+
connection.get do |req|
|
32
|
+
req.url "/youtrack/rest/issue/#{id}"
|
33
|
+
req.headers['Cookie'] = session_cookies
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def connection
|
40
|
+
@connection ||= Faraday.new(:url => @api_url) do |faraday|
|
41
|
+
faraday.request :url_encoded # form-encode POST params
|
42
|
+
if ENV['DEBUG']=='true'
|
43
|
+
faraday.response :logger # log requests to STDOUT
|
44
|
+
end
|
45
|
+
faraday.response :xml, :content_type => /\bxml$/
|
46
|
+
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
data/lib/ki_youtrack.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require "ki_youtrack/version"
|
2
|
+
require 'faraday'
|
3
|
+
require 'faraday_middleware'
|
4
|
+
require 'multi_xml'
|
5
|
+
require 'multi_json'
|
6
|
+
require 'yaml/store'
|
7
|
+
require 'highline'
|
8
|
+
|
9
|
+
autoload :Kiseru, 'ki_youtrack/kiseru'
|
10
|
+
|
11
|
+
module KiYoutrack
|
12
|
+
|
13
|
+
autoload :Api, 'ki_youtrack/api'
|
14
|
+
autoload :Creds, 'ki_youtrack/creds'
|
15
|
+
autoload :Session, 'ki_youtrack/session'
|
16
|
+
autoload :IssueFilter, 'ki_youtrack/issue_filter'
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
KiYouTrack = KiYoutrack
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include KiYoutrack
|
4
|
+
|
5
|
+
describe KiYoutrack::Api do
|
6
|
+
|
7
|
+
it "gets JSON for issue", :vcr do
|
8
|
+
json = Api.issue("KI-1")
|
9
|
+
data = MultiJson.load(json)
|
10
|
+
data['id'].should == 'KI-1'
|
11
|
+
data['ki_type'].should == 'youtrack_issue'
|
12
|
+
end
|
13
|
+
|
14
|
+
it "pretty prints JSON if requested", :vcr do
|
15
|
+
json = Api.issue("KI-1", :pretty => false)
|
16
|
+
|
17
|
+
pretty_json = MultiJson.dump(MultiJson.load(json), :pretty => true)
|
18
|
+
normal_json = MultiJson.dump(MultiJson.load(json), :pretty => false)
|
19
|
+
|
20
|
+
json.should == normal_json
|
21
|
+
Api.issue("KI-1", :pretty => true).should == pretty_json
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
|
8
|
+
require 'ki_youtrack'
|
9
|
+
require 'vcr'
|
10
|
+
require 'pp'
|
11
|
+
require 'construct'
|
12
|
+
|
13
|
+
include Construct::Helpers
|
14
|
+
include KiYoutrack
|
15
|
+
|
16
|
+
if [0, 'false', false, 'f', 'n', 'no', 'off'].include?(ENV['VCR'])
|
17
|
+
puts "VCR off"
|
18
|
+
else
|
19
|
+
puts "VCR on!"
|
20
|
+
VCR.configure do |c|
|
21
|
+
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
22
|
+
c.hook_into :webmock
|
23
|
+
c.allow_http_connections_when_no_cassette = true
|
24
|
+
c.configure_rspec_metadata!
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
if ENV['COVERAGE']
|
29
|
+
require 'simplecov'
|
30
|
+
SimpleCov.start
|
31
|
+
end
|
32
|
+
|
33
|
+
RSpec.configure do |config|
|
34
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
35
|
+
config.run_all_when_everything_filtered = true
|
36
|
+
config.filter_run :focus
|
37
|
+
|
38
|
+
# Run specs in random order to surface order dependencies. If you find an
|
39
|
+
# order dependency and want to debug it, you can fix the order by providing
|
40
|
+
# the seed, which is printed after each run.
|
41
|
+
# --seed 1234
|
42
|
+
config.order = 'random'
|
43
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe IssueFilter do
|
4
|
+
|
5
|
+
let(:data) do
|
6
|
+
{"field"=>
|
7
|
+
[{"value"=>"Project X", "type"=>"SingleField", "name"=>"projectShortName"},
|
8
|
+
{"value"=>"123", "type"=>"SingleField", "name"=>"numberInProject"},
|
9
|
+
{"value"=>"A SUMMARY",
|
10
|
+
"type"=>"SingleField",
|
11
|
+
"name"=>"summary"},
|
12
|
+
{"value"=>
|
13
|
+
"A DESCRIPTION",
|
14
|
+
"type"=>"SingleField",
|
15
|
+
"name"=>"description"},
|
16
|
+
{"value"=>"1342536743244", "type"=>"SingleField", "name"=>"created"},
|
17
|
+
{"value"=>"1342536761703", "type"=>"SingleField", "name"=>"updated"},
|
18
|
+
{"value"=>"Bob", "type"=>"SingleField", "name"=>"updaterName"},
|
19
|
+
{"value"=>"bob@foobar.com",
|
20
|
+
"type"=>"SingleField",
|
21
|
+
"name"=>"updaterFullName"},
|
22
|
+
{"value"=>"Jane", "type"=>"SingleField", "name"=>"reporterName"},
|
23
|
+
{"value"=>"jane@foobar.com",
|
24
|
+
"type"=>"SingleField",
|
25
|
+
"name"=>"reporterFullName"},
|
26
|
+
{"value"=>"Bug", "type"=>"CustomField", "name"=>"Type"},
|
27
|
+
{"value"=>"99", "type"=>"CustomField", "name"=>"Bug Score"}
|
28
|
+
],
|
29
|
+
"id"=>"FA-123"
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
def deep_clone(obj)
|
34
|
+
Marshal.load(Marshal.dump(obj))
|
35
|
+
end
|
36
|
+
|
37
|
+
it "doesn't modify data" do
|
38
|
+
old_data = deep_clone(data)
|
39
|
+
IssueFilter.filter(data)
|
40
|
+
old_data.should == data
|
41
|
+
end
|
42
|
+
|
43
|
+
it "adds ki_type" do
|
44
|
+
new_data = IssueFilter.filter(data)
|
45
|
+
new_data['ki_type'].should == "youtrack_issue"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "includes id" do
|
49
|
+
new_data = IssueFilter.filter(data)
|
50
|
+
new_data['id'].should == "FA-123"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "includes summary" do
|
54
|
+
new_data = IssueFilter.filter(data)
|
55
|
+
new_data['summary'].should == "A SUMMARY"
|
56
|
+
end
|
57
|
+
|
58
|
+
it "includes description" do
|
59
|
+
new_data = IssueFilter.filter(data)
|
60
|
+
new_data['description'].should == "A DESCRIPTION"
|
61
|
+
end
|
62
|
+
|
63
|
+
it "includes custom field" do
|
64
|
+
new_data = IssueFilter.filter(data)
|
65
|
+
new_data['Type'].should == "Bug"
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Kiseru::ConfigDir do
|
4
|
+
|
5
|
+
context "when directory does not exist" do
|
6
|
+
|
7
|
+
it "should create directory" do
|
8
|
+
within_construct(false) do |c|
|
9
|
+
Kiseru::ConfigDir.new(:root => c)
|
10
|
+
File.directory?(c+'.kiseru').should be_true
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
it "creates ki_pivotal.yml and writes API token" do
|
17
|
+
within_construct(false) do |c|
|
18
|
+
d = c.directory '.kiseru'
|
19
|
+
config_dir = Kiseru::ConfigDir.new(:root => c)
|
20
|
+
config = config_dir.config(:ki_pivotal)
|
21
|
+
|
22
|
+
config.write(:api_token, 'fake_token')
|
23
|
+
|
24
|
+
config.read(:api_token).should == 'fake_token'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
include KiYoutrack
|
3
|
+
|
4
|
+
describe KiYoutrack::Session do
|
5
|
+
before do
|
6
|
+
# These tests will fail until you create a valid config file
|
7
|
+
# by doing 'ki_youtrack setup'
|
8
|
+
config = Kiseru::Config[:ki_youtrack]
|
9
|
+
@username = config.read(:username)
|
10
|
+
@password = config.read(:password)
|
11
|
+
@subdomain = config.read(:subdomain)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "fails if credentials are not valid", :vcr do
|
15
|
+
# Until a dedicated YouTrack is created for this project
|
16
|
+
# a valid subdomain must be supplied otherwise the HTTP
|
17
|
+
# status code will be 404 instead of 403
|
18
|
+
session = Session.new("foo", "bar", @subdomain, :ssl => false)
|
19
|
+
response = session.init
|
20
|
+
response.status.should == 403
|
21
|
+
response.body['error'].should match /Incorrect login or password/
|
22
|
+
end
|
23
|
+
|
24
|
+
it "responds 200 and gets headers if creds are valid", :vcr do
|
25
|
+
session = Session.new(@username, @password, @subdomain, :ssl => false)
|
26
|
+
response = session.init
|
27
|
+
response.status.should == 200
|
28
|
+
response.headers["set-cookie"].should_not be_nil
|
29
|
+
session.session_cookies.should == response.headers["set-cookie"]
|
30
|
+
end
|
31
|
+
|
32
|
+
it "uses authentication cookies to get bug", :vcr do
|
33
|
+
session = Session.new(@username, @password, @subdomain, :ssl => false)
|
34
|
+
session.init
|
35
|
+
response = session.get_bug("KI-1")
|
36
|
+
response.status.should == 200
|
37
|
+
response.body.should_not be_nil
|
38
|
+
issue = response.body['issue']
|
39
|
+
issue['id'].should == "KI-1"
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,205 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ki_youtrack
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ben Brinckerhoff
|
9
|
+
- Aaron Cronin
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-08-14 00:00:00.000000000Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: gli
|
17
|
+
requirement: &70324410656340 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *70324410656340
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: faraday
|
28
|
+
requirement: &70324410655920 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *70324410655920
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: faraday_middleware
|
39
|
+
requirement: &70324410655500 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
type: :runtime
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *70324410655500
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: multi_xml
|
50
|
+
requirement: &70324410655080 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
type: :runtime
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *70324410655080
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: multi_json
|
61
|
+
requirement: &70324410654660 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
type: :runtime
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *70324410654660
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: highline
|
72
|
+
requirement: &70324410654240 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
type: :runtime
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: *70324410654240
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: debugger
|
83
|
+
requirement: &70324410653820 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: *70324410653820
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: rspec
|
94
|
+
requirement: &70324410653400 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
type: :development
|
101
|
+
prerelease: false
|
102
|
+
version_requirements: *70324410653400
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: simplecov
|
105
|
+
requirement: &70324410652980 !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
type: :development
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: *70324410652980
|
114
|
+
- !ruby/object:Gem::Dependency
|
115
|
+
name: test-construct
|
116
|
+
requirement: &70324410652560 !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
118
|
+
requirements:
|
119
|
+
- - ! '>='
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
type: :development
|
123
|
+
prerelease: false
|
124
|
+
version_requirements: *70324410652560
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: vcr
|
127
|
+
requirement: &70324410652140 !ruby/object:Gem::Requirement
|
128
|
+
none: false
|
129
|
+
requirements:
|
130
|
+
- - ! '>='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: *70324410652140
|
136
|
+
- !ruby/object:Gem::Dependency
|
137
|
+
name: webmock
|
138
|
+
requirement: &70324410651720 !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
140
|
+
requirements:
|
141
|
+
- - ! '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
type: :development
|
145
|
+
prerelease: false
|
146
|
+
version_requirements: *70324410651720
|
147
|
+
description: Kiseru YouTrack client
|
148
|
+
email:
|
149
|
+
- ben@freeagent.com
|
150
|
+
- aaron@freeagent.com
|
151
|
+
executables:
|
152
|
+
- ki_youtrack
|
153
|
+
extensions: []
|
154
|
+
extra_rdoc_files: []
|
155
|
+
files:
|
156
|
+
- .gitignore
|
157
|
+
- .rspec
|
158
|
+
- Gemfile
|
159
|
+
- LICENSE
|
160
|
+
- README.md
|
161
|
+
- Rakefile
|
162
|
+
- bin/ki_youtrack
|
163
|
+
- ki_youtrack.gemspec
|
164
|
+
- lib/ki_youtrack.rb
|
165
|
+
- lib/ki_youtrack/api.rb
|
166
|
+
- lib/ki_youtrack/creds.rb
|
167
|
+
- lib/ki_youtrack/issue_filter.rb
|
168
|
+
- lib/ki_youtrack/kiseru.rb
|
169
|
+
- lib/ki_youtrack/session.rb
|
170
|
+
- lib/ki_youtrack/version.rb
|
171
|
+
- spec/integration/get_bug_spec.rb
|
172
|
+
- spec/spec_helper.rb
|
173
|
+
- spec/unit/issue_filter_spec.rb
|
174
|
+
- spec/unit/kiseru_spec.rb
|
175
|
+
- spec/unit/session_spec.rb
|
176
|
+
homepage: ''
|
177
|
+
licenses: []
|
178
|
+
post_install_message:
|
179
|
+
rdoc_options: []
|
180
|
+
require_paths:
|
181
|
+
- lib
|
182
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
183
|
+
none: false
|
184
|
+
requirements:
|
185
|
+
- - ! '>='
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
|
+
none: false
|
190
|
+
requirements:
|
191
|
+
- - ! '>='
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
requirements: []
|
195
|
+
rubyforge_project:
|
196
|
+
rubygems_version: 1.8.10
|
197
|
+
signing_key:
|
198
|
+
specification_version: 3
|
199
|
+
summary: Kiseru YouTrack client
|
200
|
+
test_files:
|
201
|
+
- spec/integration/get_bug_spec.rb
|
202
|
+
- spec/spec_helper.rb
|
203
|
+
- spec/unit/issue_filter_spec.rb
|
204
|
+
- spec/unit/kiseru_spec.rb
|
205
|
+
- spec/unit/session_spec.rb
|