sleet 0.3.3 → 0.3.4
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 +4 -4
- data/.rubocop_todo.yml +30 -1
- data/CHANGELOG.md +9 -1
- data/README.md +5 -1
- data/lib/sleet/circle_ci.rb +8 -2
- data/lib/sleet/circle_ci_branch.rb +1 -1
- data/lib/sleet/circle_ci_build.rb +1 -1
- data/lib/sleet/cli.rb +37 -1
- data/lib/sleet/fetcher.rb +7 -33
- data/lib/sleet/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80cad44120cf0a7c36a746f8bf76bd4164b349b2f7da0263dce63fc945ce2f20
|
4
|
+
data.tar.gz: 3e1f4ace18363872b5d630d70950166088bd29a469ad7428feef18db378fd33a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc9d1b16768e0faab3667a46ce3b43afc9c53e4568110cba635ff7b71a4d260c2feaafaeca6d2a3e6dc88de6df2fa83e46ae6fa56d7c9d15928d5c43bda25cb5
|
7
|
+
data.tar.gz: '0194667dc3eaf4902e2f32d2c1c073596b31e85c03550e2cece9926e26482ca41c7fdd7edb20e08c0b390c01ea751d7663707a9bfe29963a4d9cd1d13e346174'
|
data/.rubocop_todo.yml
CHANGED
@@ -1,12 +1,41 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2018-01-
|
3
|
+
# on 2018-01-16 22:17:20 -0500 using RuboCop version 0.52.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
9
|
# Offense count: 1
|
10
|
+
# Cop supports --auto-correct.
|
11
|
+
# Configuration parameters: AllowAdjacentOneLineDefs, NumberOfEmptyLines.
|
12
|
+
Layout/EmptyLineBetweenDefs:
|
13
|
+
Exclude:
|
14
|
+
- 'lib/sleet/fetcher.rb'
|
15
|
+
|
16
|
+
# Offense count: 1
|
17
|
+
# Cop supports --auto-correct.
|
18
|
+
Layout/EmptyLines:
|
19
|
+
Exclude:
|
20
|
+
- 'lib/sleet/fetcher.rb'
|
21
|
+
|
22
|
+
# Offense count: 1
|
23
|
+
# Configuration parameters: CountComments.
|
24
|
+
Metrics/ClassLength:
|
25
|
+
Max: 107
|
26
|
+
|
27
|
+
# Offense count: 1
|
28
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
29
|
+
# URISchemes: http, https
|
30
|
+
Metrics/LineLength:
|
31
|
+
Max: 128
|
32
|
+
|
33
|
+
# Offense count: 2
|
10
34
|
# Configuration parameters: CountComments.
|
11
35
|
Metrics/MethodLength:
|
12
36
|
Max: 15
|
37
|
+
|
38
|
+
# Offense count: 1
|
39
|
+
# Configuration parameters: CountKeywordArgs.
|
40
|
+
Metrics/ParameterLists:
|
41
|
+
Max: 7
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [v0.3.
|
3
|
+
## [v0.3.4](https://github.com/coreyja/sleet/tree/v0.3.4) (2018-01-16)
|
4
|
+
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.3.3...v0.3.4)
|
5
|
+
|
6
|
+
**Merged pull requests:**
|
7
|
+
|
8
|
+
- Only Fetch Branch Once [\#12](https://github.com/coreyja/sleet/pull/12) ([coreyja](https://github.com/coreyja))
|
9
|
+
- Fix Auth [\#11](https://github.com/coreyja/sleet/pull/11) ([coreyja](https://github.com/coreyja))
|
10
|
+
|
11
|
+
## [v0.3.3](https://github.com/coreyja/sleet/tree/v0.3.3) (2018-01-16)
|
4
12
|
[Full Changelog](https://github.com/coreyja/sleet/compare/v0.3.2...v0.3.3)
|
5
13
|
|
6
14
|
**Merged pull requests:**
|
data/README.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
# Sleet
|
1
|
+
# Sleet ☁️ ❄️
|
2
|
+
|
3
|
+
[](https://badge.fury.io/rb/sleet)
|
4
|
+
[](https://codeclimate.com/github/coreyja/sleet/maintainability)
|
5
|
+
[](https://circleci.com/gh/coreyja/sleet)
|
2
6
|
|
3
7
|
## Background and Problem
|
4
8
|
|
data/lib/sleet/circle_ci.rb
CHANGED
@@ -10,12 +10,18 @@ module Sleet
|
|
10
10
|
@_token ||= File.read("#{Dir.home}/.circleci.token").strip
|
11
11
|
end
|
12
12
|
|
13
|
-
def get(
|
14
|
-
|
13
|
+
def get(*args, &block)
|
14
|
+
connection.get(*args, &block)
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.get(url)
|
18
18
|
instance.get(url)
|
19
19
|
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def connection
|
24
|
+
@_connection ||= Faraday.new.tap { |c| c.basic_auth(token, '') }
|
25
|
+
end
|
20
26
|
end
|
21
27
|
end
|
@@ -19,7 +19,7 @@ module Sleet
|
|
19
19
|
attr_reader :github_user, :github_repo
|
20
20
|
|
21
21
|
def url
|
22
|
-
"https://circleci.com/api/v1.1/project/github/#{github_user}/#{github_repo}/#{build_num}/artifacts
|
22
|
+
"https://circleci.com/api/v1.1/project/github/#{github_user}/#{github_repo}/#{build_num}/artifacts" # rubocop:disable Metrics/LineLength
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
data/lib/sleet/cli.rb
CHANGED
@@ -24,11 +24,17 @@ module Sleet
|
|
24
24
|
To use Sleet with CircleCI Workflows you need to tell Sleet which build(s) to look in, and where each output should be saved. The input is a hash, where the key is the build name and the value is the output_file for that build. Sleet supports saving the artifacts to multiple builds, meaning it can support a mono-repo setup.
|
25
25
|
DESC
|
26
26
|
def fetch
|
27
|
+
must_be_on_branch!
|
28
|
+
must_have_an_upstream_branch!
|
29
|
+
upstream_remote_must_be_github!
|
27
30
|
if options[:workflows]
|
28
31
|
workflow_fetch
|
29
32
|
else
|
30
33
|
single_fetch
|
31
34
|
end
|
35
|
+
rescue Sleet::Error => e
|
36
|
+
error(e.message)
|
37
|
+
exit 1
|
32
38
|
end
|
33
39
|
|
34
40
|
desc 'version', 'Display the version'
|
@@ -67,10 +73,40 @@ module Sleet
|
|
67
73
|
exit 1 if failed
|
68
74
|
end
|
69
75
|
|
76
|
+
def circle_ci_branch
|
77
|
+
@_circle_ci_branch ||= Sleet::CircleCiBranch.new(
|
78
|
+
github_user: repo.github_user,
|
79
|
+
github_repo: repo.github_repo,
|
80
|
+
branch: repo.remote_branch
|
81
|
+
)
|
82
|
+
end
|
83
|
+
|
84
|
+
def must_be_on_branch!
|
85
|
+
repo.on_branch? ||
|
86
|
+
error('Not on a branch')
|
87
|
+
end
|
88
|
+
|
89
|
+
def must_have_an_upstream_branch!
|
90
|
+
repo.remote? ||
|
91
|
+
error("No upstream branch set for the current branch of #{repo.current_branch_name}")
|
92
|
+
end
|
93
|
+
|
94
|
+
def upstream_remote_must_be_github!
|
95
|
+
repo.github? ||
|
96
|
+
error('Upstream remote is not GitHub')
|
97
|
+
end
|
98
|
+
|
99
|
+
def repo
|
100
|
+
@_repo ||= Sleet::Repo.from_dir(options.fetch(:source_dir, default_dir))
|
101
|
+
end
|
102
|
+
|
70
103
|
def base_fetcher_params
|
71
104
|
{
|
72
105
|
source_dir: options.fetch(:source_dir, default_dir),
|
73
|
-
|
106
|
+
circle_ci_branch: circle_ci_branch,
|
107
|
+
input_filename: options.fetch(:input_file, '.rspec_example_statuses'),
|
108
|
+
github_user: repo.github_user,
|
109
|
+
github_repo: repo.github_repo
|
74
110
|
}
|
75
111
|
end
|
76
112
|
|
data/lib/sleet/fetcher.rb
CHANGED
@@ -4,11 +4,14 @@ module Sleet
|
|
4
4
|
class Fetcher
|
5
5
|
class Error < ::Sleet::Error; end
|
6
6
|
|
7
|
-
def initialize(source_dir:, input_filename:, output_filename:, job_name: nil)
|
7
|
+
def initialize(source_dir:, circle_ci_branch:, input_filename:, output_filename:, github_user:, github_repo:, job_name: nil) # rubocop:disable Metrics/LineLength
|
8
8
|
@source_dir = source_dir
|
9
|
+
@circle_ci_branch = circle_ci_branch
|
9
10
|
@input_filename = input_filename
|
10
11
|
@output_filename = output_filename
|
11
12
|
@job_name = job_name
|
13
|
+
@github_user = github_user
|
14
|
+
@github_repo = github_repo
|
12
15
|
end
|
13
16
|
|
14
17
|
def do!
|
@@ -17,9 +20,6 @@ module Sleet
|
|
17
20
|
end
|
18
21
|
|
19
22
|
def validate!
|
20
|
-
must_be_on_branch!
|
21
|
-
must_have_an_upstream_branch!
|
22
|
-
upstream_remote_must_be_github!
|
23
23
|
must_find_a_build_with_artifacts!
|
24
24
|
chosen_build_must_have_input_file!
|
25
25
|
true
|
@@ -34,7 +34,7 @@ module Sleet
|
|
34
34
|
|
35
35
|
private
|
36
36
|
|
37
|
-
attr_reader :
|
37
|
+
attr_reader :input_filename, :output_filename, :job_name, :circle_ci_branch, :github_user, :github_repo, :source_dir
|
38
38
|
|
39
39
|
def error(msg)
|
40
40
|
raise Error, msg
|
@@ -53,16 +53,12 @@ module Sleet
|
|
53
53
|
|
54
54
|
def circle_ci_build
|
55
55
|
@_circle_ci_build ||= Sleet::CircleCiBuild.new(
|
56
|
-
github_user:
|
57
|
-
github_repo:
|
56
|
+
github_user: github_user,
|
57
|
+
github_repo: github_repo,
|
58
58
|
build_num: chosen_build_json['build_num']
|
59
59
|
)
|
60
60
|
end
|
61
61
|
|
62
|
-
def repo
|
63
|
-
@_repo ||= Sleet::Repo.from_dir(source_dir)
|
64
|
-
end
|
65
|
-
|
66
62
|
def chosen_build_json
|
67
63
|
if job_name
|
68
64
|
circle_ci_branch.builds_with_artificats.find { |b| b.fetch('workflows', {})&.fetch('job_name', {}) == job_name }
|
@@ -71,28 +67,6 @@ module Sleet
|
|
71
67
|
end
|
72
68
|
end
|
73
69
|
|
74
|
-
def circle_ci_branch
|
75
|
-
@_circle_ci_branch ||= Sleet::CircleCiBranch.new(
|
76
|
-
github_user: repo.github_user,
|
77
|
-
github_repo: repo.github_repo,
|
78
|
-
branch: repo.remote_branch
|
79
|
-
)
|
80
|
-
end
|
81
|
-
|
82
|
-
def must_be_on_branch!
|
83
|
-
repo.on_branch? ||
|
84
|
-
error('Not on a branch')
|
85
|
-
end
|
86
|
-
|
87
|
-
def must_have_an_upstream_branch!
|
88
|
-
repo.remote? ||
|
89
|
-
error("No upstream branch set for the current branch of #{repo.current_branch_name}")
|
90
|
-
end
|
91
|
-
|
92
|
-
def upstream_remote_must_be_github!
|
93
|
-
repo.github? ||
|
94
|
-
error('Upstream remote is not GitHub')
|
95
|
-
end
|
96
70
|
|
97
71
|
def must_find_a_build_with_artifacts!
|
98
72
|
!chosen_build_json.nil? ||
|
data/lib/sleet/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sleet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Corey Alexander
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|