claiss 1.0.10

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 +95 -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: 5ef3d4170f9601194f42c8a03c6089aad440bda98a91ebce1b3a8d84a3ae21bd
4
+ data.tar.gz: 5386b3b64754fb15f7db09e85c0f6bfd53aa46ad9299ef905b7ad61ca7265d8c
5
+ SHA512:
6
+ metadata.gz: 788da6b6055fda32c443db38ce8cb4fa88057e4ca2f50560814b938adb02bec9b913fb068f1b7ae2afa09e6a8f9607cd52ca4bd91a308422e02ca728c9ce95b0
7
+ data.tar.gz: eee327c7ba60ba69ca65ed6672b7ebc886ede89a49cf1085c9bf75d9537b0364abd0401e507a8d33bfec7e8d552ec1d05511014bc71d19b87f7fa344b0697db3
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,95 @@
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.description}"
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
+
51
+ dict = {origin_path => destination_path}.merge(dict)
52
+ dict[origin_path] = destination_path
53
+ source = File.join(origin_path, "**", "{*,.*}")
54
+ Dir.glob(source, File::FNM_DOTMATCH).each do |file_name|
55
+ next if File.directory?(file_name)
56
+
57
+ destination = file_name
58
+ text = File.read(file_name)
59
+
60
+ dict.each do |p, i|
61
+ destination.gsub!(p, i)
62
+ text.gsub!(p, i)
63
+ end
64
+
65
+ FileUtils.mkdir_p(File.dirname(destination))
66
+ File.write(destination, text)
67
+ puts "File: #{destination}, OK"
68
+ end
69
+
70
+ puts "done! your project is in the #{temp_dir} folder"
71
+ end
72
+ end
73
+
74
+ class FixRubyPermissions < Dry::CLI::Command
75
+ argument :path, required: true, desc: "The path of your ruby project"
76
+
77
+ def call(path: nil, **)
78
+ if path.nil?
79
+ path = File.basename(Dir.getwd)
80
+ end
81
+
82
+ # Run shell scripts to set permissions.
83
+ directories = `chmod 755 $(find #{path} -type d)`
84
+ files = `chmod 644 $(find #{path} -type f)`
85
+ bundle = `chmod 755 #{path+'/bin/bundle'}`
86
+ rails = `chmod 755 #{path+'/bin/rails'}`
87
+ rake = `chmod 755 #{path+'/bin/rake'}`
88
+ spring = `chmod 755 #{path+'/bin/spring'}`
89
+ end
90
+ end
91
+
92
+ register "version", Version, aliases: ["v", "-v", "--version"]
93
+ register "refactor", Refactor
94
+ register "fix_ruby_permissions", FixRubyPermissions
95
+ 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.10
5
+ platform: ruby
6
+ authors:
7
+ - Júlio Papel
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-04-29 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.5.9
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: Laiss AI CLI application Toolbox
105
+ test_files: []