claiss 1.0.7
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 +7 -0
- data/exe/claiss +5 -0
- data/lib/claiss.rb +97 -0
- data/lib/tasks/claiss.rake +25 -0
- metadata +105 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3a27c84097fb8adb9ce3e2351651821770f6973b000557e8566b79c24428b66c
|
4
|
+
data.tar.gz: 74a986701d5b7031cd6f0fdfc9a93d18df2801bd6f1474138a30200fad9c7c73
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 05af17263512ea15e08d4742d9e2ac8d0db3f2f1d2796f805372ce3afb76d3419b79d37c6566a857da75723e606fa402324baa89c8985df528eb0d8236d1ce8d
|
7
|
+
data.tar.gz: aa9387b2cf6f4bf87cdcb9424564c31a34af908fa5664fee85c4211f29d26dad09af20068fa08e50f957152adc57a2e4e07ed6309bb174675ce01478513bc41b
|
data/exe/claiss
ADDED
data/lib/claiss.rb
ADDED
@@ -0,0 +1,97 @@
|
|
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
|
+
|
36
|
+
if !json_file.nil?
|
37
|
+
jfile = File.read(json_file)
|
38
|
+
dict = JSON.parse(jfile)
|
39
|
+
else
|
40
|
+
while input.downcase == "y" do
|
41
|
+
puts "Term to search: "
|
42
|
+
search = STDIN.gets.chomp
|
43
|
+
puts "Term to replace: "
|
44
|
+
replace = STDIN.gets.chomp
|
45
|
+
|
46
|
+
dict[search] = replace
|
47
|
+
puts "\nAdd another? Type Y \nto Start Refactoring press Enter"
|
48
|
+
input = STDIN.gets.chomp!
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
dict = {origin_path => destination_path}.merge(dict)
|
53
|
+
dict[origin_path] = destination_path
|
54
|
+
source = File.expand_path(origin_path + "/**/*", __FILE__)
|
55
|
+
Dir.glob(source).reject{ |f| File.directory?(f)}.each do |file_name|
|
56
|
+
destination = file_name
|
57
|
+
text = File.read(file_name) if !File.directory?(file_name)
|
58
|
+
|
59
|
+
dict.map do |p, i|
|
60
|
+
destination.gsub!(p, i)
|
61
|
+
if !text.nil?
|
62
|
+
text.gsub!(p, i)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
FileUtils.mkdir_p(File.dirname(destination))
|
67
|
+
File.write(destination, text) if !File.directory?(file_name)
|
68
|
+
puts "File: #{destination}, OK" if !File.directory?(file_name)
|
69
|
+
end
|
70
|
+
|
71
|
+
puts "done! your project is in the #{temp_dir} folder"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
class FixRubyPermissions < Dry::CLI::Command
|
76
|
+
argument :path, required: true, desc: "The path of your ruby project"
|
77
|
+
|
78
|
+
def call(path: nil, **)
|
79
|
+
if path.nil?
|
80
|
+
path = File.basename(Dir.getwd)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Run shell scripts to set permissions.
|
84
|
+
directories = `chmod 755 $(find #{path} -type d)`
|
85
|
+
files = `chmod 644 $(find #{path} -type f)`
|
86
|
+
bundle = `chmod 755 #{path+'/bin/bundle'}`
|
87
|
+
rails = `chmod 755 #{path+'/bin/rails'}`
|
88
|
+
rake = `chmod 755 #{path+'/bin/rake'}`
|
89
|
+
spring = `chmod 755 #{path+'/bin/spring'}`
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
register "version", Version, aliases: ["v", "-v", "--version"]
|
95
|
+
register "refactor",Refactor
|
96
|
+
register "fix_ruby_permissions",FixRubyPermissions
|
97
|
+
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.7
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Júlio Papel
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-07-03 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: []
|