claiss 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +7 -0
- data/README.md +65 -0
- data/exe/claiss +4 -0
- data/lib/claiss/cli.rb +7 -0
- data/lib/claiss/commands.rb +9 -0
- data/lib/claiss/version.rb +3 -0
- data/lib/claiss.rb +108 -0
- metadata +96 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4676e0b9c189aef43c1e7fc47b8335e6b06326a7037b8c5c8bc43d546fec9e03
|
4
|
+
data.tar.gz: 1b0aced8f24d95a68a9b3b378d70562020d9c1b0f32be955e5d7b98f291e4fe9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: daaec06de788e6d5710b17094fcb7948365fdec7099fff35da7a89dfe4aba78bff7ef9b1114836196eddfba7b490bb7d42177248d39778006516b0879c5ef55d
|
7
|
+
data.tar.gz: b8f1c356aa5f6d8b1b94bed86c085b8f6035fa1fd324d945c1879a0cd2de29141c36854b1ca4a13cfc89b9b04f6a3b1107373a21ad0b7a496ba3fdb1ad12c61e
|
data/LICENSE
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright 2024 Júlio Papel
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# CLAISS AI CLI Application Toolbox
|
2
|
+
|
3
|
+
CLAISS is a Ruby CLI application & Toolbox to manage CLAISS AI applications and deployments. Please note that some features may not work in all environments. Use with caution!
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install the gem by running the following command in your terminal:
|
8
|
+
|
9
|
+
Copy
|
10
|
+
|
11
|
+
`$ gem install claiss`
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
### Refactor
|
16
|
+
|
17
|
+
The `refactor` command changes text terms in files within a folder, creating a new "refactored-..." folder with the modified files. Note that this command will change all exact occurrences of the specified terms. For example, "Abc" is treated differently from "AbC " or " ABc" or "abc" or "ABC".
|
18
|
+
|
19
|
+
Basic usage:
|
20
|
+
|
21
|
+
Copy
|
22
|
+
|
23
|
+
`$ claiss refactor ./project/`
|
24
|
+
|
25
|
+
#### Using a JSON Dictionary
|
26
|
+
|
27
|
+
You can create a JSON file with a list of terms to refactor. This file should be formatted as a one-level JSON object. The terms are processed in order from top to bottom.
|
28
|
+
|
29
|
+
Example `myapp.json` file:
|
30
|
+
|
31
|
+
Copy
|
32
|
+
|
33
|
+
`{ "system pro": "system b2b", "System Pro": "System B2b", "System": "Laiss", "system": "laiss", "2010 Moevo Silver": "2023 Júlio Papel", "Jared Moevo": "Júlio Papel", "3dtester@gmail.com": "info@mynewsite.pt", "https://somelivesite.com": "https://api.mynewsite.pt", "This is your Rails project.": "Multi Layered Software Services.", "This is your Rails project for your business.": "A Multi Layered Software Services ready to be deployed for any business.", "MIT-LICENSE": "LICENSE", "https://somesite.com": "https://api.mynewsite.pt" }`
|
34
|
+
|
35
|
+
To use this dictionary file:
|
36
|
+
|
37
|
+
Copy
|
38
|
+
|
39
|
+
`$ claiss refactor ./project/ ./myapp.json`
|
40
|
+
|
41
|
+
### Fix Ruby Permissions
|
42
|
+
|
43
|
+
The `fix_ruby_permissions` command adjusts file permissions for a Ruby & Rails project:
|
44
|
+
|
45
|
+
Copy
|
46
|
+
|
47
|
+
`$ claiss fix_ruby_permissions ./refactored-1688375056/`
|
48
|
+
|
49
|
+
**Note:** This command uses `chmod` and may not work correctly on systems that support filename spaces and ignore capitals (like some end-user operating systems). For example, a file called 'MyImage copy.svg' may cause errors. In such cases, manually fix the permissions for problematic files and then re-run the command.
|
50
|
+
|
51
|
+
## Upcoming Features
|
52
|
+
|
53
|
+
We're continually working to improve CLAISS and add new functionalities. Stay tuned for updates!
|
54
|
+
|
55
|
+
## Contributing
|
56
|
+
|
57
|
+
Bug reports and pull requests are welcome on GitHub at [https://github.com/JulioPapel/claiss](https://github.com/JulioPapel/claiss).
|
58
|
+
|
59
|
+
## License
|
60
|
+
|
61
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
62
|
+
|
63
|
+
## Author
|
64
|
+
|
65
|
+
Júlio Papel
|
data/exe/claiss
ADDED
data/lib/claiss/cli.rb
ADDED
data/lib/claiss.rb
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "dry/cli"
|
3
|
+
require "fileutils"
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module CLAISS
|
7
|
+
class Error < StandardError; end
|
8
|
+
|
9
|
+
class Version < Dry::CLI::Command
|
10
|
+
desc "Print version"
|
11
|
+
|
12
|
+
def call(*)
|
13
|
+
puts "CLAISS version #{CLAISS::VERSION}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class Refactor < Dry::CLI::Command
|
18
|
+
desc "Refactors terms and files on directories"
|
19
|
+
argument :path, type: :string, required: true, desc: "Relative path directory"
|
20
|
+
argument :json_file, type: :string, desc: "Provide a JSON file with replacement rules"
|
21
|
+
|
22
|
+
def call(path:, json_file: nil, **)
|
23
|
+
dict = load_dictionary(json_file)
|
24
|
+
origin_path = File.expand_path(path)
|
25
|
+
destination_path = File.expand_path("./refactored-#{Time.now.to_i}")
|
26
|
+
|
27
|
+
dict[origin_path] = destination_path
|
28
|
+
process_files(origin_path, dict)
|
29
|
+
|
30
|
+
puts "Done! Your project is in the #{destination_path} folder"
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def load_dictionary(json_file)
|
36
|
+
if json_file
|
37
|
+
JSON.parse(File.read(json_file))
|
38
|
+
else
|
39
|
+
interactive_dictionary
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def interactive_dictionary
|
44
|
+
dict = {}
|
45
|
+
loop do
|
46
|
+
print "Term to search (or press Enter to finish): "
|
47
|
+
search = STDIN.gets.chomp
|
48
|
+
break if search.empty?
|
49
|
+
print "Term to replace: "
|
50
|
+
replace = STDIN.gets.chomp
|
51
|
+
dict[search] = replace
|
52
|
+
end
|
53
|
+
dict
|
54
|
+
end
|
55
|
+
|
56
|
+
def process_files(origin_path, dict)
|
57
|
+
Dir.glob(File.join(origin_path, "**", "*"), File::FNM_DOTMATCH).each do |file_name|
|
58
|
+
next if File.directory?(file_name)
|
59
|
+
process_file(file_name, dict)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def process_file(file_name, dict)
|
64
|
+
destination = file_name.gsub(dict.keys.first, dict.values.first)
|
65
|
+
text = File.read(file_name)
|
66
|
+
|
67
|
+
dict.each do |search, replace|
|
68
|
+
destination.gsub!(search, replace)
|
69
|
+
text.gsub!(search, replace)
|
70
|
+
end
|
71
|
+
|
72
|
+
FileUtils.mkdir_p(File.dirname(destination))
|
73
|
+
File.write(destination, text)
|
74
|
+
puts "File: #{destination}, OK"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
class FixRubyPermissions < Dry::CLI::Command
|
79
|
+
desc "Fix permissions for a Ruby project"
|
80
|
+
argument :path, required: true, desc: "The path of your Ruby project"
|
81
|
+
|
82
|
+
def call(path: nil, **)
|
83
|
+
path ||= Dir.getwd
|
84
|
+
path = File.expand_path(path)
|
85
|
+
|
86
|
+
Dir.glob(File.join(path, '**', '*'), File::FNM_DOTMATCH) do |item|
|
87
|
+
next if item == '.' || item == '..'
|
88
|
+
if File.directory?(item)
|
89
|
+
File.chmod(0755, item)
|
90
|
+
else
|
91
|
+
File.chmod(0644, item)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
executable_files = ['bundle', 'rails', 'rake', 'spring']
|
96
|
+
executable_files.each do |file|
|
97
|
+
file_path = File.join(path, 'bin', file)
|
98
|
+
File.chmod(0755, file_path) if File.exist?(file_path)
|
99
|
+
end
|
100
|
+
|
101
|
+
puts "Permissions fixed for #{path}"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
require_relative "claiss/version"
|
107
|
+
require_relative "claiss/commands"
|
108
|
+
require_relative "claiss/cli"
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: claiss
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Júlio Papel
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-06-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: dry-cli
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: fileutils
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.7.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.7.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: json
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.6.3
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.6.3
|
55
|
+
description: CLI application Toolbox to manage CLAISS AI applications and deployments.
|
56
|
+
Some features may not work in all environments. Use with caution!
|
57
|
+
email:
|
58
|
+
- julio.papel@gmail.com
|
59
|
+
executables:
|
60
|
+
- claiss
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- LICENSE
|
65
|
+
- README.md
|
66
|
+
- exe/claiss
|
67
|
+
- lib/claiss.rb
|
68
|
+
- lib/claiss/cli.rb
|
69
|
+
- lib/claiss/commands.rb
|
70
|
+
- lib/claiss/version.rb
|
71
|
+
homepage: http://rubygems.org/gems/claiss
|
72
|
+
licenses:
|
73
|
+
- MIT
|
74
|
+
metadata:
|
75
|
+
source_code_uri: https://github.com/JulioPapel/claiss.git
|
76
|
+
documentation_uri: https://github.com/JulioPapel/claiss/blob/main/readme.md
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 2.7.0
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubygems_version: 3.1.2
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: CLAISS AI CLI application Toolbox
|
96
|
+
test_files: []
|