ruby_on_asteroids 0.1.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8f1e794683e45f44361b34d7a7e77a19a7d7b86b7c0bfd10ec92e02589f729b0
4
+ data.tar.gz: 9ec1d342ebe6b48bb70f24cda0862e0a96fa23285de3f4ec2980c8c5ce76a67d
5
+ SHA512:
6
+ metadata.gz: 0403abb5f7d70ed91255c8bde5fe01c9f401f968cac0d2aca9f38ecd35197e29542aa7d970c667134c1780694fc2538644dc65a39aac9458fda96aa90db73fa8
7
+ data.tar.gz: 304593a7702a666d12de20667ae20876dc67368a7b2be9ab360481ee7ecde7b3a249b46f8117074cffef215243a98c17f207d373bc1539fb498237e57670b74c
data/.overcommit.yml ADDED
@@ -0,0 +1,37 @@
1
+ # Use this file to configure the Overcommit hooks you wish to use. This will
2
+ # extend the default configuration defined in:
3
+ # https://github.com/sds/overcommit/blob/master/config/default.yml
4
+ #
5
+ # At the topmost level of this YAML file is a key representing type of hook
6
+ # being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
7
+ # customize each hook, such as whether to only run it on certain files (via
8
+ # `include`), whether to only display output if it fails (via `quiet`), etc.
9
+ #
10
+ # For a complete list of hooks, see:
11
+ # https://github.com/sds/overcommit/tree/master/lib/overcommit/hook
12
+ #
13
+ # For a complete list of options that you can use to customize hooks, see:
14
+ # https://github.com/sds/overcommit#configuration
15
+ #
16
+ # Uncomment the following lines to make the configuration take effect.
17
+
18
+ PreCommit:
19
+ RuboCop:
20
+ enabled: true
21
+ on_warn: fail # Treat all warnings as failures
22
+ flags: [ '--auto-correct', '--format=progress', '--display-style-guide', '--force-exclusion', '--display-cop-names' ]
23
+ command: ['bundle', 'exec', 'rubocop', '--fail-level=autocorrect']
24
+
25
+
26
+ #
27
+ # TrailingWhitespace:
28
+ # enabled: true
29
+ # exclude:
30
+ # - '**/db/structure.sql' # Ignore trailing whitespace in generated files
31
+ #
32
+ #PostCheckout:
33
+ # ALL: # Special hook name that customizes all hooks of this type
34
+ # quiet: true # Change all post-checkout hooks to only display output on failure
35
+ #
36
+ # IndexTags:
37
+ # enabled: true # Generate a tags file with `ctags` each time HEAD changes
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,37 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rspec
4
+ - rubocop-thread_safety
5
+
6
+ AllCops:
7
+ TargetRubyVersion: 2.4
8
+ NewCops: enable
9
+
10
+ # Exclude files that contain purely declarative DSLs
11
+ # see https://stackoverflow.com/a/41187163 for more details
12
+ Metrics/BlockLength:
13
+ Exclude:
14
+ - 'Rakefile'
15
+ - '**/*.rake'
16
+ - 'spec/**/*.rb'
17
+ - '*.gemspec'
18
+
19
+ # I don't like the approach of forcing the first describe block to point to a class. In some cases specs are more
20
+ # flexible if they describe an abstract behavior rather than a specific class
21
+ RSpec/DescribeClass:
22
+ Enabled: false
23
+
24
+ # I like the idea of restricting the amount of nested groups, but 3 seems too low
25
+ RSpec/NestedGroups:
26
+ Max: 5
27
+
28
+ Style/StringLiterals:
29
+ Enabled: true
30
+ EnforcedStyle: double_quotes
31
+
32
+ Style/StringLiteralsInInterpolation:
33
+ Enabled: true
34
+ EnforcedStyle: double_quotes
35
+
36
+ Layout/LineLength:
37
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ ### 0.1.1 / 2022-01-28
2
+
3
+ Initial release of the gem
4
+
5
+ Features
6
+ * Enhance `String` objects by adding `but_last` method
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in ruby_on_asteroids.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 MatiasFernandez
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 ADDED
@@ -0,0 +1,64 @@
1
+ # RubyOnAsteroids
2
+
3
+ A gem with useful tools to expand Ruby language and make it more powerful
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'ruby_on_asteroids'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install ruby_on_asteroids
20
+
21
+ ## Available enhancements
22
+
23
+ ### String
24
+
25
+ - [`but_last`](lib/ruby_on_asteroids/core_ext/string/accessing.rb): Return a copy of the string without the
26
+ last # of characters requested.
27
+
28
+ ## Usage
29
+
30
+ The gem is designed to provide only the enhancements you ask for, that means by default we won't auto-load classes
31
+ that are not needed, nor apply enhancements you didn't ask for.
32
+
33
+ To enable enhancements you need to first load the gem:
34
+
35
+ ``` ruby
36
+ require "ruby_on_asteroids"
37
+ ```
38
+
39
+ and then enable the enhancements you want
40
+
41
+ ``` ruby
42
+ RubyOnAsteroids.enhance_strings
43
+ ```
44
+
45
+ **Tip:** If you use `pry` gem as a Ruby REPL you can enable the enhancements in your
46
+ [`.pryrc`](https://github.com/pry/pry#overview) file in your home directory to benefit from the enhancements during
47
+ your REPL sessions even if the gem is not installed in your project.
48
+
49
+ ## Development
50
+
51
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
52
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
53
+
54
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
55
+ version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version,
56
+ push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
57
+
58
+ ## Contributing
59
+
60
+ Bug reports and pull requests are welcome on GitHub at https://github.com/10pines/ruby_on_asteroids.
61
+
62
+ ## License
63
+
64
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "ruby_on_asteroids"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyOnAsteroids
4
+ module CoreExt
5
+ module String
6
+ # Useful extensions to String class related to accessing the string content
7
+ module Accessing
8
+ # Returns a copy of the original string object with the last `num_of_characters` being removed.
9
+ # If `num_of_characters` is not provided, it defaults to removing the last character.
10
+ # When the original string is empty, returns an empty string
11
+ def but_last(num_of_characters = 1)
12
+ self[0..-(1 + num_of_characters)]
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyOnAsteroids
4
+ VERSION = "0.1.1"
5
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "ruby_on_asteroids/version"
4
+
5
+ # I'm the root module of the gem. I provide useful methods to enable enhancements
6
+ module RubyOnAsteroids
7
+ class Error < StandardError; end
8
+
9
+ # Apply patches to the String class to enhance it by adding new methods
10
+ def enhance_strings
11
+ require "ruby_on_asteroids/core_ext/string/accessing"
12
+
13
+ String.include RubyOnAsteroids::CoreExt::String::Accessing
14
+ end
15
+
16
+ module_function :enhance_strings
17
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/ruby_on_asteroids/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "ruby_on_asteroids"
7
+ spec.version = RubyOnAsteroids::VERSION
8
+ spec.authors = ["MatiasFernandez"]
9
+ spec.email = ["mfernandez@10pines.com"]
10
+
11
+ spec.summary = "A gem with useful tools to expand Ruby language and make it more powerful."
12
+ spec.homepage = "https://github.com/10Pines/ruby_on_asteroids"
13
+ spec.license = "MIT"
14
+ spec.required_ruby_version = ">= 2.4.0"
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = "https://github.com/10Pines/ruby_on_asteroids"
18
+ spec.metadata["changelog_uri"] = "https://github.com/10Pines/ruby_on_asteroids/blob/main/CHANGELOG.md"
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
+ `git ls-files -z`.split("\x0").reject do |f|
24
+ (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
25
+ end
26
+ end
27
+ spec.bindir = "exe"
28
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ["lib"]
30
+
31
+ spec.add_development_dependency "overcommit", "~> 0.58"
32
+ spec.add_development_dependency "pry", "~> 0.14"
33
+ spec.add_development_dependency "rake", "~> 13.0"
34
+ spec.add_development_dependency "rspec", "~> 3.0"
35
+ spec.add_development_dependency "rubocop", "~> 1.12.0"
36
+ spec.add_development_dependency "rubocop-performance", "~> 1.10"
37
+ spec.add_development_dependency "rubocop-rake", "~> 0.5"
38
+ spec.add_development_dependency "rubocop-rspec", "~> 2.2"
39
+ spec.add_development_dependency "rubocop-thread_safety", "~> 0.4"
40
+ end
metadata ADDED
@@ -0,0 +1,186 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby_on_asteroids
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - MatiasFernandez
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-01-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: overcommit
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.58'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.58'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.14'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.14'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '13.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '13.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.12.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.12.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-performance
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.10'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.10'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.5'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.5'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.2'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.2'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-thread_safety
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.4'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.4'
139
+ description:
140
+ email:
141
+ - mfernandez@10pines.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - ".overcommit.yml"
147
+ - ".rspec"
148
+ - ".rubocop.yml"
149
+ - CHANGELOG.md
150
+ - Gemfile
151
+ - LICENSE.txt
152
+ - README.md
153
+ - Rakefile
154
+ - bin/console
155
+ - bin/setup
156
+ - lib/ruby_on_asteroids.rb
157
+ - lib/ruby_on_asteroids/core_ext/string/accessing.rb
158
+ - lib/ruby_on_asteroids/version.rb
159
+ - ruby_on_asteroids.gemspec
160
+ homepage: https://github.com/10Pines/ruby_on_asteroids
161
+ licenses:
162
+ - MIT
163
+ metadata:
164
+ homepage_uri: https://github.com/10Pines/ruby_on_asteroids
165
+ source_code_uri: https://github.com/10Pines/ruby_on_asteroids
166
+ changelog_uri: https://github.com/10Pines/ruby_on_asteroids/blob/main/CHANGELOG.md
167
+ post_install_message:
168
+ rdoc_options: []
169
+ require_paths:
170
+ - lib
171
+ required_ruby_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: 2.4.0
176
+ required_rubygems_version: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ requirements: []
182
+ rubygems_version: 3.2.3
183
+ signing_key:
184
+ specification_version: 4
185
+ summary: A gem with useful tools to expand Ruby language and make it more powerful.
186
+ test_files: []