serverkit-mise 0.0.1 → 0.1.0

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: 9e253ff88cf63081f7cc7b39e47ed7d72ff5cc1446288b891a0a0138c0a04c2a
4
- data.tar.gz: 781ffa09a46d9086db077e69d1ff3561183d5c2cb5ff1cd019ff7974e080864b
3
+ metadata.gz: 39b50055b307bb51e718c29b19497584ffdda20232570558547ad044e35e0aed
4
+ data.tar.gz: 0d98fb00a8ec9d9100bca638422ac11819f456d578a4cc594e360c5662734a6e
5
5
  SHA512:
6
- metadata.gz: f1abb72f59a9c25a95df978a783e703b5f338f8d5d579495bf2ec5fa8727007068999d62a4ebc7869a4c4053580f21d5d2be527e8731db5ac08edc361701d120
7
- data.tar.gz: 4677c2787d76f38698278f0245005808448cc35201fc34399f800787241bfcff0953b3a0e2ccec12f8bb45823182ed37aef8f6d83299e0fced565202f8788b74
6
+ metadata.gz: e695961ead61a704a66b537267ce425da68edfa12c3494d24984e1d43b08d5f54e42ebb27690933bdc17aab7238260820e25264bdd1cc4a8f8e78065921c8eb1
7
+ data.tar.gz: c10a30cbacb7af9e986d49313d4b66b637fcc91dba7bdf66baf7db839ce53ebfca4666d7952c98df7f693f7dea516b63dc4de594d9b8dde83cd5543b085b6a2b
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  [![Test](https://github.com/serverkit/serverkit-mise/actions/workflows/test.yml/badge.svg)](https://github.com/serverkit/serverkit-mise/actions/workflows/test.yml)
2
+ [![Gem Version](https://badge.fury.io/rb/serverkit-mise.svg)](https://badge.fury.io/rb/serverkit-mise)
2
3
 
3
4
  # serverkit-mise
4
5
 
@@ -6,16 +7,9 @@
6
7
 
7
8
  ## Installation
8
9
 
9
- Install the gem and add to the application's Gemfile by executing:
10
-
11
- ```bash
12
- bundle add serverkit-mise
13
- ```
14
-
15
- If bundler is not being used to manage dependencies, install the gem by executing:
16
-
17
- ```bash
18
- gem install serverkit-mise
10
+ ```rb
11
+ # Gemfile
12
+ gem "serverkit-mise"
19
13
  ```
20
14
 
21
15
  ## Usage
@@ -51,7 +45,8 @@ Install specified tool and add the version to `mise.yml`.
51
45
  #### Attributes
52
46
 
53
47
  - `name` - tool name (required)
54
- - `version` - tool version (optional)
48
+ - `version` - tool version (optional, if not specified, the latest version will be installed)
49
+ - `global` - global option (optional, default: `true`)
55
50
 
56
51
  #### Example
57
52
 
@@ -60,6 +55,7 @@ resources:
60
55
  - type: mise_use
61
56
  name: go
62
57
  version: '1.23'
58
+ global: false
63
59
  - type: mise_use
64
60
  name: ruby
65
61
  ```
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Serverkit
4
4
  module Mise
5
- VERSION = "0.0.1"
5
+ VERSION = "0.1.0"
6
6
  end
7
7
  end
@@ -7,18 +7,17 @@ module Serverkit
7
7
  class MiseUse < Base
8
8
  attribute :name, required: true, type: String
9
9
  attribute :version, type: String
10
- # FIXME: add global option
11
- attribute :global, type: [TrueClass, FalseClass] # , default: true
10
+ attribute :global, type: [TrueClass, FalseClass], default: true
12
11
 
13
12
  # @note Override
14
13
  def apply
15
- run_command("mise use --global #{name_with_version}")
14
+ run_command("mise use #{global_option} #{name_with_version}")
16
15
  end
17
16
 
18
17
  # @note Override
19
18
  def check
20
19
  cmd = if global
21
- "mise ls --global #{name} | grep '#{version_or_latest}'"
20
+ "mise ls --cd $HOME #{name} | grep '#{version_or_latest}'"
22
21
  else
23
22
  "mise ls --current #{name} | grep '#{version_or_latest}'"
24
23
  end
@@ -42,13 +41,14 @@ module Serverkit
42
41
  end
43
42
  end
44
43
 
44
+ # @return [String]
45
45
  def version_or_latest
46
46
  version || "latest"
47
47
  end
48
48
 
49
- # def global_option
50
- # "--global" if global
51
- # end
49
+ def global_option
50
+ "--global" if global
51
+ end
52
52
  end
53
53
  end
54
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverkit-mise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - toshimaru