zirconia 0.1.1 → 0.1.2

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: 314fe0f219a9e115babd71f43fa3c13d4eac464878f1162b02c69028f1325e5b
4
- data.tar.gz: 33f216834c86901012c9414e6c1a6795e38b79349a52245eaee7c4a2c49a822f
3
+ metadata.gz: db440a03bdfdad7203b071f4ea2f76c97c3d3e9be437f2a595731170199401d0
4
+ data.tar.gz: 55e1b5097d9704f14ac93874a7d84aa876102d7161649d1bf6e91a689886bd9f
5
5
  SHA512:
6
- metadata.gz: 226931666c4b247554b88e31dc00c34c05d712b97229b04e3a2df695b6863326c26030d9ab29cf78eed64001c63322b24ead6dd22bf1aee64c55f48d1bce1ab7
7
- data.tar.gz: bf07844f357d5d2530e3bf7d5c4313c08b33ad291dc6e8fb95e72bf6dc2a56f14e7517dca8c3f1f3929104b7bdf7ec9aaca286b0edfed5d5ed2d23061f888a63
6
+ metadata.gz: 7833aa4a9f188a8d188117cb1e209abf07a954bae49bd30c9339b27122b70587007adf0f341d1d85899614831fee72e515f61cd5f38ad13aeab1d6ff4052c524
7
+ data.tar.gz: 750914b32c4d856264cc2caf0582cd32d283eb58ae1b3ac0b62f5dd53a72dbc57d059f1079735c312d34c0f84dd248e4eb42f31adddd340b6a8b2afe16a9bb62
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zirconia (0.1.1)
4
+ zirconia (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -89,6 +89,10 @@ The `_path` methods can be called with a variable amount of string path fragment
89
89
  - Returns `Pathname` objects for paths in the gem named lib directory
90
90
  - In a conventional Ruby gem filetree this is `some_gem/lib/some_gem/*.ext`
91
91
 
92
+ #### spec_path
93
+ - Returns `Pathname` objects for paths in the gem spec directory
94
+ - In a conventional Ruby gem filetree this is `some_gem/spec/*.ext`
95
+
92
96
  #### main_file
93
97
  - Returns a `Pathname` object
94
98
  - This is the entrypoint to the gem application:
@@ -98,6 +102,9 @@ The `_path` methods can be called with a variable amount of string path fragment
98
102
  - This method requires the fake gem into your current Ruby scope.
99
103
  - Note that this process is not idempotent as gems will not be reloaded.
100
104
 
105
+ #### exec
106
+ - Accepts a string argument, which is passed to `bundle exec`.
107
+ - Returns the string output of the command
101
108
 
102
109
  ## Example
103
110
 
@@ -7,14 +7,28 @@ module Zirconia
7
7
  @name = name
8
8
  end
9
9
 
10
+ def created?
11
+ @created == true
12
+ end
13
+
10
14
  def create!
11
15
  `bundle gem #{dir}`
16
+
17
+ @created = true
12
18
  end
13
19
 
14
20
  def load!
15
21
  require main_file.to_s
16
22
  end
17
23
 
24
+ def exec(command)
25
+ validate_gem_exists!
26
+
27
+ Dir.chdir(dir.to_s) do
28
+ `bundle exec #{command}`
29
+ end
30
+ end
31
+
18
32
  def gem_path(*fragments, ext: nil)
19
33
  build_path(*fragments, dir:, ext:)
20
34
  end
@@ -27,6 +41,10 @@ module Zirconia
27
41
  build_path(*fragments, dir: gem_dir, ext:)
28
42
  end
29
43
 
44
+ def spec_path(*fragments, ext: :rb)
45
+ build_path(*fragments, dir: spec_dir, ext:)
46
+ end
47
+
30
48
  def main_file
31
49
  @main_file ||= lib_path(name, ext: :rb)
32
50
  end
@@ -45,6 +63,10 @@ module Zirconia
45
63
  @gem_dir ||= lib_dir.join(name)
46
64
  end
47
65
 
66
+ def spec_dir
67
+ @spec_dir ||= dir.join("spec")
68
+ end
69
+
48
70
  def build_path(*fragments, dir:, ext:)
49
71
  return dir if fragments.empty?
50
72
 
@@ -53,5 +75,11 @@ module Zirconia
53
75
 
54
76
  dir.join(*fragments, file)
55
77
  end
78
+
79
+ def validate_gem_exists!
80
+ return if created?
81
+
82
+ raise "gem does not exist"
83
+ end
56
84
  end
57
85
  end
@@ -1,3 +1,3 @@
1
1
  module Zirconia
2
- VERSION = "0.1.1".freeze
2
+ VERSION = "0.1.2".freeze
3
3
  end
@@ -3,18 +3,26 @@ module Zirconia
3
3
  attr_reader dir: Pathname
4
4
  attr_reader name: String
5
5
 
6
+ @created: bool
7
+
6
8
  def initialize: (dir: String, name: String) -> void
7
9
 
10
+ def created?: -> bool
11
+
8
12
  def create!: -> void
9
13
 
10
14
  def load!: -> void
11
15
 
16
+ def exec: (String) -> String
17
+
12
18
  def gem_path: (*String, ?ext: Symbol?) -> Pathname
13
19
 
14
20
  def lib_path: (*String, ?ext: Symbol?) -> Pathname
15
21
 
16
22
  def path: (*String, ?ext: Symbol?) -> Pathname
17
23
 
24
+ def spec_path: (*String, ?ext: Symbol?) -> Pathname
25
+
18
26
  def to_sym: -> Symbol
19
27
 
20
28
  attr_reader main_file: Pathname
@@ -23,7 +31,10 @@ module Zirconia
23
31
 
24
32
  attr_reader lib_dir: Pathname
25
33
  attr_reader gem_dir: Pathname
34
+ attr_reader spec_dir: Pathname
26
35
 
27
36
  def build_path: (*String, dir: Pathname, ext: Symbol?) -> Pathname
37
+
38
+ def validate_gem_exists!: -> void
28
39
  end
29
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zirconia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Welham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-21 00:00:00.000000000 Z
11
+ date: 2023-10-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  Zirconia is a lightweight testing utility that is capable of generating temporary Ruby Gem applications from within the test suite.