claiss 1.0.2 → 1.0.4
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.
Potentially problematic release.
This version of claiss might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/claiss.rb +127 -65
- metadata +53 -10
- /data/{bin → exe}/claiss +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1aeba7f21350d881633d4d21d29cb4f85a4bba95ca0fb4f98530e8ac720681d
|
4
|
+
data.tar.gz: 03dedc88fbc506e11c9b6f68e2eb6ea425b953113251bb2bde9d7b935c6d17fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d37082c93df94fe71ee8d55f773435212a6fbe235e31e389833fc82be22fce5f5212511d4a620a0aa117ae843d5d8865e29a20f885bbc7c07eb6e0db59692ab
|
7
|
+
data.tar.gz: aa6d5d393da6782cca6126f0db9acca7d3f0634b9fcb79da33cf692deed277e2526fecbfafd43f73d04dc6b6d35067fde6bd9a07487658e26ba53c9e4ac47c71
|
data/lib/claiss.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
require "bundler/setup"
|
2
2
|
require "dry/cli"
|
3
|
+
require "fileutils"
|
4
|
+
require "pathname"
|
5
|
+
require 'find'
|
6
|
+
require 'json'
|
3
7
|
|
4
8
|
module Claiss
|
5
9
|
extend Dry::CLI::Registry
|
@@ -8,94 +12,152 @@ module Claiss
|
|
8
12
|
desc "Print version"
|
9
13
|
|
10
14
|
def call(*)
|
11
|
-
|
15
|
+
spec = Gem::Specification::load("claiss.gemspec")
|
16
|
+
puts "#{spec.summary}"
|
17
|
+
puts "Version: #{spec.version}"
|
12
18
|
end
|
13
19
|
end
|
14
20
|
|
15
|
-
class
|
16
|
-
desc "
|
17
|
-
|
18
|
-
argument :
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
class Refactor < Dry::CLI::Command
|
22
|
+
desc "Refactors terms and files on directories"
|
23
|
+
argument :path, type: :string, required: true, desc: "Relative path directory"
|
24
|
+
argument :json_file, type: :string, required: false, desc: "Provide a Ruby hash file"
|
25
|
+
def call(path:, json_file:, **)
|
26
|
+
dict = {}
|
27
|
+
search = ""
|
28
|
+
replace = ""
|
29
|
+
input = "y"
|
30
|
+
|
31
|
+
if !json_file.nil? || !json_file.empty?
|
32
|
+
jfile = File.read(json_file)
|
33
|
+
dict = JSON.parse(jfile)
|
28
34
|
else
|
29
|
-
|
35
|
+
while input.downcase == "y" do
|
36
|
+
puts "Term to search: "
|
37
|
+
search = STDIN.gets.chomp
|
38
|
+
puts "Term to replace: "
|
39
|
+
replace = STDIN.gets.chomp
|
40
|
+
|
41
|
+
dict[search] = replace
|
42
|
+
puts "\nAdd another? Type Y \nto Start Refactoring press Enter"
|
43
|
+
input = STDIN.gets.chomp!
|
44
|
+
end
|
30
45
|
end
|
46
|
+
puts dict.inspect
|
47
|
+
dict[path] = "refactored-#{Time.now.to_i.to_s}/"
|
48
|
+
Dir.glob(path + "**/" +"*").reject{ |f| File.directory?(f)}.each do |file|
|
49
|
+
destination = file.to_s
|
50
|
+
text = File.read(file) if !File.directory?(file)
|
51
|
+
|
52
|
+
dict.map do |p, i|
|
53
|
+
destination.gsub!(p, i)
|
54
|
+
if !text.nil?
|
55
|
+
text.gsub!(p, i)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
puts "Destination file #{destination}"
|
60
|
+
FileUtils.mkdir_p(File.dirname(destination)) unless File.exist?(destination)
|
61
|
+
File.open(destination, "wb") do |f|
|
62
|
+
f.puts text
|
63
|
+
end
|
64
|
+
end
|
65
|
+
puts "Do you want Move and delete to the original folder? (y/n): "
|
66
|
+
del = STDIN.gets.chomp
|
67
|
+
if del.downcase == "y"
|
68
|
+
FileUtils.rm_r(path)
|
69
|
+
FileUtils.mv dict[path], path
|
70
|
+
puts "Moved from #{dict[path]} to #{path}"
|
71
|
+
end
|
72
|
+
|
31
73
|
end
|
32
74
|
end
|
33
75
|
|
34
|
-
class
|
35
|
-
|
76
|
+
# class Echo < Dry::CLI::Command
|
77
|
+
# desc "Print input"
|
36
78
|
|
37
|
-
|
79
|
+
# argument :input, desc: "Input to print"
|
38
80
|
|
39
|
-
|
40
|
-
|
41
|
-
|
81
|
+
# example [
|
82
|
+
# " # Prints 'wuh?'",
|
83
|
+
# "hello, folks # Prints 'hello, folks'"
|
84
|
+
# ]
|
42
85
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
86
|
+
# def call(input: nil, **)
|
87
|
+
# if input.nil?
|
88
|
+
# puts "wuh?"
|
89
|
+
# else
|
90
|
+
# puts input
|
91
|
+
# end
|
92
|
+
# end
|
93
|
+
# end
|
47
94
|
|
48
|
-
class
|
49
|
-
|
95
|
+
# class Start < Dry::CLI::Command
|
96
|
+
# desc "Start Foo machinery"
|
50
97
|
|
51
|
-
|
98
|
+
# argument :root, required: true, desc: "Root directory"
|
52
99
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
100
|
+
# example [
|
101
|
+
# "path/to/root # Start Foo at root directory"
|
102
|
+
# ]
|
57
103
|
|
58
|
-
|
59
|
-
|
104
|
+
# def call(root:, **)
|
105
|
+
# puts "started - root: #{root}"
|
106
|
+
# end
|
107
|
+
# end
|
60
108
|
|
61
|
-
|
62
|
-
|
109
|
+
# class Stop < Dry::CLI::Command
|
110
|
+
# desc "Stop Foo machinery"
|
63
111
|
|
64
|
-
|
65
|
-
puts "exec - task: #{task}, dirs: #{dirs.inspect}"
|
66
|
-
end
|
67
|
-
end
|
112
|
+
# option :graceful, type: :boolean, default: true, desc: "Graceful stop"
|
68
113
|
|
69
|
-
|
70
|
-
|
71
|
-
|
114
|
+
# def call(**options)
|
115
|
+
# puts "stopped - graceful: #{options.fetch(:graceful)}"
|
116
|
+
# end
|
117
|
+
# end
|
72
118
|
|
73
|
-
|
119
|
+
# class Exec < Dry::CLI::Command
|
120
|
+
# desc "Execute a task"
|
74
121
|
|
75
|
-
|
76
|
-
|
77
|
-
end
|
78
|
-
end
|
122
|
+
# argument :task, type: :string, required: true, desc: "Task to be executed"
|
123
|
+
# argument :dirs, type: :array, required: false, desc: "Optional directories"
|
79
124
|
|
80
|
-
|
81
|
-
|
125
|
+
# def call(task:, dirs: [], **)
|
126
|
+
# puts "exec - task: #{task}, dirs: #{dirs.inspect}"
|
127
|
+
# end
|
128
|
+
# end
|
82
129
|
|
83
|
-
|
130
|
+
# module Generate
|
131
|
+
# class Configuration < Dry::CLI::Command
|
132
|
+
# desc "Generate configuration"
|
84
133
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
end
|
134
|
+
# option :apps, type: :array, default: [], desc: "Generate configuration for specific apps"
|
135
|
+
|
136
|
+
# def call(apps:, **)
|
137
|
+
# puts "generated configuration for apps: #{apps.inspect}"
|
138
|
+
# end
|
139
|
+
# end
|
140
|
+
|
141
|
+
# class Test < Dry::CLI::Command
|
142
|
+
# desc "Generate tests"
|
143
|
+
|
144
|
+
# option :framework, default: "minitest", values: %w[minitest rspec]
|
145
|
+
|
146
|
+
# def call(framework:, **)
|
147
|
+
# puts "generated tests - framework: #{framework}"
|
148
|
+
# end
|
149
|
+
# end
|
150
|
+
# end
|
90
151
|
|
91
152
|
register "version", Version, aliases: ["v", "-v", "--version"]
|
92
|
-
register "echo", Echo
|
93
|
-
register "start", Start
|
94
|
-
register "stop", Stop
|
95
|
-
register "exec", Exec
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
153
|
+
#register "echo", Echo
|
154
|
+
#register "start", Start
|
155
|
+
#register "stop", Stop
|
156
|
+
#register "exec", Exec
|
157
|
+
register "refactor",Refactor
|
158
|
+
|
159
|
+
# register "generate", aliases: ["g"] do |prefix|
|
160
|
+
# prefix.register "config", Generate::Configuration
|
161
|
+
# prefix.register "test", Generate::Test
|
162
|
+
# end
|
101
163
|
end
|
metadata
CHANGED
@@ -1,29 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: claiss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Júlio Papel
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-cli
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pathname
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.2.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.2.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: fileutils
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.7.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.7.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: json
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.6.3
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.6.3
|
27
69
|
description: CLI application Toolbox to manage Laiss AI applications and deployments.
|
28
70
|
Some thing may not work on your environment. Use with caution!
|
29
71
|
email:
|
@@ -33,13 +75,14 @@ executables:
|
|
33
75
|
extensions: []
|
34
76
|
extra_rdoc_files: []
|
35
77
|
files:
|
36
|
-
-
|
78
|
+
- exe/claiss
|
37
79
|
- lib/claiss.rb
|
38
80
|
- lib/tasks/claiss.rake
|
39
81
|
homepage: http://rubygems.org/gems/claiss
|
40
82
|
licenses:
|
41
83
|
- MIT
|
42
|
-
metadata:
|
84
|
+
metadata:
|
85
|
+
documentation_uri: https://github.com/JulioPapel/claiss/blob/main/readme.md
|
43
86
|
post_install_message:
|
44
87
|
rdoc_options: []
|
45
88
|
require_paths:
|
@@ -48,7 +91,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
48
91
|
requirements:
|
49
92
|
- - ">="
|
50
93
|
- !ruby/object:Gem::Version
|
51
|
-
version:
|
94
|
+
version: 2.7.0
|
52
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
96
|
requirements:
|
54
97
|
- - ">="
|
/data/{bin → exe}/claiss
RENAMED
File without changes
|