bugsink-cli 0.1.0 → 0.1.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 +4 -4
- data/README.md +17 -8
- data/lib/bugsink/cli.rb +4 -3
- data/lib/bugsink/config.rb +23 -1
- data/lib/bugsink/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 877f72a744295aab29d7782564f80dc3cc849c8edc9be48f906d4a0b649d4b50
|
|
4
|
+
data.tar.gz: 564602e02fb9a9452908ae2de23ac47e731050c84dd30b0b55996e24114b49e6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fcdaa759b4b22db34d4914522502b7e6fa7815ebd0e75746a604f8bffc1f4e2c8c467ec6b17399ac212dea93aed24a1c65dab9364040eacc69878bd3c73d254e
|
|
7
|
+
data.tar.gz: 12adad1cc8c2f9ab03548f5257ebc63b46f7adb7378336ef95571d46df1f184edf77a5e1ce860726f3dd82239efddfc4f842c1a6b6331c8cb072e2133db4ec57
|
data/README.md
CHANGED
|
@@ -25,18 +25,24 @@ gem 'bugsink-cli', '~> 0.1.0'
|
|
|
25
25
|
|
|
26
26
|
**Optional:**
|
|
27
27
|
- `BUGSINK_HOST` - API host (default: `https://bugs.kopernici.cz`)
|
|
28
|
+
- `BUGSINK_PROJECT_ID` - Default project ID (takes precedence over `.bugsink` file)
|
|
28
29
|
|
|
29
30
|
### Project Configuration
|
|
30
31
|
|
|
31
|
-
The CLI supports
|
|
32
|
+
The CLI supports two ways to set a default project ID:
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
1. **Environment Variable (recommended for CI/CD):**
|
|
35
|
+
```bash
|
|
36
|
+
export BUGSINK_PROJECT_ID=8
|
|
37
|
+
```
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
2. **Local `.bugsink` file (recommended for development):**
|
|
40
|
+
```bash
|
|
41
|
+
bugsink config set-project 8
|
|
42
|
+
# This creates .bugsink file with: PROJECT_ID=8
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Note:** The environment variable takes precedence over the `.bugsink` file. When `BUGSINK_PROJECT_ID` is set, the `config set-project` command will not create a `.bugsink` file.
|
|
40
46
|
|
|
41
47
|
## Quick Start
|
|
42
48
|
|
|
@@ -47,7 +53,10 @@ export BUGSINK_API_KEY="your-token-here"
|
|
|
47
53
|
# Test connection
|
|
48
54
|
bugsink config test
|
|
49
55
|
|
|
50
|
-
# Set default project
|
|
56
|
+
# Set default project (option 1: environment variable)
|
|
57
|
+
export BUGSINK_PROJECT_ID=8
|
|
58
|
+
|
|
59
|
+
# Or set default project (option 2: local file)
|
|
51
60
|
bugsink config set-project 8
|
|
52
61
|
|
|
53
62
|
# List latest issues
|
data/lib/bugsink/cli.rb
CHANGED
|
@@ -396,11 +396,12 @@ module Bugsink
|
|
|
396
396
|
bugsink releases create '{"project":8,"version":"v1.0"}'
|
|
397
397
|
|
|
398
398
|
Environment Variables:
|
|
399
|
-
BUGSINK_API_KEY
|
|
400
|
-
BUGSINK_HOST
|
|
399
|
+
BUGSINK_API_KEY API authentication token (required)
|
|
400
|
+
BUGSINK_HOST API host (default: https://bugs.kopernici.cz)
|
|
401
|
+
BUGSINK_PROJECT_ID Default project ID (takes precedence over .bugsink file)
|
|
401
402
|
|
|
402
403
|
Configuration File:
|
|
403
|
-
.bugsink Project ID for current directory
|
|
404
|
+
.bugsink Project ID for current directory (ignored if BUGSINK_PROJECT_ID is set)
|
|
404
405
|
|
|
405
406
|
For resource-specific help:
|
|
406
407
|
bugsink help <resource>
|
data/lib/bugsink/config.rb
CHANGED
|
@@ -28,6 +28,13 @@ module Bugsink
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def set_project_id(id)
|
|
31
|
+
if ENV['BUGSINK_PROJECT_ID'] && !ENV['BUGSINK_PROJECT_ID'].empty?
|
|
32
|
+
# Don't write to file if env var is set (env var takes precedence)
|
|
33
|
+
# Just update the in-memory value
|
|
34
|
+
@project_id = id
|
|
35
|
+
return
|
|
36
|
+
end
|
|
37
|
+
|
|
31
38
|
File.write(dotfile_path, "PROJECT_ID=#{id}\n")
|
|
32
39
|
@project_id = id
|
|
33
40
|
end
|
|
@@ -37,17 +44,32 @@ module Bugsink
|
|
|
37
44
|
end
|
|
38
45
|
|
|
39
46
|
def to_s
|
|
47
|
+
project_display = if project_id
|
|
48
|
+
source = ENV['BUGSINK_PROJECT_ID'] && !ENV['BUGSINK_PROJECT_ID'].empty? ? 'env' : 'file'
|
|
49
|
+
"#{project_id} (from #{source})"
|
|
50
|
+
else
|
|
51
|
+
'not set'
|
|
52
|
+
end
|
|
53
|
+
|
|
40
54
|
<<~CONFIG
|
|
41
55
|
BugSink Configuration:
|
|
42
56
|
Host: #{host}
|
|
43
57
|
API Key: #{api_key ? "#{api_key[0..8]}...#{api_key[-8..]}" : 'not set'}
|
|
44
|
-
Project ID: #{
|
|
58
|
+
Project ID: #{project_display}
|
|
45
59
|
CONFIG
|
|
46
60
|
end
|
|
47
61
|
|
|
48
62
|
private
|
|
49
63
|
|
|
50
64
|
def read_project_id
|
|
65
|
+
# Check environment variable first (takes precedence)
|
|
66
|
+
env_project_id = ENV['BUGSINK_PROJECT_ID']
|
|
67
|
+
if env_project_id && !env_project_id.empty?
|
|
68
|
+
parsed = env_project_id.to_i
|
|
69
|
+
return parsed if parsed > 0 # Ensure it's a valid positive integer
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Fall back to dotfile
|
|
51
73
|
return nil unless File.exist?(dotfile_path)
|
|
52
74
|
|
|
53
75
|
content = File.read(dotfile_path).strip
|
data/lib/bugsink/version.rb
CHANGED