poepod 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/rake.yml +15 -0
- data/.github/workflows/release.yml +23 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +8 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +101 -0
- data/README.adoc +84 -0
- data/Rakefile +12 -0
- data/bin/console +11 -0
- data/bin/setup +8 -0
- data/exe/poepod +6 -0
- data/lib/poepod/cli.rb +30 -0
- data/lib/poepod/processor.rb +84 -0
- data/lib/poepod/version.rb +5 -0
- data/lib/poepod.rb +8 -0
- data/poepod.gemspec +44 -0
- data/sig/poepod.rbs +4 -0
- metadata +177 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2fc14a45fca705bb30585dc62cf7e981a5932e1a81a7c17136e2559d781e411b
|
4
|
+
data.tar.gz: 9241502368728b6ec70366bdd09d240853a6f8d549911b291c5aaa7f99a5206e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7fb2dd0c101982eee304b3aaf0397eda3ddd7b34b856a9681f5b46fcf377ffed1c4cd6eefedc3bb2e2ab2807ff91d1b1cfa764b7ec10f50bd83dbe0f47a42d0e
|
7
|
+
data.tar.gz: e2d871008ab879b2b302dcb4b6eee6525166b077048318884dbc59706ae9798979cfcbe7a6c9cf9461926dc5dfa7f3eb34101e7a7bc6c33de321dac285e2036a
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: rake
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches: [ master, main ]
|
8
|
+
tags: [ v* ]
|
9
|
+
pull_request:
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
rake:
|
13
|
+
uses: metanorma/ci/.github/workflows/generic-rake.yml@main
|
14
|
+
secrets:
|
15
|
+
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: release
|
4
|
+
|
5
|
+
on:
|
6
|
+
workflow_dispatch:
|
7
|
+
inputs:
|
8
|
+
next_version:
|
9
|
+
description: |
|
10
|
+
Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
|
11
|
+
required: true
|
12
|
+
default: 'skip'
|
13
|
+
repository_dispatch:
|
14
|
+
types: [ do-release ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
release:
|
18
|
+
uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
|
19
|
+
with:
|
20
|
+
next_version: ${{ github.event.inputs.next_version }}
|
21
|
+
secrets:
|
22
|
+
rubygems-api-key: ${{ secrets.METANORMA_CI_RUBYGEMS_API_KEY }}
|
23
|
+
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
10
|
+
identity and orientation.
|
11
|
+
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
13
|
+
diverse, inclusive, and healthy community.
|
14
|
+
|
15
|
+
## Our Standards
|
16
|
+
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
18
|
+
community include:
|
19
|
+
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
24
|
+
and learning from the experience
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
26
|
+
community
|
27
|
+
|
28
|
+
Examples of unacceptable behavior include:
|
29
|
+
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
31
|
+
any kind
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
33
|
+
* Public or private harassment
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
35
|
+
without their explicit permission
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
37
|
+
professional setting
|
38
|
+
|
39
|
+
## Enforcement Responsibilities
|
40
|
+
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
44
|
+
or harmful.
|
45
|
+
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
49
|
+
decisions when appropriate.
|
50
|
+
|
51
|
+
## Scope
|
52
|
+
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
54
|
+
an individual is officially representing the community in public spaces.
|
55
|
+
Examples of representing our community include using an official email address,
|
56
|
+
posting via an official social media account, or acting as an appointed
|
57
|
+
representative at an online or offline event.
|
58
|
+
|
59
|
+
## Enforcement
|
60
|
+
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
62
|
+
reported to the community leaders responsible for enforcement at
|
63
|
+
[INSERT CONTACT METHOD].
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
65
|
+
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
67
|
+
reporter of any incident.
|
68
|
+
|
69
|
+
## Enforcement Guidelines
|
70
|
+
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
73
|
+
|
74
|
+
### 1. Correction
|
75
|
+
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
77
|
+
unprofessional or unwelcome in the community.
|
78
|
+
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
82
|
+
|
83
|
+
### 2. Warning
|
84
|
+
|
85
|
+
**Community Impact**: A violation through a single incident or series of
|
86
|
+
actions.
|
87
|
+
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
92
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
93
|
+
ban.
|
94
|
+
|
95
|
+
### 3. Temporary Ban
|
96
|
+
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
98
|
+
sustained inappropriate behavior.
|
99
|
+
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
101
|
+
communication with the community for a specified period of time. No public or
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
104
|
+
Violating these terms may lead to a permanent ban.
|
105
|
+
|
106
|
+
### 4. Permanent Ban
|
107
|
+
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
111
|
+
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
113
|
+
community.
|
114
|
+
|
115
|
+
## Attribution
|
116
|
+
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
118
|
+
version 2.1, available at
|
119
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
120
|
+
|
121
|
+
Community Impact Guidelines were inspired by
|
122
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
123
|
+
|
124
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
125
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
126
|
+
[https://www.contributor-covenant.org/translations][translations].
|
127
|
+
|
128
|
+
[homepage]: https://www.contributor-covenant.org
|
129
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
130
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
131
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
132
|
+
[translations]: https://www.contributor-covenant.org/translations
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
poepod (0.1.0)
|
5
|
+
parallel (~> 1.20)
|
6
|
+
thor (~> 1.0)
|
7
|
+
tqdm
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
activesupport (7.1.3.4)
|
13
|
+
base64
|
14
|
+
bigdecimal
|
15
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
+
connection_pool (>= 2.2.5)
|
17
|
+
drb
|
18
|
+
i18n (>= 1.6, < 2)
|
19
|
+
minitest (>= 5.1)
|
20
|
+
mutex_m
|
21
|
+
tzinfo (~> 2.0)
|
22
|
+
ast (2.4.2)
|
23
|
+
base64 (0.2.0)
|
24
|
+
bigdecimal (3.1.8)
|
25
|
+
concurrent-ruby (1.3.3)
|
26
|
+
connection_pool (2.4.1)
|
27
|
+
diff-lcs (1.5.1)
|
28
|
+
drb (2.2.1)
|
29
|
+
i18n (1.14.5)
|
30
|
+
concurrent-ruby (~> 1.0)
|
31
|
+
json (2.7.2)
|
32
|
+
language_server-protocol (3.17.0.3)
|
33
|
+
minitest (5.23.1)
|
34
|
+
mutex_m (0.2.0)
|
35
|
+
parallel (1.25.1)
|
36
|
+
parser (3.3.2.0)
|
37
|
+
ast (~> 2.4.1)
|
38
|
+
racc
|
39
|
+
racc (1.8.0)
|
40
|
+
rack (3.1.3)
|
41
|
+
rainbow (3.1.1)
|
42
|
+
rake (13.2.1)
|
43
|
+
regexp_parser (2.9.2)
|
44
|
+
rexml (3.3.0)
|
45
|
+
strscan
|
46
|
+
rspec (3.13.0)
|
47
|
+
rspec-core (~> 3.13.0)
|
48
|
+
rspec-expectations (~> 3.13.0)
|
49
|
+
rspec-mocks (~> 3.13.0)
|
50
|
+
rspec-core (3.13.0)
|
51
|
+
rspec-support (~> 3.13.0)
|
52
|
+
rspec-expectations (3.13.0)
|
53
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
54
|
+
rspec-support (~> 3.13.0)
|
55
|
+
rspec-mocks (3.13.1)
|
56
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
57
|
+
rspec-support (~> 3.13.0)
|
58
|
+
rspec-support (3.13.1)
|
59
|
+
rubocop (1.64.1)
|
60
|
+
json (~> 2.3)
|
61
|
+
language_server-protocol (>= 3.17.0)
|
62
|
+
parallel (~> 1.10)
|
63
|
+
parser (>= 3.3.0.2)
|
64
|
+
rainbow (>= 2.2.2, < 4.0)
|
65
|
+
regexp_parser (>= 1.8, < 3.0)
|
66
|
+
rexml (>= 3.2.5, < 4.0)
|
67
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
68
|
+
ruby-progressbar (~> 1.7)
|
69
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
70
|
+
rubocop-ast (1.31.3)
|
71
|
+
parser (>= 3.3.1.0)
|
72
|
+
rubocop-performance (1.21.0)
|
73
|
+
rubocop (>= 1.48.1, < 2.0)
|
74
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
75
|
+
rubocop-rails (2.25.0)
|
76
|
+
activesupport (>= 4.2.0)
|
77
|
+
rack (>= 1.1)
|
78
|
+
rubocop (>= 1.33.0, < 2.0)
|
79
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
80
|
+
ruby-progressbar (1.13.0)
|
81
|
+
strscan (3.1.0)
|
82
|
+
thor (1.3.1)
|
83
|
+
tqdm (0.4.1)
|
84
|
+
tzinfo (2.0.6)
|
85
|
+
concurrent-ruby (~> 1.0)
|
86
|
+
unicode-display_width (2.5.0)
|
87
|
+
|
88
|
+
PLATFORMS
|
89
|
+
arm64-darwin-23
|
90
|
+
ruby
|
91
|
+
|
92
|
+
DEPENDENCIES
|
93
|
+
poepod!
|
94
|
+
rake
|
95
|
+
rspec
|
96
|
+
rubocop
|
97
|
+
rubocop-performance
|
98
|
+
rubocop-rails
|
99
|
+
|
100
|
+
BUNDLED WITH
|
101
|
+
2.5.11
|
data/README.adoc
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
= Poepod
|
2
|
+
|
3
|
+
Poepod is a Ruby gem that provides functionality to concatenate code files from
|
4
|
+
a directory into one text file for analysis by Poe.
|
5
|
+
|
6
|
+
== Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
[source,ruby]
|
11
|
+
----
|
12
|
+
gem 'poepod'
|
13
|
+
----
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
[source,shell]
|
18
|
+
----
|
19
|
+
$ bundle install
|
20
|
+
----
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
[source,shell]
|
25
|
+
----
|
26
|
+
$ gem install poepod
|
27
|
+
----
|
28
|
+
|
29
|
+
== Usage
|
30
|
+
|
31
|
+
After installation, you can use the `poepod` command line tool to concatenate
|
32
|
+
code files:
|
33
|
+
|
34
|
+
[source,shell]
|
35
|
+
----
|
36
|
+
$ poepod help
|
37
|
+
Commands:
|
38
|
+
poepod concat DIRECTORY OUTPUT_FILE # Concatenate code from a directory into one text file
|
39
|
+
poepod help [COMMAND] # Describe available commands or one specific command
|
40
|
+
|
41
|
+
$ poepod help concat
|
42
|
+
Usage:
|
43
|
+
poepod concat DIRECTORY OUTPUT_FILE
|
44
|
+
|
45
|
+
Options:
|
46
|
+
[--exclude=one two three] # List of patterns to exclude
|
47
|
+
# Default: "node_modules/" ".git/" "build" "test" ".gitignore" ".DS_Store" "*.jpg" "*.jpeg" "*.png" "*.svg" "*.gif" "*.exe" "*.dll" "*.so" "*.bin" "*.o" "*.a"
|
48
|
+
[--config=CONFIG] # Path to configuration file
|
49
|
+
|
50
|
+
Concatenate code from a directory into one text file
|
51
|
+
----
|
52
|
+
|
53
|
+
For example:
|
54
|
+
|
55
|
+
[source,shell]
|
56
|
+
----
|
57
|
+
$ poepod concat my_project
|
58
|
+
# => concatenated into my_project.txt
|
59
|
+
----
|
60
|
+
|
61
|
+
This will concatenate all code files from the specified directory into `output.txt`.
|
62
|
+
|
63
|
+
You can also exclude certain directories or files by using the `--exclude` option:
|
64
|
+
|
65
|
+
[source,shell]
|
66
|
+
----
|
67
|
+
$ poepod concat my_project output.txt --exclude node_modules .git build test .gitignore .DS_Store .jpg .png .svg
|
68
|
+
----
|
69
|
+
|
70
|
+
== Development
|
71
|
+
|
72
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
73
|
+
`rake test` to run the tests. You can also run `bin/console` for an interactive
|
74
|
+
prompt that will allow you to experiment.
|
75
|
+
|
76
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
77
|
+
release a new version, update the version number in `version.rb`, and then run
|
78
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
79
|
+
git commits and the created tag, and push the `.gem` file to
|
80
|
+
https://rubygems.org.
|
81
|
+
|
82
|
+
== Contributing
|
83
|
+
|
84
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/riboseinc/poepod.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "poepod"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
require "irb"
|
11
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/poepod
ADDED
data/lib/poepod/cli.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "thor"
|
4
|
+
require "poepod/processor"
|
5
|
+
|
6
|
+
module Poepod
|
7
|
+
class Cli < Thor
|
8
|
+
desc "concat DIRECTORY OUTPUT_FILE", "Concatenate code from a directory into one text file"
|
9
|
+
option :exclude, type: :array, default: Poepod::Processor::EXCLUDE_DEFAULT, desc: "List of patterns to exclude"
|
10
|
+
option :config, type: :string, desc: "Path to configuration file"
|
11
|
+
|
12
|
+
def concat(directory, output_file = nil)
|
13
|
+
dir_path = Pathname.new(directory)
|
14
|
+
|
15
|
+
dir_path = dir_path.expand_path unless dir_path.absolute?
|
16
|
+
|
17
|
+
output_file ||= "#{dir_path.basename}.txt"
|
18
|
+
output_path = dir_path.dirname.join(output_file)
|
19
|
+
processor = Poepod::Processor.new(options[:config])
|
20
|
+
total_files, copied_files = processor.write_directory_structure_to_file(directory, output_path, options[:exclude])
|
21
|
+
|
22
|
+
puts "-> #{total_files} files detected in the #{dir_path.relative_path_from(Dir.pwd)} directory."
|
23
|
+
puts "=> #{copied_files} files have been concatenated into #{Pathname.new(output_path).relative_path_from(Dir.pwd)}."
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.exit_on_failure?
|
27
|
+
true
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "yaml"
|
4
|
+
require "tqdm"
|
5
|
+
|
6
|
+
module Poepod
|
7
|
+
class Processor
|
8
|
+
EXCLUDE_DEFAULT = [
|
9
|
+
"node_modules/", ".git/", ".gitignore", ".DS_Store",
|
10
|
+
"*.jpg", "*.jpeg", "*.png", "*.svg", "*.gif",
|
11
|
+
"*.exe", "*.dll", "*.so", "*.bin", "*.o", "*.a"
|
12
|
+
].freeze
|
13
|
+
|
14
|
+
def initialize(config_file = nil)
|
15
|
+
@failed_files = []
|
16
|
+
@config = load_config(config_file)
|
17
|
+
end
|
18
|
+
|
19
|
+
def load_config(config_file)
|
20
|
+
if config_file && File.exist?(config_file)
|
21
|
+
YAML.load_file(config_file)
|
22
|
+
else
|
23
|
+
{}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def process_file(file_path)
|
28
|
+
content = File.read(file_path, encoding: "utf-8")
|
29
|
+
[file_path, content, nil]
|
30
|
+
rescue Encoding::InvalidByteSequenceError, Encoding::UndefinedConversionError
|
31
|
+
@failed_files << file_path
|
32
|
+
[file_path, nil, "Failed to decode the file, as it is not saved with UTF-8 encoding."]
|
33
|
+
end
|
34
|
+
|
35
|
+
def gather_files(directory_path, exclude)
|
36
|
+
exclude += @config["exclude"] if @config["exclude"]
|
37
|
+
exclude_pattern = Regexp.union(exclude.map { |ex| Regexp.escape(ex) })
|
38
|
+
|
39
|
+
Dir.glob("#{directory_path}/**/*").reject do |file_path|
|
40
|
+
File.directory?(file_path) || file_path.match?(exclude_pattern)
|
41
|
+
end.map do |file_path|
|
42
|
+
Pathname.new(file_path).expand_path.to_s
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def write_results_to_file(results, output_file)
|
47
|
+
results.each_with_index do |(file_path, content, error), index|
|
48
|
+
relative = relative_path(file_path)
|
49
|
+
if content
|
50
|
+
output_file.puts "--- START FILE: #{relative} ---"
|
51
|
+
output_file.puts content
|
52
|
+
output_file.puts "--- END FILE: #{relative} ---"
|
53
|
+
elsif error
|
54
|
+
output_file.puts "#{relative}\n#{error}"
|
55
|
+
end
|
56
|
+
output_file.puts if index < results.size - 1 # Add a newline between files
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def relative_path(file_path)
|
61
|
+
Pathname.new(file_path).relative_path_from(Dir.pwd)
|
62
|
+
end
|
63
|
+
|
64
|
+
def write_directory_structure_to_file(directory_path, output_file_name, exclude = EXCLUDE_DEFAULT)
|
65
|
+
dir_path = Pathname.new(directory_path)
|
66
|
+
|
67
|
+
dir_path = dir_path.expand_path unless dir_path.absolute?
|
68
|
+
|
69
|
+
file_list = gather_files(dir_path, exclude)
|
70
|
+
total_files = file_list.size
|
71
|
+
|
72
|
+
File.open(output_file_name, "w", encoding: "utf-8") do |output_file|
|
73
|
+
results = file_list.tqdm(desc: "Progress", unit: " file").map do |file|
|
74
|
+
process_file(file)
|
75
|
+
end
|
76
|
+
write_results_to_file(results, output_file)
|
77
|
+
end
|
78
|
+
|
79
|
+
copied_files = total_files - @failed_files.size
|
80
|
+
|
81
|
+
[total_files, copied_files]
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
data/lib/poepod.rb
ADDED
data/poepod.gemspec
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/poepod/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "poepod"
|
7
|
+
spec.version = Poepod::VERSION
|
8
|
+
spec.authors = ["Ribose Inc."]
|
9
|
+
spec.email = ["open.source@ribose.com"]
|
10
|
+
|
11
|
+
spec.summary = "Utilities for uploading code to Poe"
|
12
|
+
spec.description = <<~DESCRIPTION
|
13
|
+
Utilities for uploading code to Poe
|
14
|
+
DESCRIPTION
|
15
|
+
|
16
|
+
spec.homepage = "https://github.com/riboseinc/poepod"
|
17
|
+
spec.license = "BSD-2-Clause"
|
18
|
+
|
19
|
+
spec.bindir = "bin"
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
spec.files = `git ls-files`.split("\n")
|
22
|
+
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
23
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
|
24
|
+
|
25
|
+
# Specify which files should be added to the gem when it is released.
|
26
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
27
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
28
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
29
|
+
f.match(%r{^(test|spec|features)/})
|
30
|
+
end
|
31
|
+
end
|
32
|
+
spec.bindir = "exe"
|
33
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
34
|
+
spec.require_paths = ["lib"]
|
35
|
+
|
36
|
+
spec.add_runtime_dependency "parallel", "~> 1.20"
|
37
|
+
spec.add_runtime_dependency "thor", "~> 1.0"
|
38
|
+
spec.add_runtime_dependency "tqdm"
|
39
|
+
spec.add_development_dependency "rake"
|
40
|
+
spec.add_development_dependency "rspec"
|
41
|
+
spec.add_development_dependency "rubocop"
|
42
|
+
spec.add_development_dependency "rubocop-performance"
|
43
|
+
spec.add_development_dependency "rubocop-rails"
|
44
|
+
end
|
data/sig/poepod.rbs
ADDED
metadata
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: poepod
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ribose Inc.
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-06-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: parallel
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.20'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.20'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thor
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: tqdm
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-performance
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-rails
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: 'Utilities for uploading code to Poe
|
126
|
+
|
127
|
+
'
|
128
|
+
email:
|
129
|
+
- open.source@ribose.com
|
130
|
+
executables:
|
131
|
+
- poepod
|
132
|
+
extensions: []
|
133
|
+
extra_rdoc_files: []
|
134
|
+
files:
|
135
|
+
- ".github/workflows/rake.yml"
|
136
|
+
- ".github/workflows/release.yml"
|
137
|
+
- ".gitignore"
|
138
|
+
- ".rspec"
|
139
|
+
- ".rubocop.yml"
|
140
|
+
- CODE_OF_CONDUCT.md
|
141
|
+
- Gemfile
|
142
|
+
- Gemfile.lock
|
143
|
+
- README.adoc
|
144
|
+
- Rakefile
|
145
|
+
- bin/console
|
146
|
+
- bin/setup
|
147
|
+
- exe/poepod
|
148
|
+
- lib/poepod.rb
|
149
|
+
- lib/poepod/cli.rb
|
150
|
+
- lib/poepod/processor.rb
|
151
|
+
- lib/poepod/version.rb
|
152
|
+
- poepod.gemspec
|
153
|
+
- sig/poepod.rbs
|
154
|
+
homepage: https://github.com/riboseinc/poepod
|
155
|
+
licenses:
|
156
|
+
- BSD-2-Clause
|
157
|
+
metadata: {}
|
158
|
+
post_install_message:
|
159
|
+
rdoc_options: []
|
160
|
+
require_paths:
|
161
|
+
- lib
|
162
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 3.0.0
|
167
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - ">="
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: '0'
|
172
|
+
requirements: []
|
173
|
+
rubygems_version: 3.5.11
|
174
|
+
signing_key:
|
175
|
+
specification_version: 4
|
176
|
+
summary: Utilities for uploading code to Poe
|
177
|
+
test_files: []
|