Sha256: dd995785ea8283df76ac6aa1ad66850112cd5e0363c9fcbb5966d9f8ffcde88d

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

module InstallGemLocal
  class Action
    class << self
      def remove_gem
        cmd = TTY::Command.new
        file = cmd.run('find -type f -name "*.gem"')
        ap file_name = file.out.strip
        file_name.empty? ? ap('Gem not exist') : cmd.run("rm #{file_name}")

      rescue StandardError => e
        ap e
        ap 'Something Wrong! Try again!'
      end

      def build_gem
        puts '-----------------------------'
        puts ''
        cmd = TTY::Command.new
        file = cmd.run('find -type f -name "*.gemspec"')
        ap file_name = file.out.strip
        file_name.empty? ? ap('Gemspec not exist') : cmd.run("gem build #{file_name}")

      rescue StandardError => e
        ap e
        ap 'Something Wrong! Try again!'
      end

      def install_gem
        puts '-----------------------------'
        puts ''
        cmd = TTY::Command.new
        file = cmd.run('find -type f -name "*.gem"')
        ap file_name = file.out.strip
        file_name.empty? ? ap('Gem not exist') : cmd.run("gem install #{file_name}")

      rescue StandardError => e
        ap e
        ap 'Something Wrong! Try again!'
      end

      def aoa
        remove_gem
        build_gem
        install_gem
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
install_gem_local-0.1.3 lib/install_gem_local/action.rb
install_gem_local-0.1.2 lib/install_gem_local/action.rb