webscraper_framework 0.1.701 → 0.1.702
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.
- checksums.yaml +4 -4
- data/lib/webscraper_framework/cli.rb +69 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f745de850b2f5d1128bfebed5430febc76015c53
|
4
|
+
data.tar.gz: 68dfb2afca3f8b11ee9952f0c1ba002731f47747
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54c6c7a9e2a327b33653c5650f8daa8463733d488dc95c04e27541c8b2485990acfda4534d9500b7eaef4290a90b6f2986e77a799160963cb2f8c698240612db
|
7
|
+
data.tar.gz: 21c10c9389e73fa51abeb2e7ede40025373ba1769983a06cd9a013d20ee5534f7ed04707f4ffd95848fb8eb17f849e719afa0d8c66eab39634d1d05fcf2b5943
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'colorize'
|
2
|
+
require 'readline'
|
3
|
+
|
4
|
+
module WebscraperFramework
|
5
|
+
class CLI
|
6
|
+
|
7
|
+
def initialize(arguments)
|
8
|
+
|
9
|
+
@action = arguments[0]
|
10
|
+
end
|
11
|
+
|
12
|
+
def start
|
13
|
+
if @action == "new"
|
14
|
+
create_project
|
15
|
+
else
|
16
|
+
puts "Invalid command, exiting".red.on_white.bold
|
17
|
+
puts "The only valid command is 'new'".green.on_white.bold
|
18
|
+
end
|
19
|
+
goodbye
|
20
|
+
end
|
21
|
+
|
22
|
+
def create_project
|
23
|
+
puts "Hello! Which travel inspiration will you like to explore for your next trip?".green.bold
|
24
|
+
puts "\nThis is a work in progress... nothing works.".blue.bold
|
25
|
+
puts "\nType 'exit' to quit".red.bold
|
26
|
+
project_name = nil
|
27
|
+
|
28
|
+
while project_name == nil
|
29
|
+
input = prompt_input("Choose a name for your project 🔥 ")
|
30
|
+
if File.directory?("./#{input}")
|
31
|
+
puts "\nA folder with that name already exists, choose another name:"
|
32
|
+
else
|
33
|
+
project_name = input
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
puts `mkdir #{project_name}`
|
38
|
+
if File.directory?("./#{project_name}")
|
39
|
+
puts "\nSuccessfully created directory #{project_name}".red.bold
|
40
|
+
else
|
41
|
+
puts "\n Something went wrong. Exiting...".red.bold
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
def prompt_input(message)
|
49
|
+
input = nil
|
50
|
+
|
51
|
+
# while true # user_input != "exit"
|
52
|
+
input = Readline.readline(message, true).strip
|
53
|
+
goodbye if input.downcase === "exit"
|
54
|
+
|
55
|
+
input = input.to_s
|
56
|
+
|
57
|
+
# end
|
58
|
+
return input
|
59
|
+
end
|
60
|
+
|
61
|
+
def goodbye
|
62
|
+
puts "\nFarewell, traveler! May the wind take you somewhere new!".red.on_white.bold
|
63
|
+
exit
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
# puts WebscraperFramework::CLI.new.start
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webscraper_framework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.702
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rene van Pelt
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- lib/webscraper_framework.rb
|
65
65
|
- lib/webscraper_framework/base.rb
|
66
66
|
- lib/webscraper_framework/base_model.rb
|
67
|
+
- lib/webscraper_framework/cli.rb
|
67
68
|
homepage:
|
68
69
|
licenses: []
|
69
70
|
metadata: {}
|