Total Blog Views: 116
Blog Status: publish
Created By: swaz_ahmed Created at: 06-23-2024
There are several gems as follows:
Generate the Gem Skeleton: Use the Bundler gem to generate a new gem skeleton.
Run: bundle gem hello_world_gem
bundle gem hello_world_gem
File Structure:
Implement the Code :
module HelloWorldGem def self.say_hello puts “Hello,World!” end end
Setup the .gemspec configration:
require_relative "lib/hello_world_gem/version" Gem::Specification.new do |spec| spec.name = "hello_world_gem" spec.version = HelloWorldGem::VERSION spec.authors = ["test test"] spec.email = ["[email protected]"] spec.summary = "Print the HelloWorld" spec.description = "Print the HelloWorld" spec.homepage = "https://github.com/test/hello_world_gem" spec.required_ruby_version = ">= 2.6.0" spec.metadata["allowed_push_host"] = "https://rubygems.org" spec.metadata["homepage_uri"] = spec.homepage spec.metadata["source_code_uri"] = "https://github.com/test/two_factor_auth_gem" spec.metadata["changelog_uri"] = "https://github.com/test/two_factor_auth_gem/blob/main/CHANGELOG.md" #Specify which file should be added to the gem when it is released. #The 'git ls-files -z' loads the files in the RubyGem that have been added into git. spec.files = Dir.chdir(_dir_) do 'git ls-files -z'.split("\x0").reject do |f| (File.expand_path(f) == _FILE_) || f.start_with?(*%w[bin/ test/ spec/ featues/ .git .circleci appveyor Gemfile]) end end spec.bindir = "exe" spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] end
Gem Build:
gem build hello_world_gem.gemspec
Step 1: Create the account on the rubygem.org
Step2: Navigate your gem directory
Step 3: Run: gem signin Add your credentials and make sure show_dashboard is enable
Step 4: Push : gem push hello_world_gem-0.1.0.gem
gem signin Enter your RubyGems.org credentilas. Don't have an account yet? Create one at https://rubygems.org/sign_up Email: test@gmailccom Password:
we have the “Get things executed” lifestyle at our place of work. There are not any excuses, no if’s or however’s in our dictionary. committed to navigating the ship of creativity to create cell answers, we resolve the real-lifestyles troubles of our clients and their clients. Our passion for work has won us many awards, year after 12 months.
© Copyright Shadbox. All Rights Reserved
Rate Blog :
Share on :
Do you have any blog suggestion? please click on the link