linear-cli 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 459cfc694409e9f569943bcb817c349f227804c8fe065d9be1477a40adff7c33
4
- data.tar.gz: 30013d6fd8b64af8ec527ea855561d1dbecd0afc43179df6a264a391ab67fb11
3
+ metadata.gz: 64ec47de5a41cf7cf1a5c26da7edc9d6d45d430107e7da3d8a66a0c39742b93b
4
+ data.tar.gz: 3695694ebac882ec28b111ba83eed877d89838574f23ec7489472182d6c7c212
5
5
  SHA512:
6
- metadata.gz: c0432a0d1df1a9f3cc2265438ac7ed37b8d335c9bec47bae11c303c51d9ba5f2e9c225d86d314a1b7a42621e62a4e2f2c0443e6d8606c6725db11b404a2d730a
7
- data.tar.gz: b164919a840f1618cc19172ff0014b7b5d05c8e560a9f2fd133db95474ac95638512d35b4288fe142b08e0cc22b45be5485c8c81640ace9b86db467583bad05d
6
+ metadata.gz: a10b11f20a7392ed4a349d5a629e0d3ab8ced165266cdfb2ba3c07a2fcfaa0132412b221af012bc5012512f06bd16b6ce88888f20c1b2047430e66cdca014577
7
+ data.tar.gz: 691e23ac88eaeb5bbd44d18a98f0b233d3f2d813c4b955a30aba6a5862c49e724fd63b70acf793599c90be18ed1ca57689a69e71c1a988abd2b1fedbd8da31e4
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.9.5] - 2024-02-08
6
+ ### Added
7
+ - Added build_image to build/push container image (@bougyman)
8
+ - Added user information to comment list in issue view (@bougyman)
9
+
5
10
  ## [0.9.4] - 2024-02-07
6
11
  ### Fixed
7
12
  - Fixed issue with canceled issues showing up in lcls (@bougyman)
@@ -83,8 +88,9 @@
83
88
  ### Added
84
89
  - Added new changelog management system (changelog-rb) (@bougyman)
85
90
 
86
- [Unreleased]: https://github.com/rubyists/linear-cli/compare/0.9.4...HEAD
87
- [0.9.4]: https://github.com/rubyists/linear-cli/compare/v0.9.3...0.9.4
91
+ [Unreleased]: https://github.com/rubyists/linear-cli/compare/0.9.5...HEAD
92
+ [0.9.5]: https://github.com/rubyists/linear-cli/compare/v0.9.4...0.9.5
93
+ [0.9.4]: https://github.com/rubyists/linear-cli/compare/v0.9.3...v0.9.4
88
94
  [0.9.3]: https://github.com/rubyists/linear-cli/compare/v0.9.1...v0.9.3
89
95
  [0.9.1]: https://github.com/rubyists/linear-cli/compare/v0.9.0...v0.9.1
90
96
  [0.9.0]: https://github.com/rubyists/linear-cli/compare/v0.8.6...v0.9.0
@@ -0,0 +1,4 @@
1
+ type: Added
2
+ title: >
3
+ Added build_image to build/push container image
4
+ author: bougyman
@@ -0,0 +1,4 @@
1
+ type: Added
2
+ title: >
3
+ Added user information to comment list in issue view
4
+ author: bougyman
@@ -0,0 +1 @@
1
+ date: 2024-02-08
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rubyists
4
4
  module Linear
5
- VERSION = '0.9.4'
5
+ VERSION = '0.9.5'
6
6
  end
7
7
  end
@@ -5,16 +5,18 @@ require 'gqli'
5
5
  module Rubyists
6
6
  # Namespace for Linear
7
7
  module Linear
8
- M :base_model
8
+ M :base_model, :user
9
9
  Comment = Class.new(BaseModel)
10
10
  # The Comment class represents a Linear issue comment.
11
11
  class Comment
12
12
  include SemanticLogger::Loggable
13
+ many_to_one :user
13
14
 
14
15
  Base = fragment('BaseComment', 'Comment') do
15
16
  id
16
17
  body
17
18
  url
19
+ user { ___ User.base_fragment }
18
20
  createdAt
19
21
  updatedAt
20
22
  end
@@ -9,7 +9,7 @@ module Rubyists
9
9
  Issue = Class.new(BaseModel)
10
10
  M 'issue/class_methods'
11
11
  # The Issue class represents a Linear issue.
12
- class Issue
12
+ class Issue # rubocop:disable Metrics/ClassLength
13
13
  include SemanticLogger::Loggable
14
14
  extend ClassMethods
15
15
  many_to_one :assignee, :User
