smbcloud-model 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 92ed5b679eae20c6f379f72f337bbce3fd7018e113397ec6f75eb1aae58bd54f
4
+ data.tar.gz: 4fb2c933dd44e4f5caa1d0ed4d73408f8555457b84543372297e73fcb5c79801
5
+ SHA512:
6
+ metadata.gz: 538f8cdac6a227e1355cad03c970e1508627d06ea461c0ba13738c6135ed0437a4c4fd29e451672c496ed92934b5103ff925db09950770c4f34a7dde5b48047e
7
+ data.tar.gz: 4f6fd2cd67c4fd878d9bdfd40d73c4645cf40f7a32caacde91427dcb976bf772b5bcfc26136392f0635178fcc7e88bd537121c35f6e143bd5f3153d565085dc7
data/Cargo.toml ADDED
@@ -0,0 +1,7 @@
1
+ # This Cargo.toml is here to let externals tools (IDEs, etc.) know that this is
2
+ # a Rust project. Your extensions dependencies should be added to the Cargo.toml
3
+ # in the ext/ directory.
4
+
5
+ [workspace]
6
+ members = ["./ext/model"]
7
+ resolver = "2"
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Model
2
+
3
+ TODO: Delete this and the text below, and describe your gem
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/model`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Installation
8
+
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
+
11
+ Install the gem and add to the application's Gemfile by executing:
12
+
13
+ ```bash
14
+ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
15
+ ```
16
+
17
+ If bundler is not being used to manage dependencies, install the gem by executing:
18
+
19
+ ```bash
20
+ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/model.
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rb_sys/extensiontask"
5
+
6
+ task build: :compile
7
+
8
+ GEMSPEC = Gem::Specification.load("model.gemspec")
9
+
10
+ RbSys::ExtensionTask.new("model", GEMSPEC) do |ext|
11
+ ext.lib_dir = "lib/model"
12
+ end
13
+
14
+ task default: :compile
@@ -0,0 +1,14 @@
1
+ [package]
2
+ name = "model"
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+ authors = ["paydii <hej@setoelkahfi.se>"]
6
+ publish = false
7
+
8
+ [lib]
9
+ crate-type = ["cdylib"]
10
+
11
+ [dependencies]
12
+ magnus = { version = "0.7.1" }
13
+ strum = "0.27"
14
+ smbcloud-model = { path = "./../../../../crates/smbcloud-model"}
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "mkmf"
4
+ require "rb_sys/mkmf"
5
+
6
+ create_rust_makefile("model/model")
@@ -0,0 +1,19 @@
1
+ use magnus::{function, prelude::*, Error, Ruby};
2
+ use smbcloud_model::error_codes::ErrorCode;
3
+ use strum::IntoEnumIterator;
4
+
5
+ fn t(e: i32, l: Option<String>) -> String {
6
+ ErrorCode::from_i32(e).message(l).to_string()
7
+ }
8
+
9
+ #[magnus::init]
10
+ fn init(ruby: &Ruby) -> Result<(), Error> {
11
+ let module = ruby.define_module("SmbCloud")?;
12
+ let error_code_mod = module.define_module("ErrorCode")?;
13
+ error_code_mod.define_singleton_method("t", function!(t, 2))?;
14
+ // Define all error codes as constants
15
+ for e in ErrorCode::iter() {
16
+ error_code_mod.const_set(e.rb_constant_name(), e as i32)?;
17
+ }
18
+ Ok(())
19
+ }
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Model
4
+ VERSION = "0.1.0"
5
+ end
data/lib/model.rb ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "model/version"
4
+ require_relative "model/model"
5
+
6
+ module Model
7
+ class Error < StandardError; end
8
+ # Your code goes here...
9
+ end
data/sig/model.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Model
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: smbcloud-model
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - paydii
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: rb_sys
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: 0.9.91
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: 0.9.91
26
+ description: Ruby binding for smbcloud-cli modellllllllllll.
27
+ email:
28
+ - hej@setoelkahfi.se
29
+ executables: []
30
+ extensions:
31
+ - ext/model/extconf.rb
32
+ extra_rdoc_files: []
33
+ files:
34
+ - Cargo.toml
35
+ - README.md
36
+ - Rakefile
37
+ - ext/model/Cargo.toml
38
+ - ext/model/extconf.rb
39
+ - ext/model/src/lib.rs
40
+ - lib/model.rb
41
+ - lib/model/version.rb
42
+ - sig/model.rbs
43
+ homepage: https://github.com/smbcloudXYZ/smbcloud-cli/gems/model
44
+ licenses: []
45
+ metadata:
46
+ allowed_push_host: https://rubygems.org
47
+ homepage_uri: https://github.com/smbcloudXYZ/smbcloud-cli/gems/model
48
+ source_code_uri: https://github.com/smbcloudXYZ/smbcloud-cli
49
+ changelog_uri: https://github.com/smbcloudXYZ/smbcloud-cli/CHANGELOG.md
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: 3.1.0
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 3.3.11
63
+ requirements: []
64
+ rubygems_version: 3.6.9
65
+ specification_version: 4
66
+ summary: Ruby binding for smbcloud-cli model.
67
+ test_files: []