Skip to content

Commit

Permalink
Added Ruby gem compatibility (#3)
Browse files Browse the repository at this point in the history
### Description 

This PR resolved #1 and added the `secure-keys.gemspec` file adding the
ruby gem compatibilty.

Currently, the gem is published officially on [Ruby gem
page](https://rubygems.org/gems/secure-keys).

To install the gem, run the following commands:

```bash
gem install secure-keys
```

or using bundler:

```ruby
# Gemfile

gem 'secure-keys'
```

Install dependencies:

```bash
bundle install
```

### Medias (if needed)

<img width="958" alt="image"
src="https://github.com/user-attachments/assets/b3a8f771-6aad-49d1-85b8-a0dc6a7885e3"
/>

### Testplan

- [x] I tested this change on my local environment.
- [ ] I ran the unit tests.

### Checklist

- [ ] I added tests for this change.
- [x] I checked the code style and run the linter.
- [x] I added necessary documentation (if applicable).
  • Loading branch information
derian-cordoba authored Feb 16, 2025
1 parent bbcc09f commit 83affc0
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

# XCFramework files
.keys/

# Gem files
secure-keys-*.gem
6 changes: 1 addition & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,4 @@ source 'https://rubygems.org'

ruby file: '.ruby-version'

gem 'base64'
gem 'digest'
gem 'json'
gem 'osx_keychain'
gem 'rubocop', require: false
gemspec path: '.'
16 changes: 11 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
PATH
remote: .
specs:
secure-keys (1.0.3)
base64 (~> 0.2.0)
digest (~> 3.2.0)
json (~> 2.10.1)
osx_keychain (~> 1.0.2)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -40,11 +49,8 @@ PLATFORMS
ruby

DEPENDENCIES
base64
digest
json
osx_keychain
rubocop
rubocop (~> 1.71.2)
secure-keys!

RUBY VERSION
ruby 3.3.6p108
Expand Down
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,22 @@ Utility to generate a `xcframework` for handling secure keys in iOS projects.

### Installation

Install gems using bundler
You can install the `Keys` utility using `gem` command:

```bash
bundle install
gem install secure-keys
```

If you don't have bundler installed, you can install it using:
If you using `bundler` you can add the `secure-keys` gem to the `Gemfile`:

```ruby
gem 'secure-keys'
```

Then, you can install the gem using:

```bash
gem install bundler
bundle install
```

## Usage
Expand Down Expand Up @@ -95,10 +101,18 @@ export SECURE_KEYS_IDENTIFIER="github-token|api_key|firebaseToken"

### Ruby script

To generate the `Keys.xcframework` use the `keys.rb` script with:
To generate the `Keys.xcframework` use the `secure-keys` command in the iOS project root directory.

Using global gem:

```bash
secure-keys
```

Using bundler:

```bash
bundle exec ruby ./bin/keys.rb
bundle exec secure-keys
```

### iOS project
Expand Down
0 bin/keys.rb → bin/secure-keys
100644 → 100755
File renamed without changes.
3 changes: 2 additions & 1 deletion lib/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby

module Keys
VERSION = '1.0.0'.freeze
VERSION = '1.0.3'.freeze
SUMMARY = 'Keys is a simple tool for managing your secret keys'.freeze
DESCRIPTION = 'Keys is a simple tool to manage your secret keys in iOS your project'.freeze
end
37 changes: 37 additions & 0 deletions secure-keys.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env ruby

lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

require "#{Dir.pwd}/lib/version"

Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 3.3'
spec.required_rubygems_version = Gem::Requirement.new('>= 0'.freeze) if spec.respond_to? :required_rubygems_version=

spec.name = 'secure-keys'
spec.version = Keys::VERSION
spec.authors = ['Derian Córdoba']
spec.email = ['derianricardo451@gmail.com']
spec.summary = Keys::SUMMARY
spec.description = Keys::DESCRIPTION
spec.license = 'MIT'
spec.homepage = 'https://github.com/DerianCordobaPerez/secure-keys-generator'
spec.bindir = 'bin'
spec.require_paths = %w[*/lib]
spec.platform = Gem::Platform::RUBY

spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = spec.homepage
spec.metadata['changelog_uri'] = "#{spec.homepage}/releases"

spec.files = Dir.glob('*/lib/**/*',
File::FNM_DOTMATCH) + Dir['bin/*'] + Dir['*/README.md'] + %w[README.md]
spec.executables = spec.files.grep(%r{^bin/}) { |file| File.basename(file) }

spec.add_runtime_dependency 'base64', '~> 0.2.0'
spec.add_runtime_dependency 'digest', '~> 3.2.0'
spec.add_runtime_dependency 'json', '~> 2.10.1'
spec.add_runtime_dependency 'osx_keychain', '~> 1.0.2'
spec.add_development_dependency 'rubocop', '~> 1.71.2'
end

0 comments on commit 83affc0

Please sign in to comment.