serverkit-mise 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9e253ff88cf63081f7cc7b39e47ed7d72ff5cc1446288b891a0a0138c0a04c2a
4
+ data.tar.gz: 781ffa09a46d9086db077e69d1ff3561183d5c2cb5ff1cd019ff7974e080864b
5
+ SHA512:
6
+ metadata.gz: f1abb72f59a9c25a95df978a783e703b5f338f8d5d579495bf2ec5fa8727007068999d62a4ebc7869a4c4053580f21d5d2be527e8731db5ac08edc361701d120
7
+ data.tar.gz: 4677c2787d76f38698278f0245005808448cc35201fc34399f800787241bfcff0953b3a0e2ccec12f8bb45823182ed37aef8f6d83299e0fced565202f8788b74
data/.standard.yml ADDED
@@ -0,0 +1,3 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/standardrb/standard
3
+ ruby_version: 3.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 toshimaru
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,73 @@
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
+
3
+ # serverkit-mise
4
+
5
+ [Serverkit](https://github.com/serverkit/serverkit) plug-in for [mise](https://github.com/jdx/mise).
6
+
7
+ ## Installation
8
+
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
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Resource
26
+
27
+ ### mise_install
28
+
29
+ Install specified tool via mise.
30
+
31
+ #### Attributes
32
+
33
+ - `name` - tool name (required)
34
+ - `version` - tool version (optional)
35
+
36
+ #### Example
37
+
38
+ ```yaml
39
+ resources:
40
+ - type: mise_install
41
+ name: go
42
+ - type: mise_install
43
+ name: ruby
44
+ version: 3.4.3
45
+ ```
46
+
47
+ ### mise_use
48
+
49
+ Install specified tool and add the version to `mise.yml`.
50
+
51
+ #### Attributes
52
+
53
+ - `name` - tool name (required)
54
+ - `version` - tool version (optional)
55
+
56
+ #### Example
57
+
58
+ ```yaml
59
+ resources:
60
+ - type: mise_use
61
+ name: go
62
+ version: '1.23'
63
+ - type: mise_use
64
+ name: ruby
65
+ ```
66
+
67
+ ## Contributing
68
+
69
+ Bug reports and pull requests are welcome on GitHub at [serverkit/serverkit-mise](https://github.com/serverkit/serverkit-mise).
70
+
71
+ ## License
72
+
73
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "minitest/test_task"
5
+
6
+ Minitest::TestTask.create
7
+
8
+ require "standard/rake"
9
+
10
+ task default: %i[test standard]
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Serverkit
4
+ module Mise
5
+ VERSION = "0.0.1"
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "mise/version"
4
+ require_relative "resources/mise_install"
5
+ require_relative "resources/mise_use"
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "serverkit/resources/base"
4
+
5
+ module Serverkit
6
+ module Resources
7
+ class MiseInstall < Base
8
+ attribute :name, required: true, type: String
9
+ attribute :version, type: String
10
+
11
+ # @note Override
12
+ def apply
13
+ run_command("mise install #{name_with_version}")
14
+ end
15
+
16
+ # @note Override
17
+ def check
18
+ check_command(" mise ls #{name} | grep '#{version_or_latest}'")
19
+ end
20
+
21
+ private
22
+
23
+ # @note Override
24
+ def default_id
25
+ name
26
+ end
27
+
28
+ # @return [String]
29
+ # @example "ruby@3.4.3"
30
+ def name_with_version
31
+ if version
32
+ "#{name}@#{version}"
33
+ else
34
+ name
35
+ end
36
+ end
37
+
38
+ # @return [String]
39
+ def version_or_latest
40
+ version || "latest"
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "serverkit/resources/base"
4
+
5
+ module Serverkit
6
+ module Resources
7
+ class MiseUse < Base
8
+ attribute :name, required: true, type: String
9
+ attribute :version, type: String
10
+ # FIXME: add global option
11
+ attribute :global, type: [TrueClass, FalseClass] # , default: true
12
+
13
+ # @note Override
14
+ def apply
15
+ run_command("mise use --global #{name_with_version}")
16
+ end
17
+
18
+ # @note Override
19
+ def check
20
+ cmd = if global
21
+ "mise ls --global #{name} | grep '#{version_or_latest}'"
22
+ else
23
+ "mise ls --current #{name} | grep '#{version_or_latest}'"
24
+ end
25
+ check_command(cmd)
26
+ end
27
+
28
+ private
29
+
30
+ # @note Override
31
+ def default_id
32
+ name
33
+ end
34
+
35
+ # @return [String]
36
+ # @example "ruby@3.4.3"
37
+ def name_with_version
38
+ if version
39
+ "#{name}@#{version}"
40
+ else
41
+ name
42
+ end
43
+ end
44
+
45
+ def version_or_latest
46
+ version || "latest"
47
+ end
48
+
49
+ # def global_option
50
+ # "--global" if global
51
+ # end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,6 @@
1
+ module Serverkit
2
+ module Mise
3
+ VERSION: String
4
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: serverkit-mise
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - toshimaru
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: serverkit
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
26
+ description: Serverkit plug-in for mise.
27
+ email:
28
+ - me@toshimaru.net
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - ".standard.yml"
34
+ - LICENSE.txt
35
+ - README.md
36
+ - Rakefile
37
+ - lib/serverkit/mise.rb
38
+ - lib/serverkit/mise/version.rb
39
+ - lib/serverkit/resources/mise_install.rb
40
+ - lib/serverkit/resources/mise_use.rb
41
+ - sig/serverkit/mise.rbs
42
+ homepage: https://github.com/serverkit/serverkit-mise
43
+ licenses:
44
+ - MIT
45
+ metadata:
46
+ homepage_uri: https://github.com/serverkit/serverkit-mise
47
+ source_code_uri: https://github.com/serverkit/serverkit-mise
48
+ changelog_uri: https://github.com/serverkit/serverkit-mise/releases
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 3.1.0
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubygems_version: 3.6.7
64
+ specification_version: 4
65
+ summary: Serverkit plug-in for mise.
66
+ test_files: []