@@ -119,7 +119,14 @@ module Rubyists
119
119
  end
120
120
 
121
121
  def display_comments
122
- comments.map { |c| "--- #{c.createdAt} ---\n#{TTY::Markdown.parse(c.body)}" }.join("\n")
122
+ return '' unless comments.respond_to?(:map)
123
+
124
+ displays = comments&.map do |c|
125
+ user = c.user.name
126
+ date = DateTime.parse(c.createdAt).strftime('%Y-%m-%d at %H:%M')
127
+ "--- #{user} on #{date} ---\n#{TTY::Markdown.parse(c.body)}"
128
+ end
129
+ displays&.join("\n")
123
130
  end
124
131
 
125
132
  def full
@@ -48,7 +48,9 @@ module Rubyists
48
48
  query do
49
49
  user(id:) do
50
50
  assignedIssues(first:, filter: { completedAt: { null: true } }) do
51
- nodes { ___ Issue.base_fragment }
51
+ nodes do
52
+ ___ Issue.base_fragment
53
+ end
52
54
  end
53
55
  end
54
56
  end
data/oci/Containerfile CHANGED
@@ -3,6 +3,7 @@ FROM docker.io/ruby:3.3.0-alpine3.19 AS build-env
3
3
 
4
4
  # Setting env up
5
5
  ARG APP_ROOT=/app
6
+ ARG APP_VERSION
6
7
  ENV LANG C.UTF-8
7
8
  ENV BUNDLE_SILENCE_ROOT_WARNING=1
8
9
 
@@ -14,19 +15,15 @@ WORKDIR $APP_ROOT
14
15
  COPY . $APP_ROOT
15
16
  RUN gem i semantic_logger && bundle install && bundle exec rake build
16
17
 
17
- CMD %w[bundle exec lc]
18
-
19
- # Remove folders not needed in resulting image
20
- RUN rm -rf node_modules tmp/cache app/assets vendor/assets spec
21
-
22
18
  ############### Build step done ###############
23
19
  FROM docker.io/ruby:3.3.0-alpine3.19
24
20
  ARG PACKAGES="bash sqlite sqlite-dev ruby-dev build-base github-cli"
21
+ ARG APP_VERSION
25
22
 
26
23
  # install packages
27
24
  RUN apk --update --no-cache add $PACKAGES
28
25
  COPY --from=build-env /app/pkg /tmp
