claiss 1.0.6

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 +73 -0
  4. data/lib/tasks/claiss.rake +25 -0
  5. metadata +105 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f7b117b78d9275e924380505e1ca1ddb0818490cd1532dd5a31de08b199e1b84
4
+ data.tar.gz: 39ba11f151fe5ecd59cc291011ef8611e61f4a83cf4d95427bd3589643be7353
5
+ SHA512:
6
+ metadata.gz: 4265f73dadbbae241ca6d6dab87b121f5fc931c9f2044c8a159d52031c1b629eec97c4439dbd7879efbc48ad5bb6c36075d40cd8c7c3a5d12a87117d6b580efa
7
+ data.tar.gz: b217629b6cc0da245dfe5e1e3b33123a22f52d7037b6c8900688d32291b730a75ef76152be7c059fce5bd2b9d7fb5c932f11fa098bab3355a22a28acb3d92c26
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,73 @@
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, desc: "Provide a Ruby hash file"
25
+
26
+ def call(path:, json_file: nil, **)
27
+ dict = {}
28
+ search = ""
29
+ replace = ""
30
+ input = "y"
31
+ temp_dir = "/refactored-#{Time.now.to_i.to_s}"
32
+ origin_path = File.expand_path(path)
33
+ destination_path = File.expand_path("."+ temp_dir)
34
+
35
+ if !json_file.nil?
36
+ jfile = File.read(json_file)
37
+ dict = JSON.parse(jfile)
38
+ else
39
+ while input.downcase == "y" do
40
+ puts "Term to search: "
41
+ search = STDIN.gets.chomp
42
+ puts "Term to replace: "
43
+ replace = STDIN.gets.chomp
44
+
45
+ dict[search] = replace
46
+ puts "\nAdd another? Type Y \nto Start Refactoring press Enter"
47
+ input = STDIN.gets.chomp!
48
+ end
49
+ end
50
+ source = File.expand_path(origin_path + "/**/*", __FILE__)
51
+ Dir.glob(source).reject{ |f| File.directory?(f)}.each do |file_name|
52
+ destination = file_name
53
+ text = File.read(file_name) if !File.directory?(file_name)
54
+
55
+ dict.map do |p, i|
56
+ destination.gsub!(p, i)
57
+ if !text.nil?
58
+ text.gsub!(p, i)
59
+ end
60
+ end
61
+
62
+ FileUtils.mkdir_p(File.dirname(destination))
63
+ File.write(destination, text) if !File.directory?(file_name)
64
+ puts "File: #{destination}, OK" if !File.directory?(file_name)
65
+ end
66
+ puts "done!"
67
+
68
+ end
69
+ end
70
+
71
+ register "version", Version, aliases: ["v", "-v", "--version"]
72
+ register "refactor",Refactor
73
+ end
@@ -0,0 +1,25 @@
1
+ GEM_NAME = "claiss"
2
+ GEM_VERSION = "1.0.0"
3
+
4
+ namespace :claiss do
5
+ path = "/home/rails/laiss/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,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: claiss
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.6
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
+ documentation_uri: https://github.com/JulioPapel/claiss/blob/main/readme.md
86
+ post_install_message:
87
+ rdoc_options: []
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: 2.7.0
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ requirements: []
101
+ rubygems_version: 3.4.15
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: Laiss AI CLI application Toolbox
105
+ test_files: []