zirconia 0.1.0 → 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: 83981e69d14fe2bbfa9a7a0058ddf5422cb987d0693d516fda42defd59795cab
4
- data.tar.gz: 4b4fe6bd399d63f2225a205a2da28b3483b459449d7dd89d1133c45faa4fc525
3
+ metadata.gz: db440a03bdfdad7203b071f4ea2f76c97c3d3e9be437f2a595731170199401d0
4
+ data.tar.gz: 55e1b5097d9704f14ac93874a7d84aa876102d7161649d1bf6e91a689886bd9f
5
5
  SHA512:
6
- metadata.gz: 45088c025d1e60ce8e57be3e8725e80edaaf7546976bf8c8a36e46f3ba98237885c6295162423249d75450aa94909ad5915599fe3cae47de450b82dea35531d0
7
- data.tar.gz: 65b9f8e5797bd0842ad727380d6d0055b6e38487635b61612670d1f1717e55a82c053cf050ee7645ee7e8ed63805694d72bdc6bfd133ee8d8361ae89ad20df2d
6
+ metadata.gz: 7833aa4a9f188a8d188117cb1e209abf07a954bae49bd30c9339b27122b70587007adf0f341d1d85899614831fee72e515f61cd5f38ad13aeab1d6ff4052c524
7
+ data.tar.gz: 750914b32c4d856264cc2caf0582cd32d283eb58ae1b3ac0b62f5dd53a72dbc57d059f1079735c312d34c0f84dd248e4eb42f31adddd340b6a8b2afe16a9bb62
data/.rubocop.yml CHANGED
@@ -29,6 +29,8 @@ Naming/MethodParameterName:
29
29
  - by
30
30
  - to
31
31
 
32
+ Style/ArgumentsForwarding:
33
+ Enabled: false
32
34
  Style/CharacterLiteral:
33
35
  Enabled: false
34
36
  Style/Documentation:
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zirconia (0.1.0)
4
+ zirconia (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -29,7 +29,7 @@ require "zirconia/rspec"
29
29
  ```
30
30
 
31
31
  - Instantiate a Zirconia Gem in your spec using the `with_gem: gem_name` metadata:
32
- ```rspec
32
+ ```ruby
33
33
  require 'spec_helper'
34
34
 
35
35
  RSpec.describe "Some Gem", with_gem: :some_gem do
@@ -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,24 +7,42 @@ 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
 
18
- def gem_path(*, ext: nil)
19
- build_path(*, dir:, ext:)
24
+ def exec(command)
25
+ validate_gem_exists!
26
+
27
+ Dir.chdir(dir.to_s) do
28
+ `bundle exec #{command}`
29
+ end
20
30
  end
21
31
 
22
- def lib_path(*, ext: :rb)
23
- build_path(*, dir: lib_dir, ext:)
32
+ def gem_path(*fragments, ext: nil)
33
+ build_path(*fragments, dir:, ext:)
24
34
  end
25
35
 
26
- def path(*, ext: :rb)
27
- build_path(*, dir: gem_dir, ext:)
36
+ def lib_path(*fragments, ext: :rb)
37
+ build_path(*fragments, dir: lib_dir, ext:)
38
+ end
39
+
40
+ def path(*fragments, ext: :rb)
41
+ build_path(*fragments, dir: gem_dir, ext:)
42
+ end
43
+
44
+ def spec_path(*fragments, ext: :rb)
45
+ build_path(*fragments, dir: spec_dir, ext:)
28
46
  end
29
47
 
30
48
  def main_file
@@ -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.0".freeze
2
+ VERSION = "0.1.2".freeze
3
3
  end
@@ -0,0 +1,14 @@
1
+ ---
2
+ sources:
3
+ - type: git
4
+ name: ruby/gem_rbs_collection
5
+ revision: 8149bc3fc0f720d935dc0592dc8886e03052f65f
6
+ remote: https://github.com/ruby/gem_rbs_collection.git
7
+ repo_dir: gems
8
+ path: sig/gems
9
+ gems:
10
+ - name: pathname
11
+ version: '0'
12
+ source:
13
+ type: stdlib
14
+ gemfile_lock_path: Gemfile.lock
@@ -0,0 +1,29 @@
1
+ # Download sources
2
+ sources:
3
+ - type: git
4
+ name: ruby/gem_rbs_collection
5
+ remote: https://github.com/ruby/gem_rbs_collection.git
6
+ revision: main
7
+ repo_dir: gems
8
+
9
+ # You can specify local directories as sources also.
10
+ # - type: local
11
+ # path: path/to/your/local/repository
12
+
13
+ # A directory to install the downloaded RBSs
14
+ path: sig/gems
15
+
16
+ gems:
17
+ # Skip loading rbs gem's RBS.
18
+ # It's unnecessary if you don't use rbs as a library.
19
+ - name: rbs
20
+ ignore: true
21
+ - name: rake
22
+ ignore: true
23
+ - name: rspec
24
+ ignore: true
25
+ - name: rubocop
26
+ ignore: true
27
+ - name: steep
28
+ ignore: true
29
+ - name: pathname
@@ -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
data/zirconia.gemspec CHANGED
@@ -9,10 +9,10 @@ Gem::Specification.new do |spec|
9
9
  spec.summary = "Lightweight testing utility for synthesising Ruby gems"
10
10
 
11
11
  spec.description = <<~DESCRIPTION
12
- Zirconia is a lightweight testing utility that is capable of generating\
12
+ Zirconia is a lightweight testing utility that is capable of generating \
13
13
  temporary Ruby Gem applications from within the test suite.
14
14
 
15
- Zirconia offers an intuitive interface around the synthetic gem allowing
15
+ Zirconia offers an intuitive interface around the synthetic gem allowing \
16
16
  them to be configured and coded from within the test environment.
17
17
  DESCRIPTION
18
18
 
metadata CHANGED
@@ -1,20 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zirconia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
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-16 00:00:00.000000000 Z
11
+ date: 2023-10-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
- Zirconia is a lightweight testing utility that is capable of generatingtemporary Ruby Gem applications from within the test suite.
14
+ Zirconia is a lightweight testing utility that is capable of generating temporary Ruby Gem applications from within the test suite.
15
15
 
16
- Zirconia offers an intuitive interface around the synthetic gem allowing
17
- them to be configured and coded from within the test environment.
16
+ Zirconia offers an intuitive interface around the synthetic gem allowing them to be configured and coded from within the test environment.
18
17
  email:
19
18
  - 71787007+apexatoll@users.noreply.github.com
20
19
  executables: []
@@ -34,8 +33,9 @@ files:
34
33
  - lib/zirconia/application.rb
35
34
  - lib/zirconia/rspec.rb
36
35
  - lib/zirconia/version.rb
36
+ - rbs_collection.lock.yaml
37
+ - rbs_collection.yaml
37
38
  - sig/dir.rbs
38
- - sig/pathname.rbs
39
39
  - sig/rspec.rbs
40
40
  - sig/zirconia.rbs
41
41
  - sig/zirconia/application.rbs
data/sig/pathname.rbs DELETED
@@ -1,17 +0,0 @@
1
- class Pathname
2
- def initialize: (String path) -> void
3
-
4
- def read: -> String
5
-
6
- def write: (String contents) -> void
7
-
8
- def basename: (?String) -> Pathname
9
-
10
- def dirname: -> Pathname
11
-
12
- def exist?: -> bool
13
-
14
- def join: (*String) -> Pathname
15
-
16
- def to_s: -> String
17
- end