Class: Kscript::KkCursorRulesUtils
- Inherits:
-
Base
- Object
- Base
- Kscript::KkCursorRulesUtils
show all
- Defined in:
- lib/kscript/plugins/kk_cursor_rules_utils.rb
Instance Attribute Summary
Attributes inherited from Base
#logger
Instance Method Summary
collapse
Methods inherited from Base
#human_output?, inherited
Constructor Details
Returns a new instance of KkCursorRulesUtils.
12
13
14
|
# File 'lib/kscript/plugins/kk_cursor_rules_utils.rb', line 12
def initialize(*_args, **opts)
super(**opts.merge(service: 'kk_cursor_rules'))
end
|
Instance Method Details
#deploy ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/kscript/plugins/kk_cursor_rules_utils.rb', line 26
def deploy
logger.kinfo('======= š Cursor Rules Deploy =======')
logger.kinfo("š
Date Time: #{Time.now}")
logger.kinfo('')
if Dir.exist?('.cursor')
logger.kinfo('Removing existing .cursor directory...')
FileUtils.rm_rf('.cursor')
end
logger.kinfo('Cloning .cursor repo from github...')
system_or_raise('git clone [email protected]:kevin197011/cursor.git .cursor')
if !File.exist?('Rakefile') && File.exist?('.cursor/Rakefile')
logger.kinfo('Moving .cursor/Rakefile to project root...')
FileUtils.mv('.cursor/Rakefile', 'Rakefile')
elsif File.exist?('.cursor/Rakefile')
logger.kinfo('Removing .cursor/Rakefile (already present in root)...')
FileUtils.rm_rf('.cursor/Rakefile')
end
if File.exist?('.cursor/push.rb')
logger.kinfo('Moving .cursor/push.rb to project root...')
FileUtils.mv('.cursor/push.rb', 'push.rb')
end
if File.exist?('.cursor/.rubocop.yml')
logger.kinfo('Moving .cursor/.rubocop.yml to project root...')
FileUtils.mv('.cursor/.rubocop.yml', '.rubocop.yml')
end
if File.exist?('.cursor/.git')
logger.kinfo('Removing .cursor/.git directory...')
FileUtils.rm_rf('.cursor/.git')
end
if File.exist?('.gitignore') && File.readlines('.gitignore').none? { |l| l.strip == '.cursor' }
logger.kinfo('Adding .cursor to .gitignore...')
File.open('.gitignore', 'a') { |f| f.puts "\n.cursor" }
end
logger.kinfo("\nā
Cursor rules deploy completed!")
end
|
#run(*args, **_opts) ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/kscript/plugins/kk_cursor_rules_utils.rb', line 16
def run(*args, **_opts)
with_error_handling do
if args[0].to_s == 'deploy'
deploy
else
logger.kwarn("Usage: #{self.class.usage}")
end
end
end
|