initials 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/initials/version.rb +1 -1
- metadata +2 -14
- data/.github/workflows/ruby.yml +0 -39
- data/.gitignore +0 -16
- data/.rspec +0 -3
- data/.travis.yml +0 -7
- data/Gemfile +0 -8
- data/LICENSE.txt +0 -21
- data/README.md +0 -75
- data/Rakefile +0 -6
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/demo.png +0 -0
- data/initials.gemspec +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9e93b9af7fecf572fbcf123770f1c94d35cfd7206de6498ba0b9820186f91ad
|
4
|
+
data.tar.gz: f2435541f81450b5e7fd458527579fb9c8fcf36b6bd3571c802531412daf1393
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acf34c95dc2200b59f83835dbe885b45a694fbe8cd22dfe6fea46b5776839f5b236a7e0537c6177a6e1e76206ca73d32fefefeb4e5a6845bff6aeafb6bb7c0ed
|
7
|
+
data.tar.gz: 0a0aafb85bb929a5dcb785064693d4329eb5f127c8b8668f466d332c5424dae7f58ddac2bd8674656e79a1683ca7a71348ebc05ce71f813907bd9a77f3d520fe
|
data/lib/initials/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: initials
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Hutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -59,18 +59,6 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- ".github/workflows/ruby.yml"
|
63
|
-
- ".gitignore"
|
64
|
-
- ".rspec"
|
65
|
-
- ".travis.yml"
|
66
|
-
- Gemfile
|
67
|
-
- LICENSE.txt
|
68
|
-
- README.md
|
69
|
-
- Rakefile
|
70
|
-
- bin/console
|
71
|
-
- bin/setup
|
72
|
-
- demo.png
|
73
|
-
- initials.gemspec
|
74
62
|
- lib/initials.rb
|
75
63
|
- lib/initials/svg.rb
|
76
64
|
- lib/initials/version.rb
|
data/.github/workflows/ruby.yml
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# This workflow uses actions that are not certified by GitHub.
|
2
|
-
# They are provided by a third-party and are governed by
|
3
|
-
# separate terms of service, privacy policy, and support
|
4
|
-
# documentation.
|
5
|
-
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
-
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
-
|
8
|
-
name: Ruby
|
9
|
-
|
10
|
-
on:
|
11
|
-
push:
|
12
|
-
branches: [ main ]
|
13
|
-
pull_request:
|
14
|
-
branches: [ main ]
|
15
|
-
|
16
|
-
jobs:
|
17
|
-
test:
|
18
|
-
|
19
|
-
runs-on: ubuntu-latest
|
20
|
-
strategy:
|
21
|
-
matrix:
|
22
|
-
ruby-version: ['2.6', '2.7', '3.0']
|
23
|
-
|
24
|
-
steps:
|
25
|
-
- uses: actions/checkout@v2
|
26
|
-
- name: Set up Ruby
|
27
|
-
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
28
|
-
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
29
|
-
# uses: ruby/setup-ruby@v1
|
30
|
-
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
|
31
|
-
with:
|
32
|
-
ruby-version: ${{ matrix.ruby-version }}
|
33
|
-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
34
|
-
- name: Run tests and publish code coverage
|
35
|
-
uses: paambaati/codeclimate-action@v2.7.5
|
36
|
-
env:
|
37
|
-
CC_TEST_REPORTER_ID: 9c690ab71ab481ac45785c4010ff30f93a45774e5ad6f03ec448b6e2b5bc39b4
|
38
|
-
with:
|
39
|
-
coverageCommand: bundle exec rake
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2021 Thomas Hutterer
|
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
|
13
|
-
all 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
|
21
|
-
THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
# Initials [![Maintainability](https://api.codeclimate.com/v1/badges/fb865ec4adcd0671dc48/maintainability)](https://codeclimate.com/github/thutterer/initials/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/fb865ec4adcd0671dc48/test_coverage)](https://codeclimate.com/github/thutterer/initials/test_coverage)
|
2
|
-
|
3
|
-
Don't want to implement user avatar uploads but still have basic avatars to distinguish users and brigthen up your app?
|
4
|
-
|
5
|
-
Use colorful SVGs as user avatars in any Ruby and Rails application.
|
6
|
-
|
7
|
-
![demo](demo.png)
|
8
|
-
|
9
|
-
## Installation
|
10
|
-
|
11
|
-
Add this line to your application's Gemfile:
|
12
|
-
|
13
|
-
```ruby
|
14
|
-
gem 'initials'
|
15
|
-
```
|
16
|
-
|
17
|
-
And then execute:
|
18
|
-
|
19
|
-
$ bundle
|
20
|
-
|
21
|
-
Or install it yourself as:
|
22
|
-
|
23
|
-
$ gem install initials
|
24
|
-
|
25
|
-
## Usage
|
26
|
-
|
27
|
-
Call `Initials.svg("Morty Smith")` anywhere to get a colorful initials avatar SVG as string.
|
28
|
-
The avatar's background color is based on the provided name and the font-size is adjusted to fit between one and three character initials.
|
29
|
-
|
30
|
-
### Rails
|
31
|
-
|
32
|
-
No special configuration is required to work with Ruby on Rails, but for your convinience, you can add this to your `app/helpers/application_helper.rb`:
|
33
|
-
|
34
|
-
```ruby
|
35
|
-
def user_avatar(name, **options)
|
36
|
-
Initials.svg(name, **options)
|
37
|
-
end
|
38
|
-
```
|
39
|
-
|
40
|
-
Now you can create SVGs in all views:
|
41
|
-
|
42
|
-
```erb
|
43
|
-
<%= user_avatar(current_user.name) %>
|
44
|
-
```
|
45
|
-
|
46
|
-
Initials automatically marks its created SVG strings as `html_safe`.
|
47
|
-
|
48
|
-
### Options
|
49
|
-
|
50
|
-
You can pass the following options into `Initials.svg` or your `user_avatar` helper:
|
51
|
-
|
52
|
-
```ruby
|
53
|
-
user_avatar(current_user.name,
|
54
|
-
colors: 8, # number of different colors, default: 12
|
55
|
-
limit: 1, # maximal initials length, default: 3
|
56
|
-
shape: :rect, # background shape, default: :cirlce
|
57
|
-
size: 96 # SVG height and width in pixel, default: 32
|
58
|
-
)
|
59
|
-
```
|
60
|
-
|
61
|
-
Of course, you can also use CSS to make the SVG have different sizes in different places of your HTML.
|
62
|
-
|
63
|
-
## Development
|
64
|
-
|
65
|
-
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.
|
66
|
-
|
67
|
-
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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
68
|
-
|
69
|
-
## Contributing
|
70
|
-
|
71
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/thutterer/initials.
|
72
|
-
|
73
|
-
## License
|
74
|
-
|
75
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "initials"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/demo.png
DELETED
Binary file
|
data/initials.gemspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require "initials/version"
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "initials"
|
8
|
-
spec.version = Initials::VERSION
|
9
|
-
spec.authors = ["Thomas Hutterer"]
|
10
|
-
spec.email = ["tohu@tuta.io"]
|
11
|
-
|
12
|
-
spec.summary = "Simple SVG avatars"
|
13
|
-
spec.description = "Use colorful SVGs as user avatars in any Ruby and Rails application."
|
14
|
-
spec.homepage = "https://github.com/thutterer/initials"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
# Specify which files should be added to the gem when it is released.
|
18
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
-
end
|
22
|
-
spec.bindir = "exe"
|
23
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
-
spec.require_paths = ["lib"]
|
25
|
-
|
26
|
-
spec.add_development_dependency "bundler"
|
27
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
29
|
-
end
|