mikras-ruby 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: 9a667ffdb65b67999a5dbc71744b3858183abca165eebc095eb2f7680edd07d6
4
+ data.tar.gz: caf1074eecf04368b92957b1db3ed6d80effd04501603b55f7eeb3757781f3b8
5
+ SHA512:
6
+ metadata.gz: 5d1ba0252f64751780f6e7c5221f3b36a0e0b0aec8e7fc660b4940e5452d62157b43af134f84ad4bda668fa2cb7f7f65e3f7452d87d7183ae2c083cf4c46091e
7
+ data.tar.gz: 79fc63c968524c8703ebe9a2f57c3b1009c3cdab6084757ae92c7c0872affd004ce0bb66efebb5846eb9ea375454819c642096c2998120752bf98689e037a4f5
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-3.1.2
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Mikras::Ruby
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/mikras/ruby`. 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. Then, run `rake spec` to run the tests. 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]/mikras-ruby.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mikras
4
+ VERSION = "0.1.0"
5
+ end
data/lib/mikras.rb ADDED
@@ -0,0 +1,127 @@
1
+
2
+ # General include file for Mikras scripts that sets up Prick constants and the
3
+ # ruby include path so that files in PRICK_LIBDIR can be required. It is
4
+ # installed in a gem so that it can be found before the environment has been
5
+ # initialized
6
+ #
7
+ # It also requries the local project file lib/mikras.rb if it exists
8
+ #
9
+ # require 'mikras'
10
+ # require 'some-script.rb' # PRICK_DIR/lib is now in ruby load path
11
+ #
12
+ # It should have been split into two files: prick.rb with definitions of the
13
+ # Prick module and mikras.rb with the Mikras module but prick.rb would conflict
14
+ # with prick(1) and it is too expensive to include the whole prick library
15
+ # structure from prick
16
+ #
17
+ #
18
+ # It defines the Prick core constants
19
+ # PRICK_SCRIPT
20
+ #
21
+ # PRICK_FILE
22
+ # PRICK_STATE_FILE
23
+ # PRICK_ENVIRONMENT_FILE
24
+ #
25
+ # PRICK_DIR
26
+ #
27
+ # PRICK_DATABASE
28
+ # PRICK_USERNAME
29
+ # PRICK_ENVIRONMENT
30
+ #
31
+
32
+ require 'yaml'
33
+ require 'shellopts'
34
+
35
+ module Find # Monkey patching standard library
36
+ def self.upfind(dir, file)
37
+ loop do
38
+ return dir if File.exist? File.join(dir, file)
39
+ return nil if dir == "/"
40
+ dir = File.dirname(dir)
41
+ end
42
+ return nil
43
+ end
44
+ end
45
+
46
+ module Prick
47
+ private
48
+ def self.prick_state
49
+ @prick_state ||= begin
50
+ state_file_path = File.join(PRICK_DIR, PRICK_STATE_FILE)
51
+ File.exist?(state_file_path) ? YAML.load(IO.read state_file_path) : {}
52
+ end
53
+ end
54
+
55
+ def self.prick
56
+ @prick ||= begin
57
+ prick_file_path = File.join(PRICK_DIR, PRICK_FILE)
58
+ File.exist?(prick_file_path) ? YAML.load(IO.read prick_file_path) : {}
59
+ end
60
+ end
61
+
62
+ public
63
+ PRICK_FILE = "prick.yml"
64
+ PRICK_STATE_FILE = ".prick.state.yml"
65
+ PRICK_ENVIRONMENT_FILE = "prick.environment.yml"
66
+
67
+ PRICK_SCRIPT = File.realpath($0)
68
+ PRICK_SCRIPTDIR = File.dirname(PRICK_SCRIPT)
69
+
70
+ PRICK_DIR = ENV['PRICK_DIR'] || Find.upfind(PRICK_SCRIPTDIR, PRICK_FILE)
71
+ PRICK_DIR or ShellOpts::error "Can't find Mikras project directory - #{PRICK_FILE} not found"
72
+
73
+ PRICK_DATABASE = ENV['PRICK_DATABASE'] || prick_state["database"]
74
+ PRICK_USERNAME = ENV['PRICK_USERNAME'] || prick_state["username"]
75
+ PRICK_ENVIRONMENT = ENV['PRICK_ENVIRONMENT'] || prick_state["environment"]
76
+
77
+ PRICK_NAME = ENV['PRICK_NAME'] || prick['name']
78
+
79
+ # Prick subdirectories - this includes the PRICK_LIBDIR and PRICK_SHAREDIR
80
+ # directories that are not implemented in Prick (yet)
81
+ PRICK_SCHEMADIR = ENV['PRICK_SCHEMADIR'] || "#{PRICK_DIR}/schema"
82
+ PRICK_BINDIR = ENV['PRICK_BINDIR'] || "#{PRICK_DIR}/bin"
83
+ PRICK_LIBEXECDIR = ENV['PRICK_LIBEXECDIR'] || "#{PRICK_DIR}/libexec"
84
+ PRICK_LIBDIR = ENV['PRICK_LIBDIR'] || "#{PRICK_DIR}/lib"
85
+ PRICK_VARDIR = ENV['PRICK_VARDIR'] || "#{PRICK_DIR}/var"
86
+ PRICK_CACHEDIR = ENV['PRICK_CACHEDIR'] || "#{PRICK_DIR}/cache"
87
+ PRICK_SPOOLDIR = ENV['PRICK_SPOOLDIR'] || "#{PRICK_DIR}/spool"
88
+ PRICK_TMPDIR = ENV['PRICK_TMPDIR'] || "#{PRICK_DIR}/tmp"
89
+ PRICK_CLONEDIR = ENV['PRICK_CLONEDIR'] || "#{PRICK_DIR}/tmp/clones"
90
+ PRICK_SPECDIR = ENV['PRICK_SPECDIR'] || "#{PRICK_DIR}/spec"
91
+
92
+ $LOAD_PATH.unshift File.join(PRICK_DIR, "lib") if PRICK_DIR
93
+
94
+ def self.dump
95
+ dumpc %w(name)
96
+ puts
97
+ dumpc %w(file state_file environment_file)
98
+ puts
99
+ dumpc %w(database username environment)
100
+ puts
101
+ dumpc %w(script scriptdir)
102
+ puts
103
+ dumpc %w(dir)
104
+ puts
105
+ dumpc %w(schemadir bindir libexecdir libdir vardir cachedir spooldir tmpdir clonedir specdir)
106
+ puts
107
+ end
108
+
109
+ private
110
+ # "Print" a constant
111
+ def self.dumpc(*consts)
112
+ consts = consts.flatten
113
+ for const in consts
114
+ ident = "PRICK_#{const.upcase}"
115
+ value = eval(ident)
116
+ puts "#{ident}: #{value.inspect}"
117
+ end
118
+ end
119
+ end
120
+
121
+ module Mikras
122
+ end
123
+
124
+ if File.exist? File.join(Prick::PRICK_LIBDIR, "mikras.rb")
125
+ require File.join(Prick::PRICK_LIBDIR, "mikras.rb")
126
+ end
127
+
@@ -0,0 +1,6 @@
1
+ module Mikras
2
+ module Ruby
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,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mikras-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Claus Rasmussen
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2025-05-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: shellopts
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Global include file for mikras ruby scripts
28
+ email:
29
+ - ras@danak.dk
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".rspec"
35
+ - ".ruby-version"
36
+ - README.md
37
+ - Rakefile
38
+ - lib/mikras.rb
39
+ - lib/mikras/version.rb
40
+ - sig/mikras/ruby.rbs
41
+ homepage: http://www.nowhere.com/
42
+ licenses: []
43
+ metadata:
44
+ homepage_uri: http://www.nowhere.com/
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 3.1.0
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubygems_version: 3.3.7
61
+ signing_key:
62
+ specification_version: 4
63
+ summary: Mikras include file
64
+ test_files: []