29
- RUN ls /tmp/*.gem && gem install /tmp/*.gem
26
+ RUN gem install /tmp/linear-cli-${APP_VERSION}.gem
30
27
 
31
28
  CMD ["bundle", "exec", "lc"]
32
29
 
data/oci/build_image ADDED
@@ -0,0 +1,137 @@
1
+ #!/usr/bin/env bash
2
+
3
+ : "${IMAGE_NAME:=$(basename "$(pwd)")}"
4
+ : "${BUILD_CONTEXT:=$(pwd)}"
5
+
6
+ usage() { # {{{
7
+ cat <<-EOT
8
+ Usage: $0 <options> <image_tag>
9
+ Options:
10
+ -i NAME Name of the image (default: $IMAGE_NAME)
11
+ -c CONTAINERFILE Path to the containerfile (default: ./oci/Containerfile)
12
+ -C CONTEXT Build context (default: $BUILD_CONTEXT)
13
+ -p Push the image to the registry
14
+ -s Also mark the image as stable
15
+ -h Show help / usage
16
+ EOT
17
+ } # }}}
18
+
19
+ die() { # {{{
20
+ local -i code
21
+ code=$1
22
+ shift
23
+ printf "Error! => %s\n" "$*" >&2
24
+ printf "\n" >&2
25
+ usage >&2
26
+ # shellcheck disable=SC2086
27
+ exit $code
28
+ } # }}}
29
+
30
+ push=0
31
+ stable=0
32
+ while getopts :hpi:c:C:s opt # {{{
33
+ do
34
+ case $opt in
35
+ c)
36
+ CONTAINERFILE=$OPTARG
37
+ ;;
38
+ C)
39
+ BUILD_CONTEXT=$OPTARG
40
+ ;;
41
+ i)
42
+ IMAGE_NAME=$OPTARG
43
+ ;;
44
+ p)
45
+ push=1
46
+ ;;
47
+ s)
48
+ stable=1
49
+ ;;
50
+ h)
51
+ usage
52
+ exit
53
+ ;;
54
+ :)
55
+ printf "Option %s requires an argument\n" "$OPTARG" >&2
56
+ usage >&2
57
+ exit 28
58
+ ;;
59
+ ?)
60
+ printf "Invalid option '%s'\n" "$OPTARG" >&2
61
+ usage >&2
62
+ exit 27
63
+ ;;
64
+ esac
65
+ done # }}}
66
+ shift $((OPTIND-1))
67
+
68
+ tag=$1
69
+ [ -z "$tag" ] && die 1 "Missing image tag"
70
+ shift
71
+
72
+ [ $# -gt 0 ] && die 2 "Too many arguments"
73
+
74
+ if [ -z "$CONTAINERFILE" ]; then
75
+ printf "No containerfile specified, looking for default locations\n"
76
+ for containerfile in Containerfile Dockerfile
77
+ do
78
+ if [ -f ./oci/"$containerfile" ]; then
79
+ printf "Found ./oci/%s\n" "$containerfile" >&2
80
+ containerfile=./oci/"$containerfile"
81
+ break
82
+ fi
83
+ if [ -f "$containerfile" ]; then
84
+ printf "Found %s\n" "$containerfile" >&2
85
+ break
86
+ fi
87
+ done
88
+ else
89
+ [ -f "$CONTAINERFILE" ] || die 3 "Containerfile '$CONTAINERFILE' not found"
90
+ printf "Using containerfile %s\n" "$CONTAINERFILE" >&2
91
+ containerfile=$CONTAINERFILE
92
+ fi
93
+
94
+ [ -f "$containerfile" ] || die 4 "No containerfile found"
95
+
96
+ [ -d "$BUILD_CONTEXT" ] || die 5 "Build context '$BUILD_CONTEXT' not found"
97
+
98
+ # Build the image
99
+ if command -v podman 2>/dev/null
100
+ then
101
+ runtime=podman
102
+ elif command -v docker 2>/dev/null
103
+ then
104
+ runtime=docker
105
+ else
106
+ die 6 "No container runtime found"
107
+ fi
108
+
109
+ $runtime build --build-arg "APP_VERSION=${tag}" -t "$IMAGE_NAME:$tag" -f "$containerfile" "$BUILD_CONTEXT" || die 7 "Failed to build image"
110
+
111
+ set -x
112
+ [ $push -eq 1 ] || exit 0
113
+ # push the image
114
+ registry_image_name="ghcr.io/rubyists/$IMAGE_NAME:$tag"
115
+ if ! $runtime login --get-login ghcr.io
116
+ then
117
+ printf "Not logged in to ghcr.io, trying to login\n" >&2
118
+ [ -z "$GITHUB_TOKEN" ] && die 8 "No GITHUB_TOKEN set, cannot login"
119
+ printf "%s" "$GITHUB_TOKEN" | $runtime login -u "$GITHUB_TOKEN" --password-stdin ghcr.io || die 9 "Failed to login to ghcr.io"
120
+ fi
121
+
122
+ if [ "$runtime" = "podman" ]
123
+ then
124
+ podman push "$IMAGE_NAME:$tag" "$registry_image_name" || die 10 "Failed to push image"
125
+ else
126
+ docker push "$registry_image_name" || die 11 "Failed to push image"
127
+ fi
128
+
129
+ [ "$stable" -eq 0 ] && exit 0
130
+ # Mark the image as stable
131
+ registry_stable_name="ghcr.io/rubyists/$IMAGE_NAME:stable"
132
+ if [ "$runtime" = "podman" ]
133
+ then
134
+ podman push "$IMAGE_NAME:$tag" "$registry_stable_name" || die 10 "Failed to push image"
135
+ else
136
+ docker push "$registry_stable_name" || die 11 "Failed to push image"
137
+ fi
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linear-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tj (bougyman) Vanderpoel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-07 00:00:00.000000000 Z
11
+ date: 2024-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -250,6 +250,9 @@ files:
250
250
  - changelog/0.9.3/tag.yml
251
251
  - changelog/0.9.4/fixed_issue_with_canceled_issues_showing_up_in_lcls.yml
252
252
  - changelog/0.9.4/tag.yml
253
+ - changelog/0.9.5/added_build_image_to_build_push_container_image.yml
254
+ - changelog/0.9.5/added_user_information_to_comment_list_in_issue_view.yml
255
+ - changelog/0.9.5/tag.yml
253
256
  - changelog/unreleased/.gitkeep
254
257
  - cinemas/listings.cinema
255
258
  - cinemas/listings.cinema.gif
@@ -300,6 +303,7 @@ files:
300
303
  - lib/linear/version.rb
301
304
  - linear-cli.gemspec
302
305
  - oci/Containerfile
306
+ - oci/build_image
303
307
  homepage: https://github.com/rubyists/linear-cli
304
308
  licenses:
305
309
  - MIT