scrumship-client 1.0.4 → 1.0.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2dcda2f7cec36bc799f4466617aa072385174ae4f885edf95e9a50a02530632a
4
- data.tar.gz: c6c9a4ce3fbec5327135bbe35b0aa97f26f973530be11f42c78de4268158b6c6
3
+ metadata.gz: 593c0086c8c866117eb2db3586b29e5b215954a116ca9088dcf7a259eda147bd
4
+ data.tar.gz: 3c15452b285504bac9af84acf4f87bb5cf59ac26ff67622e1cf18dc2088518bb
5
5
  SHA512:
6
- metadata.gz: d6dcad5f039427aadde4e2bfd66f1c87157b5f2e11ae7c24f62e65b095846c87d2c5863f0700dd1063f3c2f74ada78cf0ab2a07d95e881a91c52bd1d00b256c3
7
- data.tar.gz: 8b87b2008ca0ef4512d329979ed56f82c162846d16415ab72a2fa216f536f6a24e0765afa79e34529c4996f273a174a8e5ca1d732d2e5dbca7d20489dc2dd7f0
6
+ metadata.gz: 30a4b9f9582687f67b5ceafbe4e0d9fd61ad5531c9bb47f5ae629f415feca9f7f05d49150d4d7ce39e0ec23e9a012ea6c804ad4b7326fbcf0633a9d64f21b933
7
+ data.tar.gz: 9641df33c38a520b5ee3de31359089d6798261657d6fa2d52210a95f5f215869bd153231ca5213f317dfd97cb1e67b225ba7978dd100d2695a0f797711cf3dc0
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ /Gemfile.lock
13
+ /scrumship.json
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in scrumship-client.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "scrumship/client"
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,5 @@
1
+ module Scrumship
2
+ module Client
3
+ VERSION = "1.0.13"
4
+ end
5
+ end
@@ -1,6 +1,8 @@
1
+ require "scrumship/client/version"
1
2
  require 'net/http'
3
+ require 'json'
2
4
 
3
- module ScrumshipClient
5
+ module Scrumship
4
6
  class Configuration
5
7
  attr_accessor :config_file
6
8
  attr_accessor :activity_log_url
@@ -13,11 +15,7 @@ module ScrumshipClient
13
15
  end
14
16
  end
15
17
 
16
- class Client
17
-
18
- def self.configuration
19
- @configuration ||= Configuration.new
20
- end
18
+ module Client
21
19
 
22
20
  def self.configure
23
21
  yield(configuration)
@@ -37,24 +35,21 @@ module ScrumshipClient
37
35
  end
38
36
  end
39
37
 
40
- def self.setup
38
+ def self.setup(configuration = Configuration.new)
41
39
  begin
42
- unless File.file?(configuration.config_file)
43
- username = `git config user.name`
44
- username = username.gsub('\n', '').strip!
45
- url = "#{configuration.activity_log_url}/e/#{configuration.project_token}"
46
- http = client(url)
47
- uri = URI.parse(url)
48
- req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')
49
- req.body = {username: username}.to_json
50
- res = http.request(req)
51
- if res.length > 128
52
- return
53
- end
54
- encoded = CGI.escape(res.body)
55
- config = {u: encoded, url: configuration.activity_log_url, pt: configuration.project_token}
40
+ username = `git config user.name`
41
+ username = username.gsub('\n', '').strip!
42
+ url = "#{configuration.activity_log_url}/e/#{configuration.project_token}"
43
+ http = client(url)
44
+ uri = URI.parse(url)
45
+ req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')
46
+ req.body = { username: username }.to_json
47
+ res = http.request(req)
48
+
49
+ json_res = JSON.parse(res.body)
50
+ if json_res["status"] == 200
51
+ config = { u: json_res["token"], url: configuration.activity_log_url, pt: configuration.project_token }
56
52
  File.open(configuration.config_file, 'w') { |file| file.write(config.to_json) }
57
- res.body
58
53
  end
59
54
  rescue
60
55
  # Ignored
@@ -0,0 +1,10 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'scrumship-client'
3
+ s.version = '1.0.13'
4
+ s.date = '2021-12-04'
5
+ s.files = Dir.chdir(File.expand_path('..', __FILE__)) do
6
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
7
+ end
8
+ s.summary = "Scrumship Client"
9
+ s.authors = ["Greg Dymek"]
10
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrumship-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Dymek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-13 00:00:00.000000000 Z
11
+ date: 2021-12-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -16,7 +16,15 @@ executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
- - lib/scrumship-client.rb
19
+ - ".gitignore"
20
+ - ".rspec"
21
+ - Gemfile
22
+ - Rakefile
23
+ - bin/console
24
+ - bin/setup
25
+ - lib/scrumship/client.rb
26
+ - lib/scrumship/client/version.rb
27
+ - scrumship-client.gemspec
20
28
  homepage:
21
29
  licenses: []
22
30
  metadata: {}
@@ -35,8 +43,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
35
43
  - !ruby/object:Gem::Version
36
44
  version: '0'
37
45
  requirements: []
38
- rubygems_version: 3.0.8
46
+ rubygems_version: 3.1.2
39
47
  signing_key:
40
48
  specification_version: 4
41
- summary: Scrumship client
49
+ summary: Scrumship Client
42
50
  test_files: []