zirconia 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +7 -0
- data/lib/zirconia/application.rb +28 -0
- data/lib/zirconia/version.rb +1 -1
- data/sig/zirconia/application.rbs +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db440a03bdfdad7203b071f4ea2f76c97c3d3e9be437f2a595731170199401d0
|
4
|
+
data.tar.gz: 55e1b5097d9704f14ac93874a7d84aa876102d7161649d1bf6e91a689886bd9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7833aa4a9f188a8d188117cb1e209abf07a954bae49bd30c9339b27122b70587007adf0f341d1d85899614831fee72e515f61cd5f38ad13aeab1d6ff4052c524
|
7
|
+
data.tar.gz: 750914b32c4d856264cc2caf0582cd32d283eb58ae1b3ac0b62f5dd53a72dbc57d059f1079735c312d34c0f84dd248e4eb42f31adddd340b6a8b2afe16a9bb62
|
data/Gemfile.lock
CHANGED
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
|
|
data/lib/zirconia/application.rb
CHANGED
@@ -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
|
data/lib/zirconia/version.rb
CHANGED
@@ -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.
|
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-
|
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.
|