body_double 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 +7 -0
- data/CHANGELOG.md +18 -0
- data/LICENSE +21 -0
- data/README.md +58 -0
- data/lib/body_double/double.rb +26 -0
- data/lib/body_double/version.rb +5 -0
- data/lib/body_double.rb +18 -0
- metadata +49 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: edbb02488e96166049c958ff8aa941806ac95e4403a122bbfb103c1d9ece4eef
|
|
4
|
+
data.tar.gz: f7aec79cc3025a53ecc4adde3a3087eb4223eec459363df1a2bb6afd3349c754
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b7bf1cf0394c6ab6f520792cd09555e83d3a7f4de6bf6686bba9d27f0c2eff43c4f14acbb2cb11aecc8d24a6cf093c7e8c186dd297991e2f1037d905b9429af8
|
|
7
|
+
data.tar.gz: e249f4148719b76b6ffc8c043876c873402a48492a8c02c62a9afd48f2e214e8920cf385f42f2035d78d9954c697c6bc1ae847ed4ee0a744a914c213333633ca
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Body Double will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.1.0] - 2026-09-02
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Initial gem structure and project documentation.
|
|
14
|
+
- `BodyDouble.generate`, with optional deterministic seeding.
|
|
15
|
+
- Immutable `BodyDouble::Double` values containing synthetic names and email addresses.
|
|
16
|
+
|
|
17
|
+
[Unreleased]: https://github.com/SilenceDogood1984/body_double/compare/v0.1.0...HEAD
|
|
18
|
+
[0.1.0]: https://github.com/SilenceDogood1984/body_double/releases/tag/v0.1.0
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Chad Snow
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Body Double
|
|
2
|
+
|
|
3
|
+
Body Double is small tooling for working with synthetic application data in Ruby and Rails applications. It currently generates unmistakably fake identity values and does not provide persistence or framework integration.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add the gem to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem "body_double"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Then run `bundle install`. Alternatively, install it directly with:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
gem install body_double
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Body Double supports Ruby 2.7 and later.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
Generate a synthetic identity:
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
identity = BodyDouble.generate
|
|
27
|
+
identity.name # => "Synthetic ..."
|
|
28
|
+
identity.email # => "body-double-...@example.invalid"
|
|
29
|
+
identity.to_h # => { name: "Synthetic ...", email: "body-double-...@example.invalid" }
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Pass a seed when repeatable output is useful. A given seed always produces the same value:
|
|
33
|
+
|
|
34
|
+
```ruby
|
|
35
|
+
BodyDouble.generate(seed: 1234) == BodyDouble.generate(seed: 1234) # => true
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Generated values are deliberately conspicuous and use the reserved `.invalid` domain. They are test data, not production identities.
|
|
39
|
+
|
|
40
|
+
## Development
|
|
41
|
+
|
|
42
|
+
Clone the repository and run:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
bin/setup
|
|
46
|
+
bundle exec rake
|
|
47
|
+
bin/console
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The default Rake task runs the RSpec suite and RuboCop. Build the gem locally with `bundle exec rake build`.
|
|
51
|
+
|
|
52
|
+
## Contributing
|
|
53
|
+
|
|
54
|
+
Bug reports and focused pull requests are welcome on GitHub. Please include tests for behavior changes, run `bundle exec rake`, and keep proposals within the project's deliberately small scope.
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
Body Double is available as open source under the terms of the [MIT License](LICENSE).
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module BodyDouble
|
|
4
|
+
class Double
|
|
5
|
+
attr_reader :name, :email
|
|
6
|
+
|
|
7
|
+
def initialize(name:, email:)
|
|
8
|
+
@name = name.freeze
|
|
9
|
+
@email = email.freeze
|
|
10
|
+
freeze
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def ==(other)
|
|
14
|
+
other.instance_of?(self.class) && name == other.name && email == other.email
|
|
15
|
+
end
|
|
16
|
+
alias eql? ==
|
|
17
|
+
|
|
18
|
+
def hash
|
|
19
|
+
[self.class, name, email].hash
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def to_h
|
|
23
|
+
{ name: name, email: email }
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/lib/body_double.rb
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'body_double/double'
|
|
4
|
+
require_relative 'body_double/version'
|
|
5
|
+
|
|
6
|
+
module BodyDouble
|
|
7
|
+
FIRST_NAMES = %w[Ada Grace Matz Octavia].freeze
|
|
8
|
+
LAST_NAMES = %w[Example Sample Test Demo].freeze
|
|
9
|
+
private_constant :FIRST_NAMES, :LAST_NAMES
|
|
10
|
+
|
|
11
|
+
def self.generate(seed: nil)
|
|
12
|
+
random = seed.nil? ? Random.new : Random.new(seed)
|
|
13
|
+
name = "Synthetic #{FIRST_NAMES.sample(random: random)} #{LAST_NAMES.sample(random: random)}"
|
|
14
|
+
email = format('body-double-%08x@example.invalid', random.rand(0x1_0000_0000))
|
|
15
|
+
|
|
16
|
+
Double.new(name: name, email: email)
|
|
17
|
+
end
|
|
18
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: body_double
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Chad Snow
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 2026-09-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: A small toolkit for generating unmistakably synthetic identity data in
|
|
13
|
+
Ruby and Rails applications.
|
|
14
|
+
executables: []
|
|
15
|
+
extensions: []
|
|
16
|
+
extra_rdoc_files: []
|
|
17
|
+
files:
|
|
18
|
+
- CHANGELOG.md
|
|
19
|
+
- LICENSE
|
|
20
|
+
- README.md
|
|
21
|
+
- lib/body_double.rb
|
|
22
|
+
- lib/body_double/double.rb
|
|
23
|
+
- lib/body_double/version.rb
|
|
24
|
+
homepage: https://github.com/SilenceDogood1984/body_double
|
|
25
|
+
licenses:
|
|
26
|
+
- MIT
|
|
27
|
+
metadata:
|
|
28
|
+
allowed_push_host: https://rubygems.org
|
|
29
|
+
changelog_uri: https://github.com/SilenceDogood1984/body_double/blob/main/CHANGELOG.md
|
|
30
|
+
rubygems_mfa_required: 'true'
|
|
31
|
+
source_code_uri: https://github.com/SilenceDogood1984/body_double
|
|
32
|
+
rdoc_options: []
|
|
33
|
+
require_paths:
|
|
34
|
+
- lib
|
|
35
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: 2.7.0
|
|
40
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
41
|
+
requirements:
|
|
42
|
+
- - ">="
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
version: '0'
|
|
45
|
+
requirements: []
|
|
46
|
+
rubygems_version: 3.6.2
|
|
47
|
+
specification_version: 4
|
|
48
|
+
summary: Synthetic application data tooling for Ruby
|
|
49
|
+
test_files: []
|