ronin-repos 0.1.0.beta1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +15 -0
- data/.rubocop.yml +17 -0
- data/.yardopts +1 -1
- data/ChangeLog.md +13 -1
- data/Gemfile +7 -3
- data/README.md +2 -1
- data/Rakefile +2 -2
- data/bin/ronin-repos +7 -8
- data/data/templates/repo/README.md.erb +1 -1
- data/gemspec.yml +2 -2
- data/lib/ronin/repos/cache_dir.rb +6 -7
- data/lib/ronin/repos/class_dir.rb +18 -12
- data/lib/ronin/repos/cli/command.rb +5 -3
- data/lib/ronin/repos/cli/commands/install.rb +6 -2
- data/lib/ronin/repos/cli/commands/list.rb +1 -1
- data/lib/ronin/repos/cli/commands/new.rb +2 -2
- data/lib/ronin/repos/cli/commands/purge.rb +16 -1
- data/lib/ronin/repos/cli/commands/remove.rb +1 -1
- data/lib/ronin/repos/cli/commands/update.rb +1 -1
- data/lib/ronin/repos/cli.rb +6 -1
- data/lib/ronin/repos/exceptions.rb +4 -4
- data/lib/ronin/repos/repository.rb +4 -4
- data/lib/ronin/repos/root.rb +1 -1
- data/lib/ronin/repos/version.rb +2 -2
- data/lib/ronin/repos.rb +5 -5
- data/man/ronin-repos-install.1 +16 -12
- data/man/ronin-repos-install.1.md +13 -10
- data/man/ronin-repos-list.1 +16 -12
- data/man/ronin-repos-list.1.md +13 -10
- data/man/ronin-repos-new.1 +5 -1
- data/man/ronin-repos-new.1.md +30 -0
- data/man/ronin-repos-purge.1 +16 -12
- data/man/ronin-repos-purge.1.md +13 -10
- data/man/ronin-repos-remove.1 +12 -12
- data/man/ronin-repos-remove.1.md +10 -10
- data/man/ronin-repos-update.1 +16 -12
- data/man/ronin-repos-update.1.md +13 -10
- data/man/ronin-repos.1 +36 -10
- data/man/ronin-repos.1.md +28 -8
- data/ronin-repos.gemspec +6 -4
- metadata +8 -26
- data/spec/cache_dir_spec.rb +0 -272
- data/spec/class_dir_spec.rb +0 -97
- data/spec/fixtures/cache/repo1/dir/file1.txt +0 -0
- data/spec/fixtures/cache/repo1/file1.txt +0 -0
- data/spec/fixtures/cache/repo1/file2.txt +0 -0
- data/spec/fixtures/cache/repo2/dir/file1.txt +0 -0
- data/spec/fixtures/cache/repo2/dir/file2.txt +0 -0
- data/spec/fixtures/cache/repo2/file1.txt +0 -0
- data/spec/fixtures/cache/repo2/file2.txt +0 -0
- data/spec/fixtures/cache/repo2/only-exists-in-repo2.txt +0 -0
- data/spec/fixtures/class_dir/file1.rb +0 -0
- data/spec/fixtures/class_dir/file2.rb +0 -0
- data/spec/fixtures/class_dir/only_in_class_dir.rb +0 -0
- data/spec/repos_spec.rb +0 -67
- data/spec/repository_spec.rb +0 -415
- data/spec/spec_helper.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f165cb9c5c8eda828d18f33114a9407ccae14fb6d5a7edc84fbc5159ba26aad
|
4
|
+
data.tar.gz: 6518e8a7dc2b29c778bf82d8ce32efc692e85b0d3ab108f3575724181b689bd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a827887a127c7a8165087e71cd3e8098b154f1ecd72dd0136f66ef640562db59a401ded921ac74877a981974ab16570cc431850f12f8d184291b5834c9d998d
|
7
|
+
data.tar.gz: 4c6e43043c8a93b69b0f55a1a8016e6014e4343b338b90b9a85d6cc9477b93f8c413d5e3d98bf71bf39115731a13bdfc4e3a46e2d40aa9302029089edf502b6c
|
data/.github/workflows/ruby.yml
CHANGED
@@ -21,7 +21,22 @@ jobs:
|
|
21
21
|
uses: ruby/setup-ruby@v1
|
22
22
|
with:
|
23
23
|
ruby-version: ${{ matrix.ruby }}
|
24
|
+
bundler-cache: true
|
24
25
|
- name: Install dependencies
|
25
26
|
run: bundle install --jobs 4 --retry 3
|
26
27
|
- name: Run tests
|
27
28
|
run: bundle exec rake test
|
29
|
+
|
30
|
+
# rubocop linting
|
31
|
+
rubocop:
|
32
|
+
runs-on: ubuntu-latest
|
33
|
+
steps:
|
34
|
+
- uses: actions/checkout@v2
|
35
|
+
- name: Set up Ruby
|
36
|
+
uses: ruby/setup-ruby@v1
|
37
|
+
with:
|
38
|
+
ruby-version: 3.0
|
39
|
+
- name: Install dependencies
|
40
|
+
run: bundle install --jobs 4 --retry 3
|
41
|
+
- name: Run rubocop
|
42
|
+
run: bundle exec rubocop --parallel
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
AllCops:
|
2
|
+
NewCops: enable
|
3
|
+
SuggestExtensions: false
|
4
|
+
TargetRubyVersion: 3.1
|
5
|
+
|
6
|
+
inherit_gem:
|
7
|
+
rubocop-ronin: rubocop.yml
|
8
|
+
|
9
|
+
#
|
10
|
+
# ronin-repos specific exceptions
|
11
|
+
#
|
12
|
+
|
13
|
+
Lint/EmptyFile:
|
14
|
+
Exclude:
|
15
|
+
- 'spec/fixtures/class_dir/file1.rb'
|
16
|
+
- 'spec/fixtures/class_dir/file2.rb'
|
17
|
+
- 'spec/fixtures/class_dir/only_in_class_dir.rb'
|
data/.yardopts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
--markup markdown --title 'Ronin
|
1
|
+
--markup markdown --title 'Ronin::Repos Documentation' --protected
|
data/ChangeLog.md
CHANGED
@@ -1,4 +1,16 @@
|
|
1
|
-
### 0.1.
|
1
|
+
### 0.1.1 / 2023-06-09
|
2
|
+
|
3
|
+
* Fixed a bug in {Ronin::Repos::ClassDir::ClassMethods#list_files} where the
|
4
|
+
{Ronin::Repos::ClassDir::ClassMethods#repo_class_dir repo_class_dir} was not
|
5
|
+
being removed from paths.
|
6
|
+
* Documentation fixes and improvements.
|
7
|
+
|
8
|
+
#### CLI
|
9
|
+
|
10
|
+
* Multiple bug fixes to the `ronin-repos install` command.
|
11
|
+
* Add missing man-page for the `ronin-repos new` command.
|
12
|
+
|
13
|
+
### 0.1.0 / 2023-02-01
|
2
14
|
|
3
15
|
* Initial release:
|
4
16
|
* Supports installing any [Git][git] repository.
|
data/Gemfile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
gemspec
|
@@ -7,7 +9,7 @@ platform :jruby do
|
|
7
9
|
end
|
8
10
|
|
9
11
|
# Ronin dependencies:
|
10
|
-
# gem 'ronin-core', '~> 0.1', github:
|
12
|
+
# gem 'ronin-core', '~> 0.1', github: 'ronin-rb/ronin-core',
|
11
13
|
# branch: 'main'
|
12
14
|
|
13
15
|
# gem 'command_kit', '~> 0.4', github: 'postmodern/command_kit.rb',
|
@@ -27,6 +29,8 @@ group :development do
|
|
27
29
|
gem 'yard-spellcheck', require: false
|
28
30
|
|
29
31
|
gem 'dead_end', require: false
|
30
|
-
gem 'sord', require: false,
|
31
|
-
gem 'stackprof', require: false,
|
32
|
+
gem 'sord', require: false, platform: :mri
|
33
|
+
gem 'stackprof', require: false, platform: :mri
|
34
|
+
gem 'rubocop', require: false, platform: :mri
|
35
|
+
gem 'rubocop-ronin', require: false, platform: :mri
|
32
36
|
end
|
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
[![CI](https://github.com/ronin-rb/ronin-repos/actions/workflows/ruby.yml/badge.svg)](https://github.com/ronin-rb/ronin-repos/actions/workflows/ruby.yml)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/ronin-rb/ronin-repos.svg)](https://codeclimate.com/github/ronin-rb/ronin-repos)
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/ronin-repos.svg)](https://badge.fury.io/rb/ronin-repos)
|
5
6
|
|
6
7
|
* [Website](https://ronin-rb.dev)
|
7
8
|
* [Source](https://github.com/ronin-rb/ronin-repos)
|
@@ -137,7 +138,7 @@ gem 'ronin-repos', '~> 0.1'
|
|
137
138
|
|
138
139
|
## License
|
139
140
|
|
140
|
-
Copyright (c) 2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
141
|
+
Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
141
142
|
|
142
143
|
ronin-repos is free software: you can redistribute it and/or modify
|
143
144
|
it under the terms of the GNU Lesser General Public License as published
|
data/Rakefile
CHANGED
data/bin/ronin-repos
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
#
|
3
|
-
# Copyright (c) 2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
5
|
#
|
5
6
|
# This file is part of ronin-repos.
|
6
7
|
#
|
@@ -21,13 +22,11 @@
|
|
21
22
|
root = File.expand_path(File.join(__dir__,'..'))
|
22
23
|
if File.file?(File.join(root,'Gemfile.lock'))
|
23
24
|
Dir.chdir(root) do
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
exit -1
|
30
|
-
end
|
25
|
+
require 'bundler/setup'
|
26
|
+
rescue LoadError => e
|
27
|
+
warn e.message
|
28
|
+
warn "Run `gem install bundler` to install Bundler"
|
29
|
+
exit(-1)
|
31
30
|
end
|
32
31
|
end
|
33
32
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
This git repository can be installed by the [ronin-repos] command:
|
6
6
|
|
7
7
|
```shell
|
8
|
-
ronin-repos
|
8
|
+
ronin-repos install https://github.com/<%= @github_user %>/<%= @name %>.git
|
9
9
|
```
|
10
10
|
|
11
11
|
[ronin-repos]: https://github.com/ronin-rb/ronin-repos#readme
|
data/gemspec.yml
CHANGED
@@ -11,7 +11,7 @@ homepage: https://ronin-rb.dev
|
|
11
11
|
has_yard: true
|
12
12
|
|
13
13
|
metadata:
|
14
|
-
documentation_uri: https://
|
14
|
+
documentation_uri: https://ronin-rb.dev/docs/ronin-repos
|
15
15
|
source_code_uri: https://github.com/ronin-rb/ronin-repos
|
16
16
|
bug_tracker_uri: https://github.com/ronin-rb/ronin-repos/issues
|
17
17
|
changelog_uri: https://github.com/ronin-rb/ronin-repos/blob/main/ChangeLog.md
|
@@ -30,7 +30,7 @@ required_ruby_version: ">= 3.0.0"
|
|
30
30
|
|
31
31
|
dependencies:
|
32
32
|
# Library dependencies:
|
33
|
-
ronin-core: ~> 0.1
|
33
|
+
ronin-core: ~> 0.1
|
34
34
|
|
35
35
|
development_dependencies:
|
36
36
|
bundler: ~> 2.0
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
4
|
#
|
5
5
|
# ronin-repos is free software: you can redistribute it and/or modify
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
@@ -34,7 +34,7 @@ module Ronin
|
|
34
34
|
|
35
35
|
include Enumerable
|
36
36
|
|
37
|
-
# The
|
37
|
+
# The `~/.cache/ronin-repos/` directory where all repos are stored.
|
38
38
|
PATH = Core::Home.cache_dir('ronin-repos')
|
39
39
|
|
40
40
|
# The path to the cache directory.
|
@@ -52,7 +52,7 @@ module Ronin
|
|
52
52
|
@path = path
|
53
53
|
end
|
54
54
|
|
55
|
-
#
|
55
|
+
#
|
56
56
|
# Accesses a repository from the cache directory.
|
57
57
|
#
|
58
58
|
# @param [String] name
|
@@ -129,10 +129,9 @@ module Ronin
|
|
129
129
|
#
|
130
130
|
def update
|
131
131
|
each do |repo|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
end
|
132
|
+
repo.update
|
133
|
+
rescue CommandFailed
|
134
|
+
# ignore any `git` errors when updating
|
136
135
|
end
|
137
136
|
end
|
138
137
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
4
|
#
|
5
5
|
# ronin-repos is free software: you can redistribute it and/or modify
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
@@ -33,12 +33,12 @@ module Ronin
|
|
33
33
|
#
|
34
34
|
# require 'ronin/core/module_registry'
|
35
35
|
# require 'ronin/repos/class_dir'
|
36
|
-
#
|
36
|
+
#
|
37
37
|
# module Ronin
|
38
38
|
# module Exploits
|
39
39
|
# include Ronin::Core::ClassRegistry
|
40
40
|
# include Ronin::Repos::ClassDir
|
41
|
-
#
|
41
|
+
#
|
42
42
|
# class_dir "#{__dir__}/classes"
|
43
43
|
# repo_class_dir "exploits"
|
44
44
|
# end
|
@@ -49,11 +49,11 @@ module Ronin
|
|
49
49
|
# module Ronin
|
50
50
|
# module Exploits
|
51
51
|
# class Exploit
|
52
|
-
#
|
52
|
+
#
|
53
53
|
# def self.register(name)
|
54
54
|
# Exploits.register(name,self)
|
55
55
|
# end
|
56
|
-
#
|
56
|
+
#
|
57
57
|
# end
|
58
58
|
# end
|
59
59
|
# end
|
@@ -61,13 +61,13 @@ module Ronin
|
|
61
61
|
# `~/.cache/ronin-repos/repo1/exploits/my_exploit.rb`:
|
62
62
|
#
|
63
63
|
# require 'ronin/exploits/exploit'
|
64
|
-
#
|
64
|
+
#
|
65
65
|
# module Ronin
|
66
66
|
# module Exploits
|
67
67
|
# class MyExploit < Exploit
|
68
|
-
#
|
68
|
+
#
|
69
69
|
# register 'my_exploit'
|
70
|
-
#
|
70
|
+
#
|
71
71
|
# end
|
72
72
|
# end
|
73
73
|
# end
|
@@ -88,6 +88,9 @@ module Ronin
|
|
88
88
|
namespace.extend ClassMethods
|
89
89
|
end
|
90
90
|
|
91
|
+
#
|
92
|
+
# Class-methods.
|
93
|
+
#
|
91
94
|
module ClassMethods
|
92
95
|
#
|
93
96
|
# Gets or sets the repository module directory name.
|
@@ -97,7 +100,7 @@ module Ronin
|
|
97
100
|
#
|
98
101
|
# @return [String]
|
99
102
|
# The repository module directory name.
|
100
|
-
#
|
103
|
+
#
|
101
104
|
# @raise [NotImplementedError]
|
102
105
|
# The `repo_class_dir` method was not defined in the module.
|
103
106
|
#
|
@@ -117,13 +120,16 @@ module Ronin
|
|
117
120
|
# {#repo_class_dir} across all installed repositories.
|
118
121
|
#
|
119
122
|
# @return [Array<String>]
|
120
|
-
#
|
123
|
+
#
|
121
124
|
def list_files
|
122
125
|
modules = Set.new(super)
|
123
|
-
pattern = File.join(repo_class_dir,"{**/}*.rb")
|
126
|
+
pattern = File.join(repo_class_dir,"{**/}*.rb")
|
127
|
+
|
128
|
+
# the String#slice range to remove the repo_class_dir/ and .rb ext
|
129
|
+
slice_range = (repo_class_dir.length + 1)...-3
|
124
130
|
|
125
131
|
Repos.list_files(pattern).each do |path|
|
126
|
-
modules << path.
|
132
|
+
modules << path.slice(slice_range)
|
127
133
|
end
|
128
134
|
|
129
135
|
return modules.to_a
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
4
|
#
|
5
5
|
# ronin-repos is free software: you can redistribute it and/or modify
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
@@ -24,6 +24,9 @@ require 'ronin/core/cli/command'
|
|
24
24
|
module Ronin
|
25
25
|
module Repos
|
26
26
|
class CLI
|
27
|
+
#
|
28
|
+
# Base command for all `ronin-repos` commands.
|
29
|
+
#
|
27
30
|
class Command < Core::CLI::Command
|
28
31
|
|
29
32
|
man_dir File.join(ROOT,'man')
|
@@ -39,8 +42,7 @@ module Ronin
|
|
39
42
|
@cache_dir = CacheDir.new(dir)
|
40
43
|
end
|
41
44
|
|
42
|
-
|
43
|
-
# The ronin-repos cache directory.
|
45
|
+
# The `ronin-repos` cache directory.
|
44
46
|
#
|
45
47
|
# @return [CacheDir]
|
46
48
|
attr_reader :cache_dir
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
4
|
#
|
5
5
|
# ronin-repos is free software: you can redistribute it and/or modify
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
@@ -18,6 +18,8 @@
|
|
18
18
|
|
19
19
|
require 'ronin/repos/cli/command'
|
20
20
|
|
21
|
+
require 'ronin/core/cli/logging'
|
22
|
+
|
21
23
|
module Ronin
|
22
24
|
module Repos
|
23
25
|
class CLI
|
@@ -40,6 +42,8 @@ module Ronin
|
|
40
42
|
#
|
41
43
|
class Install < Command
|
42
44
|
|
45
|
+
include Core::CLI::Logging
|
46
|
+
|
43
47
|
usage '[options] URI'
|
44
48
|
|
45
49
|
argument :uri, required: true,
|
@@ -58,7 +62,7 @@ module Ronin
|
|
58
62
|
#
|
59
63
|
def run(uri)
|
60
64
|
log_info "Installing repository from #{uri} ..."
|
61
|
-
cache_dir.
|
65
|
+
cache_dir.install(uri)
|
62
66
|
rescue CommandFailed => error
|
63
67
|
print_error(error.message)
|
64
68
|
exit(-1)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
4
|
#
|
5
5
|
# ronin-repos is free software: you can redistribute it and/or modify
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
4
|
#
|
5
5
|
# ronin-repos is free software: you can redistribute it and/or modify
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
@@ -63,7 +63,7 @@ module Ronin
|
|
63
63
|
# The path to the new repo directory to create.
|
64
64
|
#
|
65
65
|
def run(path)
|
66
|
-
@name
|
66
|
+
@name = File.basename(path)
|
67
67
|
@github_user = Core::Git.github_user || ENV['USER']
|
68
68
|
|
69
69
|
mkdir path
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
4
|
#
|
5
5
|
# ronin-repos is free software: you can redistribute it and/or modify
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
@@ -22,12 +22,27 @@ module Ronin
|
|
22
22
|
module Repos
|
23
23
|
class CLI
|
24
24
|
module Commands
|
25
|
+
#
|
26
|
+
# The `ronin-repos purge` command.
|
27
|
+
#
|
28
|
+
# ## Usage
|
29
|
+
#
|
30
|
+
# ronin-repos purge [options]
|
31
|
+
#
|
32
|
+
# ## Options
|
33
|
+
#
|
34
|
+
# -C, --cache-dir DIR Overrides the default cache directory
|
35
|
+
# -h, --help Print help information
|
36
|
+
#
|
25
37
|
class Purge < Command
|
26
38
|
|
27
39
|
description 'Removes all git repository from the cache directory'
|
28
40
|
|
29
41
|
man_page 'ronin-repos-download.1'
|
30
42
|
|
43
|
+
#
|
44
|
+
# Runs the `ronin-repos purge` command.
|
45
|
+
#
|
31
46
|
def run
|
32
47
|
cache_dir.purge
|
33
48
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
4
|
#
|
5
5
|
# ronin-repos is free software: you can redistribute it and/or modify
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
4
|
#
|
5
5
|
# ronin-repos is free software: you can redistribute it and/or modify
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
data/lib/ronin/repos/cli.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
4
|
#
|
5
5
|
# ronin-repos is free software: you can redistribute it and/or modify
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
@@ -16,8 +16,11 @@
|
|
16
16
|
# along with ronin-repos. If not, see <https://www.gnu.org/licenses/>.
|
17
17
|
#
|
18
18
|
|
19
|
+
require 'ronin/repos/version'
|
20
|
+
|
19
21
|
require 'command_kit/commands'
|
20
22
|
require 'command_kit/commands/auto_load'
|
23
|
+
require 'command_kit/options/version'
|
21
24
|
|
22
25
|
module Ronin
|
23
26
|
module Repos
|
@@ -33,8 +36,10 @@ module Ronin
|
|
33
36
|
dir: "#{__dir__}/cli/commands",
|
34
37
|
namespace: "#{self}::Commands"
|
35
38
|
)
|
39
|
+
include CommandKit::Options::Version
|
36
40
|
|
37
41
|
command_name 'ronin-repos'
|
42
|
+
version Ronin::Repos::VERSION
|
38
43
|
|
39
44
|
command_aliases['ls'] = 'list'
|
40
45
|
command_aliases['up'] = 'update'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
4
|
#
|
5
5
|
# ronin-repos is free software: you can redistribute it and/or modify
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
@@ -21,13 +21,13 @@ module Ronin
|
|
21
21
|
class Exception < RuntimeError
|
22
22
|
end
|
23
23
|
|
24
|
-
class RepositoryNotFound < Exception
|
24
|
+
class RepositoryNotFound < Repos::Exception
|
25
25
|
end
|
26
26
|
|
27
|
-
class CommandNotInstalled < Exception
|
27
|
+
class CommandNotInstalled < Repos::Exception
|
28
28
|
end
|
29
29
|
|
30
|
-
class CommandFailed < Exception
|
30
|
+
class CommandFailed < Repos::Exception
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
4
|
#
|
5
5
|
# ronin-repos is free software: you can redistribute it and/or modify
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
@@ -66,7 +66,7 @@ module Ronin
|
|
66
66
|
# Clones a repository.
|
67
67
|
#
|
68
68
|
# @param [String, URI::HTTPS] uri
|
69
|
-
# The `https://` or `git@HOST:PATH` SSH URI
|
69
|
+
# The `https://` or `git@HOST:PATH` SSH URI
|
70
70
|
#
|
71
71
|
# @param [String] path
|
72
72
|
# The path to where the repository will be cloned to.
|
@@ -109,7 +109,7 @@ module Ronin
|
|
109
109
|
# path.
|
110
110
|
#
|
111
111
|
# @param [String, URI::HTTPS] uri
|
112
|
-
# The `https://` or `git@HOST:PATH` SSH URI
|
112
|
+
# The `https://` or `git@HOST:PATH` SSH URI
|
113
113
|
#
|
114
114
|
# @param [String] path
|
115
115
|
# The path to where the repository will be cloned to.
|
@@ -304,7 +304,7 @@ module Ronin
|
|
304
304
|
#
|
305
305
|
def glob(pattern,&block)
|
306
306
|
path = join(pattern)
|
307
|
-
matches = Dir.glob(path)
|
307
|
+
matches = Dir.glob(path)
|
308
308
|
|
309
309
|
if block then matches.each(&block)
|
310
310
|
else matches
|
data/lib/ronin/repos/root.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
4
|
#
|
5
5
|
# ronin-repos is free software: you can redistribute it and/or modify
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
data/lib/ronin/repos/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
4
|
#
|
5
5
|
# ronin-repos is free software: you can redistribute it and/or modify
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
@@ -19,6 +19,6 @@
|
|
19
19
|
module Ronin
|
20
20
|
module Repos
|
21
21
|
# ronin-repos version
|
22
|
-
VERSION = '0.1.
|
22
|
+
VERSION = '0.1.1'
|
23
23
|
end
|
24
24
|
end
|
data/lib/ronin/repos.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
-
# Copyright (c) 2021 Hal Brodigan (postmodern.mod3 at gmail.com)
|
3
|
+
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
|
4
4
|
#
|
5
5
|
# ronin-repos is free software: you can redistribute it and/or modify
|
6
6
|
# it under the terms of the GNU Lesser General Public License as published
|
@@ -25,7 +25,7 @@ module Ronin
|
|
25
25
|
# @api public
|
26
26
|
#
|
27
27
|
module Repos
|
28
|
-
|
28
|
+
@cache_dir = CacheDir.new
|
29
29
|
|
30
30
|
#
|
31
31
|
# Finds the first matching file.
|
@@ -42,7 +42,7 @@ module Ronin
|
|
42
42
|
# # => "/home/user/.cache/ronin-repos/foo-repo/wordlists/wordlist.txt"
|
43
43
|
#
|
44
44
|
def self.find_file(path)
|
45
|
-
|
45
|
+
@cache_dir.find_file(path)
|
46
46
|
end
|
47
47
|
|
48
48
|
#
|
@@ -62,7 +62,7 @@ module Ronin
|
|
62
62
|
# # "/home/user/.cache/ronin-repos/bar-repo/wordlists/beers.txt"]
|
63
63
|
#
|
64
64
|
def self.glob(pattern,&block)
|
65
|
-
|
65
|
+
@cache_dir.glob(pattern,&block)
|
66
66
|
end
|
67
67
|
|
68
68
|
#
|
@@ -75,7 +75,7 @@ module Ronin
|
|
75
75
|
# The matching files within all repositories.
|
76
76
|
#
|
77
77
|
def self.list_files(pattern='{**/}*.*')
|
78
|
-
|
78
|
+
@cache_dir.list_files(pattern)
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|