claiss 1.0.3

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.

Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/exe/claiss +5 -0
  3. data/lib/claiss.rb +163 -0
  4. data/lib/tasks/claiss.rake +25 -0
  5. metadata +104 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 111930915061d881a017a8f3d0865d606717c5b5f198a37204324dcf35ad2ad6
4
+ data.tar.gz: bfa45b41895c4de0be9e4d71d73e9181b41d50699696b5562387979a2c76163b
5
+ SHA512:
6
+ metadata.gz: e7fd6115f2b46b9dd6d77386cf40c78ca364ca23bcbb8e2fde184572a8e2be0753c26069e76462025a23ad04fec8ae6e08380aeb360cf37e4d147af3d3f9d916
7
+ data.tar.gz: '0088d2492a54bd95ab8c9b23d81def46d28b947d0993a79759d4150d013280890ff44680d01266bc29c015c8628a78505b77f0e0f04d9d90bced279aff15cbcf'
data/exe/claiss ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "dry/cli"
4
+ require 'claiss'
5
+ Dry::CLI.new(Claiss).call
data/lib/claiss.rb ADDED
@@ -0,0 +1,163 @@
1
+ require "bundler/setup"
2
+ require "dry/cli"
3
+ require "fileutils"
4
+ require "pathname"
5
+ require 'find'
6
+ require 'json'
7
+
8
+ module Claiss
9
+ extend Dry::CLI::Registry
10
+
11
+ class Version < Dry::CLI::Command
12
+ desc "Print version"
13
+
14
+ def call(*)
15
+ spec = Gem::Specification::load("claiss.gemspec")
16
+ puts "#{spec.summary}"
17
+ puts "Version: #{spec.version}"
18
+ end
19
+ end
20
+
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)
34
+ else
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
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
+
73
+ end
74
+ end
75
+
76
+ class Echo < Dry::CLI::Command
77
+ desc "Print input"
78
+
79
+ argument :input, desc: "Input to print"
80
+
81
+ example [
82
+ " # Prints 'wuh?'",
83
+ "hello, folks # Prints 'hello, folks'"
84
+ ]
85
+
86
+ def call(input: nil, **)
87
+ if input.nil?
88
+ puts "wuh?"
89
+ else
90
+ puts input
91
+ end
92
+ end
93
+ end
94
+
95
+ class Start < Dry::CLI::Command
96
+ desc "Start Foo machinery"
97
+
98
+ argument :root, required: true, desc: "Root directory"
99
+
100
+ example [
101
+ "path/to/root # Start Foo at root directory"
102
+ ]
103
+
104
+ def call(root:, **)
105
+ puts "started - root: #{root}"
106
+ end
107
+ end
108
+
109
+ class Stop < Dry::CLI::Command
110
+ desc "Stop Foo machinery"
111
+
112
+ option :graceful, type: :boolean, default: true, desc: "Graceful stop"
113
+
114
+ def call(**options)
115
+ puts "stopped - graceful: #{options.fetch(:graceful)}"
116
+ end
117
+ end
118
+
119
+ class Exec < Dry::CLI::Command
120
+ desc "Execute a task"
121
+
122
+ argument :task, type: :string, required: true, desc: "Task to be executed"
123
+ argument :dirs, type: :array, required: false, desc: "Optional directories"
124
+
125
+ def call(task:, dirs: [], **)
126
+ puts "exec - task: #{task}, dirs: #{dirs.inspect}"
127
+ end
128
+ end
129
+
130
+ module Generate
131
+ class Configuration < Dry::CLI::Command
132
+ desc "Generate configuration"
133
+
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
151
+
152
+ register "version", Version, aliases: ["v", "-v", "--version"]
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
163
+ end
@@ -0,0 +1,25 @@
1
+ GEM_NAME = "claiss"
2
+ GEM_VERSION = "1.0.0"
3
+
4
+ namespace :claiss do
5
+ path = "/home/rails/jumpstart/lib/claiss/"
6
+
7
+ task :default => :build
8
+
9
+ task :build do
10
+ system "gem build " + path + GEM_NAME + ".gemspec"
11
+ end
12
+
13
+ task :install => :build do
14
+ system "gem install " + path + GEM_NAME + "-" + GEM_VERSION + ".gem"
15
+ end
16
+
17
+ task :publish => :build do
18
+ system 'gem push ' + path + GEM_NAME + "-" + GEM_VERSION + ".gem"
19
+ end
20
+
21
+ task :clean do
22
+ system "rm " + path + "*.gem"
23
+ end
24
+
25
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: claiss
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Júlio Papel
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-07-02 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: 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
69
+ description: CLI application Toolbox to manage Laiss AI applications and deployments.
70
+ Some thing may not work on your environment. Use with caution!
71
+ email:
72
+ - julio.papel@gmail.com
73
+ executables:
74
+ - claiss
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - exe/claiss
79
+ - lib/claiss.rb
80
+ - lib/tasks/claiss.rake
81
+ homepage: http://rubygems.org/gems/claiss
82
+ licenses:
83
+ - MIT
84
+ metadata: {}
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubygems_version: 3.4.15
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: Laiss AI CLI application Toolbox
104
+ test_files: []