grp 0.1.2

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.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/grp +81 -0
  3. data/lib/grp.rb +81 -0
  4. metadata +76 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c6c0290d0aaf697795289ed805902e98ffc3242297c448f80192c901da07afd1
4
+ data.tar.gz: a3073f3978f3f6f09e6e7ef604785c66e42c0a51053d8ad53dbe7cefd3f07b3a
5
+ SHA512:
6
+ metadata.gz: 0c05dfa177edb57b1ccb6b75e0d5f5ee25e4691404edd1a4ba414008f6bda499876ec79d3142d09abcf4aedb8bb114227fcad6ee53efe07feeb8105f857f7203
7
+ data.tar.gz: fb8c61c8437bc28fdd02f4f4c2f36fcb90a17f81dd9786aa6e8e4d7bd9afd0183c19c4d01cbef3fd618e11fd434ed5fecbf0e169c1fbe44a3c6b7e0318763c80
data/bin/grp ADDED
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ require "colorize"
4
+ require "optparse"
5
+
6
+ module Grp
7
+ class Install
8
+ def self.ask_and_download
9
+ puts "Git repository: (username/repo)".colorize(:grey)
10
+ repo_input = gets.chomp
11
+ username, repo = repo_input.split("/", 2)
12
+ unless username && repo
13
+ puts "Invalid format. Use username/repo.".colorize(:red)
14
+ exit
15
+ end
16
+ puts "==> Installing #{repo_input}...".colorize(:green)
17
+ begin
18
+ success = system("git clone -q https://github.com/#{username}/#{repo} #{repo}")
19
+ unless success
20
+ puts "Repository not found or clone failed.".colorize(:red)
21
+ exit
22
+ end
23
+ rescue => e
24
+ puts "An error occurred: #{e.message}".colorize(:red)
25
+ exit
26
+ end
27
+ puts "==> Repository downloaded!".colorize(:green)
28
+ system("cd #{repo}")
29
+ puts "==> Trying to find a install.grp in #{repo}".colorize(:green)
30
+ if File.exist?(File.join(repo, "install.grp"))
31
+ puts "install.grp found in #{repo}".colorize(:green)
32
+ puts "==> Installing #{repo}..."
33
+ system("ruby install.grp")
34
+ else
35
+ puts "install.grp not found in #{repo}".colorize(:red)
36
+ end
37
+ exit
38
+ end
39
+
40
+ def self.newinstall
41
+ puts "==> Creating a new install.grp in your current directory #{`pwd`.strip}".colorize(:green)
42
+ system("wget -q https://raw.githubusercontent.com/southernclaim/grp/refs/heads/main/example/install.grp")
43
+ exit
44
+ end
45
+ end
46
+ class Error < StandardError; end
47
+ options = {}
48
+
49
+ OptionParser.new do |opts|
50
+ opts.banner = "Usage: grp [options]".colorize(:green)
51
+
52
+ opts.on("-h", "--help", "Show this help message") do
53
+ puts opts
54
+ exit
55
+ end
56
+
57
+ opts.on("-v", "--version", "Show program version") do
58
+ options[:version] = true
59
+ end
60
+
61
+ opts.on("-i", "--install", "Install a program from a git repo") do
62
+ Install::ask_and_download
63
+ end
64
+
65
+ opts.on("-n", "--new", "Create a new ./install.grp in your current directory") do
66
+ Install::newinstall
67
+ end
68
+
69
+ opts.separator ""
70
+ opts.separator "You are using GRP!".colorize(:green)
71
+
72
+ end.parse!
73
+
74
+ if options[:version]
75
+ puts "Version 0.1.2"
76
+ exit
77
+ end
78
+
79
+ puts "Selected options: #{options}" unless options.empty?
80
+ puts "No options provided. Use -h for help." if options.empty? && ARGV.empty?
81
+ end
data/lib/grp.rb ADDED
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+ require "colorize"
3
+ require_relative "grp/version"
4
+ require "optparse"
5
+
6
+ module Grp
7
+ class Install
8
+ def self.ask_and_download
9
+ puts "Git repository: (username/repo)".colorize(:grey)
10
+ repo_input = gets.chomp
11
+ username, repo = repo_input.split("/", 2)
12
+ unless username && repo
13
+ puts "Invalid format. Use username/repo.".colorize(:red)
14
+ exit
15
+ end
16
+ puts "==> Installing #{repo_input}...".colorize(:green)
17
+ begin
18
+ success = system("git clone -q https://github.com/#{username}/#{repo} #{repo}")
19
+ unless success
20
+ puts "Repository not found or clone failed.".colorize(:red)
21
+ exit
22
+ end
23
+ rescue => e
24
+ puts "An error occurred: #{e.message}".colorize(:red)
25
+ exit
26
+ end
27
+ puts "==> Repository downloaded!".colorize(:green)
28
+ system("cd #{repo}")
29
+ puts "==> Trying to find a install.grp in #{repo}".colorize(:green)
30
+ if File.exist?(File.join(repo, "install.grp"))
31
+ puts "install.grp found in #{repo}".colorize(:green)
32
+ puts "==> Installing #{repo}..."
33
+ system("ruby install.grp")
34
+ else
35
+ puts "install.grp not found in #{repo}".colorize(:red)
36
+ end
37
+ exit
38
+ end
39
+
40
+ def self.newinstall
41
+ puts "==> Creating a new install.grp in your current directory #{`pwd`.strip}".colorize(:green)
42
+ system("wget -q https://raw.githubusercontent.com/southernclaim/grp/refs/heads/main/example/install.grp")
43
+ exit
44
+ end
45
+ end
46
+ class Error < StandardError; end
47
+ options = {}
48
+
49
+ OptionParser.new do |opts|
50
+ opts.banner = "Usage: grp [options]".colorize(:green)
51
+
52
+ opts.on("-h", "--help", "Show this help message") do
53
+ puts opts
54
+ exit
55
+ end
56
+
57
+ opts.on("-v", "--version", "Show program version") do
58
+ options[:version] = true
59
+ end
60
+
61
+ opts.on("-i", "--install", "Install a program from a git repo") do
62
+ Install::ask_and_download
63
+ end
64
+
65
+ opts.on("-n", "--new", "Create a new ./install.grp in your current directory") do
66
+ Install::newinstall
67
+ end
68
+
69
+ opts.separator ""
70
+ opts.separator "You are using GRP!".colorize(:green)
71
+
72
+ end.parse!
73
+
74
+ if options[:version]
75
+ puts "Version 0.1.2"
76
+ exit
77
+ end
78
+
79
+ puts "Selected options: #{options}" unless options.empty?
80
+ puts "No options provided. Use -h for help." if options.empty? && ARGV.empty?
81
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: grp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - Iago Dórea
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2025-05-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: optparse
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: colorize
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Install programs hosted in github faster with grp
42
+ email:
43
+ - iagodorea@proton.me
44
+ executables:
45
+ - grp
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - bin/grp
50
+ - lib/grp.rb
51
+ homepage: https://github.com/southernclaim/grp
52
+ licenses: []
53
+ metadata:
54
+ homepage_uri: https://github.com/southernclaim/grp
55
+ source_code_uri: https://github.com/southernclaim/grp
56
+ changelog_uri: https://github.com/southernclaim/grp/blob/main/CHANGELOG.md
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 3.1.0
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubygems_version: 3.3.27
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: A Github Repository Installer
76
+ test_files: []