boilercode 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.standard.yml +1 -1
- data/CHANGELOG.md +1 -1
- data/Gemfile.lock +23 -17
- data/README.md +1 -1
- data/boilercode.gemspec +15 -10
- data/exe/boilercode +3 -3
- data/lib/boilercode/cli.rb +6 -0
- data/lib/boilercode/commands/dotfiles/download.rb +71 -0
- data/lib/boilercode/commands/dotfiles/find.rb +40 -0
- data/lib/boilercode/commands/dotfiles.rb +35 -0
- data/lib/boilercode/file_client.rb +2 -0
- data/lib/boilercode/version.rb +1 -1
- metadata +8 -13
- data/lib/boilercode/templates/.gitkeep +0 -1
- data/lib/boilercode/templates/drive/search/.gitkeep +0 -0
- data/lib/boilercode/templates/drive/upload/.gitkeep +0 -0
- data/lib/boilercode/templates/login/.gitkeep +0 -0
- data/lib/boilercode/templates/news/.gitkeep +0 -0
- data/lib/boilercode/templates/snippets/create/.gitkeep +0 -0
- data/lib/boilercode/templates/snippets/search/.gitkeep +0 -0
- data/rename.rb +0 -1
- /data/lib/boilercode/templates/{bookmarks/create → dotfiles/download}/.gitkeep +0 -0
- /data/lib/boilercode/templates/{bookmarks/search → dotfiles/find}/.gitkeep +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5062141cf6e6f9e851bc5ca5eff41250109b226f4c7e069508b0c48d061b1623
|
4
|
+
data.tar.gz: 3466097ea9ff6feeac8cea0b99602e649617a615628582493f9dc84e938d529e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c70e8d8629d0a56d39029b3bf85166bca7bfa3cea831f26aa62275bbb523e049bcd3f35fa89d3e2abcf5273da675c8d04d6f50690cc20840b88f8d0d9c4068b5
|
7
|
+
data.tar.gz: 065a4e1155befae11c77925281889c473c869d2b8a7d7175e40883b72a525905e2eeba728452962d3031ea23c6c54c9e13d32e073d7b82b78bfc504c0c46580e
|
data/.standard.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
boilercode (0.1.
|
4
|
+
boilercode (0.1.1)
|
5
5
|
clipboard
|
6
6
|
httparty
|
7
7
|
pastel
|
@@ -14,7 +14,7 @@ PATH
|
|
14
14
|
GEM
|
15
15
|
remote: https://rubygems.org/
|
16
16
|
specs:
|
17
|
-
addressable (2.8.
|
17
|
+
addressable (2.8.4)
|
18
18
|
public_suffix (>= 2.0.2, < 6.0)
|
19
19
|
ast (2.4.2)
|
20
20
|
byebug (11.1.3)
|
@@ -31,43 +31,44 @@ GEM
|
|
31
31
|
kramdown (2.4.0)
|
32
32
|
rexml
|
33
33
|
language_server-protocol (3.17.0.3)
|
34
|
+
lint_roller (1.0.0)
|
34
35
|
mini_mime (1.1.2)
|
35
36
|
multi_xml (0.6.0)
|
36
|
-
parallel (1.
|
37
|
-
parser (3.2.2.
|
37
|
+
parallel (1.23.0)
|
38
|
+
parser (3.2.2.1)
|
38
39
|
ast (~> 2.4.1)
|
39
40
|
pastel (0.8.0)
|
40
41
|
tty-color (~> 0.5)
|
41
42
|
public_suffix (5.0.1)
|
42
43
|
rainbow (3.1.1)
|
43
44
|
rake (13.0.6)
|
44
|
-
regexp_parser (2.
|
45
|
+
regexp_parser (2.8.0)
|
45
46
|
rexml (3.2.5)
|
46
|
-
rouge (4.1.
|
47
|
+
rouge (4.1.1)
|
47
48
|
rspec (3.12.0)
|
48
49
|
rspec-core (~> 3.12.0)
|
49
50
|
rspec-expectations (~> 3.12.0)
|
50
51
|
rspec-mocks (~> 3.12.0)
|
51
|
-
rspec-core (3.12.
|
52
|
+
rspec-core (3.12.2)
|
52
53
|
rspec-support (~> 3.12.0)
|
53
|
-
rspec-expectations (3.12.
|
54
|
+
rspec-expectations (3.12.3)
|
54
55
|
diff-lcs (>= 1.2.0, < 2.0)
|
55
56
|
rspec-support (~> 3.12.0)
|
56
57
|
rspec-mocks (3.12.5)
|
57
58
|
diff-lcs (>= 1.2.0, < 2.0)
|
58
59
|
rspec-support (~> 3.12.0)
|
59
60
|
rspec-support (3.12.0)
|
60
|
-
rubocop (1.
|
61
|
+
rubocop (1.50.2)
|
61
62
|
json (~> 2.3)
|
62
63
|
parallel (~> 1.10)
|
63
64
|
parser (>= 3.2.0.0)
|
64
65
|
rainbow (>= 2.2.2, < 4.0)
|
65
66
|
regexp_parser (>= 1.8, < 3.0)
|
66
67
|
rexml (>= 3.2.5, < 4.0)
|
67
|
-
rubocop-ast (>= 1.
|
68
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
68
69
|
ruby-progressbar (~> 1.7)
|
69
70
|
unicode-display_width (>= 2.4.0, < 3.0)
|
70
|
-
rubocop-ast (1.28.
|
71
|
+
rubocop-ast (1.28.1)
|
71
72
|
parser (>= 3.2.1.0)
|
72
73
|
rubocop-performance (1.16.0)
|
73
74
|
rubocop (>= 1.7.0, < 2.0)
|
@@ -79,16 +80,23 @@ GEM
|
|
79
80
|
simplecov_json_formatter (~> 0.1)
|
80
81
|
simplecov-html (0.12.3)
|
81
82
|
simplecov_json_formatter (0.1.4)
|
82
|
-
standard (1.
|
83
|
+
standard (1.28.4)
|
83
84
|
language_server-protocol (~> 3.17.0.2)
|
84
|
-
|
85
|
+
lint_roller (~> 1.0)
|
86
|
+
rubocop (~> 1.50.2)
|
87
|
+
standard-custom (~> 1.0.0)
|
88
|
+
standard-performance (~> 1.0.1)
|
89
|
+
standard-custom (1.0.0)
|
90
|
+
lint_roller (~> 1.0)
|
91
|
+
standard-performance (1.0.1)
|
92
|
+
lint_roller (~> 1.0)
|
85
93
|
rubocop-performance (~> 1.16.0)
|
86
94
|
strings (0.2.1)
|
87
95
|
strings-ansi (~> 0.2)
|
88
96
|
unicode-display_width (>= 1.5, < 3.0)
|
89
97
|
unicode_utils (~> 1.4)
|
90
98
|
strings-ansi (0.2.0)
|
91
|
-
thor (1.2.
|
99
|
+
thor (1.2.2)
|
92
100
|
tty-color (0.6.0)
|
93
101
|
tty-cursor (0.7.1)
|
94
102
|
tty-link (0.1.1)
|
@@ -119,9 +127,7 @@ GEM
|
|
119
127
|
wisper (2.0.1)
|
120
128
|
|
121
129
|
PLATFORMS
|
122
|
-
arm64-darwin-21
|
123
130
|
arm64-darwin-22
|
124
|
-
x86_64-linux
|
125
131
|
|
126
132
|
DEPENDENCIES
|
127
133
|
boilercode!
|
@@ -134,4 +140,4 @@ DEPENDENCIES
|
|
134
140
|
webmock
|
135
141
|
|
136
142
|
BUNDLED WITH
|
137
|
-
2.4.
|
143
|
+
2.4.13
|
data/README.md
CHANGED
@@ -36,4 +36,4 @@ Everyone interacting in the Boilercode project's codebases, issue trackers, chat
|
|
36
36
|
|
37
37
|
## Copyright
|
38
38
|
|
39
|
-
Copyright (c) 2023 Leo Policastro. See [MIT License](LICENSE.txt) for further details.
|
39
|
+
Copyright (c) 2023 Leo Policastro. See [MIT License](LICENSE.txt) for further details.
|
data/boilercode.gemspec
CHANGED
@@ -35,6 +35,7 @@ Gem::Specification.new do |spec|
|
|
35
35
|
# For more information and examples about making a new gem, check out our
|
36
36
|
# guide at: https://bundler.io/guides/creating_gem.html
|
37
37
|
|
38
|
+
|
38
39
|
# Draw various frames and boxes in terminal window.
|
39
40
|
# spec.add_dependency "tty-box", "~> 0.7"
|
40
41
|
|
@@ -45,7 +46,7 @@ Gem::Specification.new do |spec|
|
|
45
46
|
# spec.add_dependency "tty-command", "~> 0.10"
|
46
47
|
|
47
48
|
# Define, read and write app configurations.
|
48
|
-
# spec.add_dependency "tty-config"
|
49
|
+
# spec.add_dependency "tty-config", "~> 0.4"
|
49
50
|
|
50
51
|
# Terminal cursor positioning, visibility and text manipulation.
|
51
52
|
# spec.add_dependency "tty-cursor", "~> 0.7"
|
@@ -63,13 +64,13 @@ Gem::Specification.new do |spec|
|
|
63
64
|
# spec.add_dependency "tty-font", "~> 0.5"
|
64
65
|
|
65
66
|
# Hyperlinks in terminal.
|
66
|
-
spec.add_dependency "tty-link"
|
67
|
+
# spec.add_dependency "tty-link", "~> 0.1"
|
67
68
|
|
68
69
|
# A readable, structured and beautiful logging for the terminal.
|
69
|
-
spec.add_dependency "tty-logger"
|
70
|
+
# spec.add_dependency "tty-logger", "~> 0.6"
|
70
71
|
|
71
72
|
# Convert a markdown document or text into a terminal friendly output.
|
72
|
-
spec.add_dependency "tty-markdown"
|
73
|
+
# spec.add_dependency "tty-markdown", "~> 0.7"
|
73
74
|
|
74
75
|
# Parser for command line arguments, keywords and options.
|
75
76
|
# spec.add_dependency "tty-option", "~> 0.1"
|
@@ -78,22 +79,22 @@ Gem::Specification.new do |spec|
|
|
78
79
|
# spec.add_dependency "tty-pager", "~> 0.14"
|
79
80
|
|
80
81
|
# Draw pie charts in your terminal window.
|
81
|
-
# spec.add_dependency "tty-pie"
|
82
|
+
# spec.add_dependency "tty-pie", "~> 0.4"
|
82
83
|
|
83
84
|
# Detect different operating systems.
|
84
|
-
# spec.add_dependency "tty-platform"
|
85
|
+
# spec.add_dependency "tty-platform", "~> 0.3"
|
85
86
|
|
86
87
|
# A flexible and extensible progress bar for terminal applications.
|
87
|
-
# spec.add_dependency "tty-progressbar"
|
88
|
+
# spec.add_dependency "tty-progressbar", "~> 0.18"
|
88
89
|
|
89
90
|
# A beautiful and powerful interactive command line prompt.
|
90
|
-
spec.add_dependency "tty-prompt"
|
91
|
+
# spec.add_dependency "tty-prompt", "~> 0.23"
|
91
92
|
|
92
93
|
# Terminal screen properties detection.
|
93
|
-
# spec.add_dependency "tty-screen"
|
94
|
+
# spec.add_dependency "tty-screen", "~> 0.8"
|
94
95
|
|
95
96
|
# A terminal spinner for tasks with non-deterministic time.
|
96
|
-
# spec.add_dependency "tty-spinner"
|
97
|
+
# spec.add_dependency "tty-spinner", "~> 0.9"
|
97
98
|
|
98
99
|
# A flexible and intuitive table output generator.
|
99
100
|
# spec.add_dependency "tty-table", "~> 0.12"
|
@@ -103,6 +104,10 @@ Gem::Specification.new do |spec|
|
|
103
104
|
|
104
105
|
# Platform independent implementation of Unix which command.
|
105
106
|
# spec.add_dependency "tty-which", "~> 0.4"
|
107
|
+
spec.add_dependency "tty-link"
|
108
|
+
spec.add_dependency "tty-logger"
|
109
|
+
spec.add_dependency "tty-markdown"
|
110
|
+
spec.add_dependency "tty-prompt"
|
106
111
|
|
107
112
|
spec.add_dependency "clipboard"
|
108
113
|
spec.add_dependency "httparty"
|
data/exe/boilercode
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
lib_path = File.expand_path(
|
4
|
+
lib_path = File.expand_path('../lib', __dir__)
|
5
5
|
$:.unshift(lib_path) if !$:.include?(lib_path)
|
6
|
-
require
|
6
|
+
require 'boilercode/cli'
|
7
7
|
|
8
|
-
Signal.trap(
|
8
|
+
Signal.trap('INT') do
|
9
9
|
warn("\n#{caller.join("\n")}: interrupted")
|
10
10
|
exit(1)
|
11
11
|
end
|
data/lib/boilercode/cli.rb
CHANGED
@@ -18,6 +18,12 @@ module Boilercode
|
|
18
18
|
end
|
19
19
|
map %w[--version -v] => :version
|
20
20
|
|
21
|
+
require_relative "commands/dotfiles"
|
22
|
+
register Boilercode::Commands::Dotfiles, "dotfiles", "dotfiles [SUBCOMMAND]", "Command description..."
|
23
|
+
|
24
|
+
require_relative "commands/dotfiles"
|
25
|
+
register Boilercode::Commands::Dotfiles, "dotfiles", "dotfiles [SUBCOMMAND]", "Command description..."
|
26
|
+
|
21
27
|
require_relative "commands/drive"
|
22
28
|
register Boilercode::Commands::Drive, "drive", "drive [SUBCOMMAND]", "Manage your file uploads"
|
23
29
|
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../../boilercode"
|
4
|
+
|
5
|
+
module Boilercode
|
6
|
+
module Commands
|
7
|
+
class Dotfiles
|
8
|
+
class Download < Boilercode::Command
|
9
|
+
def initialize(options)
|
10
|
+
@options = options
|
11
|
+
end
|
12
|
+
|
13
|
+
def execute(input: $stdin, output: $stdout, page: 1)
|
14
|
+
res = client.get("/dotfiles?page=#{page}")
|
15
|
+
if res.success?
|
16
|
+
output.puts handle_search_response(res)
|
17
|
+
else
|
18
|
+
output.puts pastel.red res.inspect
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def handle_search_response(res)
|
23
|
+
headers = res.headers
|
24
|
+
response = parse_json(res)
|
25
|
+
Dir.chdir(File.expand_path("~"))
|
26
|
+
if response.empty?
|
27
|
+
pastel.red "No uploads found, try updating your query."
|
28
|
+
elsif prompt.yes?("Do you want to download all dotfiles?")
|
29
|
+
download_all(response)
|
30
|
+
else
|
31
|
+
handle_selecting_dotfiles(response, headers)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def download_all(response)
|
36
|
+
response.each do |upload|
|
37
|
+
download(upload["url"])
|
38
|
+
puts pastel.green(upload["url"])
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def handle_selecting_dotfiles(response, headers)
|
43
|
+
dotfiles = prompt.multi_select("Choose your dotfiles:", choices(response, headers))
|
44
|
+
# choice = dotfiles.first
|
45
|
+
# if choice == "Next Page"
|
46
|
+
# return execute(page: headers["Current-Page"].to_i + 1)
|
47
|
+
# end
|
48
|
+
dotfiles.each do |file|
|
49
|
+
upload = response.find { |dotfile| dotfile["filename"] == file }
|
50
|
+
|
51
|
+
download(upload["url"]) if download_file?
|
52
|
+
puts pastel.green(upload["url"])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def choices(response, headers)
|
57
|
+
choices = response.map { |upload| upload["filename"] }
|
58
|
+
|
59
|
+
choices << "Next Page" if headers["Total-Pages"].to_i > 1
|
60
|
+
choices
|
61
|
+
end
|
62
|
+
|
63
|
+
def download_file?
|
64
|
+
ask("Do you want to download the file? (y/n)") == "y"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# here
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../../boilercode"
|
4
|
+
|
5
|
+
module Boilercode
|
6
|
+
module Commands
|
7
|
+
class Dotfiles
|
8
|
+
class Find < Boilercode::Command
|
9
|
+
def initialize(options)
|
10
|
+
@options = options
|
11
|
+
end
|
12
|
+
|
13
|
+
def execute(input: $stdin, output: $stdout)
|
14
|
+
look_in_home_directory = prompt.yes?("Search for dotfiles in home directory or specify a directory?")
|
15
|
+
directory = if look_in_home_directory
|
16
|
+
File.expand_path("~")
|
17
|
+
else
|
18
|
+
prompt.ask("Please enter the directory to search for dotfiles")
|
19
|
+
end
|
20
|
+
dotfiles = Dir.glob("#{directory}/.*")
|
21
|
+
# remove . and .. from the list of files
|
22
|
+
dotfiles = dotfiles.reject { |file| file == "." || file == ".." }
|
23
|
+
# remove directories from the list of files
|
24
|
+
dotfiles = dotfiles.reject { |file| File.directory?(file) }
|
25
|
+
|
26
|
+
files_to_upload = prompt.multi_select("Select dotfiles to upload", dotfiles)
|
27
|
+
files_to_upload.each do |file|
|
28
|
+
file_client(file).upload
|
29
|
+
puts pastel.green "Uploaded #{file}"
|
30
|
+
end
|
31
|
+
output.puts "OK"
|
32
|
+
end
|
33
|
+
|
34
|
+
def file_client(file)
|
35
|
+
Boilercode::FileClient.new(file, folder_path: "dotfiles")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "thor"
|
4
|
+
|
5
|
+
module Boilercode
|
6
|
+
module Commands
|
7
|
+
class Dotfiles < Thor
|
8
|
+
namespace :dotfiles
|
9
|
+
|
10
|
+
desc "download", "Download dotfiles to home directory"
|
11
|
+
method_option :help, aliases: "-h", type: :boolean,
|
12
|
+
desc: "Display usage information"
|
13
|
+
def download(*)
|
14
|
+
if options[:help]
|
15
|
+
invoke :help, ["download"]
|
16
|
+
else
|
17
|
+
require_relative "dotfiles/download"
|
18
|
+
Boilercode::Commands::Dotfiles::Download.new(options).execute
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "find", "Find local dotfiles and upload to dotfiles folder in Boilercode Drive"
|
23
|
+
method_option :help, aliases: "-h", type: :boolean,
|
24
|
+
desc: "Display usage information"
|
25
|
+
def find(*)
|
26
|
+
if options[:help]
|
27
|
+
invoke :help, ["find"]
|
28
|
+
else
|
29
|
+
require_relative "dotfiles/find"
|
30
|
+
Boilercode::Commands::Dotfiles::Find.new(options).execute
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/boilercode/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boilercode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leo Policastro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-link
|
@@ -221,6 +221,9 @@ files:
|
|
221
221
|
- lib/boilercode/commands/bookmarks.rb
|
222
222
|
- lib/boilercode/commands/bookmarks/create.rb
|
223
223
|
- lib/boilercode/commands/bookmarks/search.rb
|
224
|
+
- lib/boilercode/commands/dotfiles.rb
|
225
|
+
- lib/boilercode/commands/dotfiles/download.rb
|
226
|
+
- lib/boilercode/commands/dotfiles/find.rb
|
224
227
|
- lib/boilercode/commands/drive.rb
|
225
228
|
- lib/boilercode/commands/drive/search.rb
|
226
229
|
- lib/boilercode/commands/drive/upload.rb
|
@@ -231,17 +234,9 @@ files:
|
|
231
234
|
- lib/boilercode/commands/snippets/search.rb
|
232
235
|
- lib/boilercode/config.rb
|
233
236
|
- lib/boilercode/file_client.rb
|
234
|
-
- lib/boilercode/templates/.gitkeep
|
235
|
-
- lib/boilercode/templates/
|
236
|
-
- lib/boilercode/templates/bookmarks/search/.gitkeep
|
237
|
-
- lib/boilercode/templates/drive/search/.gitkeep
|
238
|
-
- lib/boilercode/templates/drive/upload/.gitkeep
|
239
|
-
- lib/boilercode/templates/login/.gitkeep
|
240
|
-
- lib/boilercode/templates/news/.gitkeep
|
241
|
-
- lib/boilercode/templates/snippets/create/.gitkeep
|
242
|
-
- lib/boilercode/templates/snippets/search/.gitkeep
|
237
|
+
- lib/boilercode/templates/dotfiles/download/.gitkeep
|
238
|
+
- lib/boilercode/templates/dotfiles/find/.gitkeep
|
243
239
|
- lib/boilercode/version.rb
|
244
|
-
- rename.rb
|
245
240
|
- sig/boilercode.rbs
|
246
241
|
homepage: https://github.com/leopolicastro/boilercode
|
247
242
|
licenses:
|
@@ -265,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
265
260
|
- !ruby/object:Gem::Version
|
266
261
|
version: '0'
|
267
262
|
requirements: []
|
268
|
-
rubygems_version: 3.4.
|
263
|
+
rubygems_version: 3.4.13
|
269
264
|
signing_key:
|
270
265
|
specification_version: 4
|
271
266
|
summary: BoilerCode CLI
|
@@ -1 +0,0 @@
|
|
1
|
-
#
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/rename.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# rename all folde
|
File without changes
|
File without changes
|