rubiclifier 2.0.0 → 2.1.3
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/Gemfile +6 -0
- data/lib/base_application.rb +26 -5
- data/lib/cli/rubiclifier_cli.rb +5 -0
- data/lib/cli/template_hydrator.rb +1 -0
- data/lib/database.rb +4 -3
- data/lib/feature.rb +1 -0
- data/lib/server.rb +13 -0
- data/project_template/PROJECT_NAME.gemspec.erb +1 -1
- data/project_template/lib/PROJECT_NAME.rb.erb +9 -0
- data/project_template/lib/server.rb +8 -0
- data/project_template/public/index.html.erb +12 -0
- metadata +10 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 968bd3787bc49db6d701faae3a1c325eb33ac5efa8f0842f978cb6a6fed2b0f4
|
|
4
|
+
data.tar.gz: aad58334d2272e3741b90045f71d1aab50ae99b597bcdc7af31a4d63bfb75d1e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 073baf0f68fba15496f41daf5912657f08d046d8434760de34ce99045f024d7574f84cde11ca1e71280342ba12134010a5ec6dcfd0adccd0e97514121539a88f
|
|
7
|
+
data.tar.gz: 7352b51728777587902fda0cbe7f360f25f072295082835e59186ff174fce87b9adc0728d844f487e610af13598cf03d5aafb6a6e936d49ca1a0fb2d8bf2fce9
|
data/Gemfile
CHANGED
data/lib/base_application.rb
CHANGED
|
@@ -18,20 +18,36 @@ module Rubiclifier
|
|
|
18
18
|
def call
|
|
19
19
|
show_help if args.command == "help" || args.boolean("help", "h")
|
|
20
20
|
setup_or_fail if needs_setup?
|
|
21
|
-
|
|
21
|
+
if Feature.enabled?(Feature::SERVER)
|
|
22
|
+
run_server
|
|
23
|
+
else
|
|
24
|
+
run_application
|
|
25
|
+
end
|
|
22
26
|
end
|
|
23
27
|
|
|
24
28
|
def show_help
|
|
25
29
|
raise NotImplementedError
|
|
26
30
|
end
|
|
27
31
|
|
|
32
|
+
def run_server
|
|
33
|
+
raise NotImplementedError
|
|
34
|
+
end
|
|
35
|
+
|
|
28
36
|
def run_application
|
|
29
37
|
raise NotImplementedError
|
|
30
38
|
end
|
|
31
39
|
|
|
40
|
+
def run_server
|
|
41
|
+
server_class.hydrate
|
|
42
|
+
server_class.run!
|
|
43
|
+
end
|
|
44
|
+
|
|
32
45
|
def additional_setup
|
|
33
46
|
end
|
|
34
47
|
|
|
48
|
+
def post_setup_message
|
|
49
|
+
end
|
|
50
|
+
|
|
35
51
|
def not_setup
|
|
36
52
|
end
|
|
37
53
|
|
|
@@ -67,7 +83,7 @@ module Rubiclifier
|
|
|
67
83
|
|
|
68
84
|
def brew_dependencies_installed?
|
|
69
85
|
all_brew_dependencies.all? do |dep|
|
|
70
|
-
system("brew list #{dep} &> /dev/null")
|
|
86
|
+
system("/usr/local/bin/brew list #{dep} &> /dev/null")
|
|
71
87
|
end
|
|
72
88
|
end
|
|
73
89
|
|
|
@@ -112,6 +128,7 @@ module Rubiclifier
|
|
|
112
128
|
setup_as_background_service
|
|
113
129
|
else
|
|
114
130
|
puts("Finished setup! Run with `".green + "#{executable_name}" + "`".green)
|
|
131
|
+
post_setup_message
|
|
115
132
|
end
|
|
116
133
|
exit
|
|
117
134
|
elsif !settings.all?(&:is_setup?) || !brew_dependencies_installed?
|
|
@@ -129,15 +146,19 @@ module Rubiclifier
|
|
|
129
146
|
puts
|
|
130
147
|
print("Would you like this script to set it up for you? (y/n) ")
|
|
131
148
|
if STDIN.gets.chomp.downcase == "y"
|
|
132
|
-
|
|
133
|
-
|
|
149
|
+
unless system("ls \"$HOME/.local/bin/serviceman\" &> /dev/null")
|
|
150
|
+
puts "Installing serviceman..."
|
|
151
|
+
system("-sL https://webinstall.dev/serviceman | bash")
|
|
152
|
+
end
|
|
134
153
|
puts "Adding #{executable_name} as a service..."
|
|
135
|
-
system("serviceman add --name #{executable_name} #{executable_name}")
|
|
154
|
+
system("$HOME/.local/bin/serviceman add --name #{executable_name} #{executable_name}")
|
|
136
155
|
puts
|
|
137
156
|
puts("Finished setup! The service is set to run in the background!".green)
|
|
157
|
+
post_setup_message
|
|
138
158
|
else
|
|
139
159
|
puts
|
|
140
160
|
puts("Finished setup!".green)
|
|
161
|
+
post_setup_message
|
|
141
162
|
end
|
|
142
163
|
end
|
|
143
164
|
end
|
data/lib/cli/rubiclifier_cli.rb
CHANGED
|
@@ -16,6 +16,7 @@ class RubiclifierCli < Rubiclifier::BaseApplication
|
|
|
16
16
|
puts(' --homebrew "[first [second]]" | Require specific homebrew kegs')
|
|
17
17
|
puts(" --idle-detection | Generate with ability to detect if user is idle")
|
|
18
18
|
puts(" --notifications | Generate with notification functionality")
|
|
19
|
+
puts(" --server | Generate with server")
|
|
19
20
|
puts(" --settings | Generate with persistent setting functionality")
|
|
20
21
|
puts
|
|
21
22
|
exit
|
|
@@ -45,6 +46,10 @@ class RubiclifierCli < Rubiclifier::BaseApplication
|
|
|
45
46
|
unless template_hydrator.feature_enabled?(Rubiclifier::Feature::DATABASE)
|
|
46
47
|
system("rm #{project_name}/migrations.rb")
|
|
47
48
|
end
|
|
49
|
+
unless template_hydrator.feature_enabled?(Rubiclifier::Feature::SERVER)
|
|
50
|
+
system("rm #{project_name}/lib/server.rb")
|
|
51
|
+
system("rm -rf #{project_name}/public")
|
|
52
|
+
end
|
|
48
53
|
puts("Finished creating project #{project_name}! Build out the application in #{project_name}/lib/#{project_name}.rb".green)
|
|
49
54
|
end
|
|
50
55
|
|
|
@@ -35,6 +35,7 @@ class TemplateHydrator
|
|
|
35
35
|
(Rubiclifier::Feature::DATABASE if (args.boolean("database") || include_settings?)),
|
|
36
36
|
(Rubiclifier::Feature::IDLE_DETECTION if args.boolean("idle-detection")),
|
|
37
37
|
(Rubiclifier::Feature::NOTIFICATIONS if args.boolean("notifications")),
|
|
38
|
+
(Rubiclifier::Feature::SERVER if args.boolean("server")),
|
|
38
39
|
].compact
|
|
39
40
|
end
|
|
40
41
|
|
data/lib/database.rb
CHANGED
|
@@ -38,13 +38,14 @@ module Rubiclifier
|
|
|
38
38
|
|
|
39
39
|
def self.save_setting(key, value, is_secret:)
|
|
40
40
|
salt = "NULL"
|
|
41
|
-
|
|
41
|
+
output_value = "NULL"
|
|
42
|
+
if is_secret && value
|
|
42
43
|
salt, encrypted = Cipher.encrypt(value)
|
|
43
44
|
salt = "'#{salt}'"
|
|
44
|
-
|
|
45
|
+
output_value = "'#{encrypted}'"
|
|
45
46
|
end
|
|
46
47
|
conn.execute("DELETE FROM settings WHERE key = '#{key}';")
|
|
47
|
-
conn.execute("INSERT INTO settings (key, value, salt) VALUES('#{key}',
|
|
48
|
+
conn.execute("INSERT INTO settings (key, value, salt) VALUES('#{key}', #{output_value}, #{salt});")
|
|
48
49
|
end
|
|
49
50
|
|
|
50
51
|
def self.migrate_if_needed(migrations_location)
|
data/lib/feature.rb
CHANGED
data/lib/server.rb
ADDED
|
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
|
|
|
5
5
|
s.summary = "SUMMARY HERE"
|
|
6
6
|
s.authors = ["AUTHOR NAME"]
|
|
7
7
|
s.email = "AUTHOR EMAIL"
|
|
8
|
-
s.files = Dir.glob("{lib}/**/*") + ["Gemfile"]
|
|
8
|
+
s.files = Dir.glob("{lib<%= ",public" if feature_enabled?(Rubiclifier::Feature::SERVER) %>}/**/*") + ["Gemfile"]
|
|
9
9
|
s.homepage = "https://rubygems.org/gems/<%= project_name %>"
|
|
10
10
|
s.metadata = { "source_code_uri" => "https://github.com/PATH_TO_PROJECT" }
|
|
11
11
|
s.require_path = "lib"
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
require "rubiclifier"
|
|
2
|
+
<%- if feature_enabled?(Rubiclifier::Feature::SERVER) -%>
|
|
3
|
+
require_relative "./server.rb"
|
|
4
|
+
<%- end -%>
|
|
2
5
|
|
|
3
6
|
class <%= project_name_camel_case %> < Rubiclifier::BaseApplication
|
|
4
7
|
def show_help
|
|
@@ -15,12 +18,18 @@ class <%= project_name_camel_case %> < Rubiclifier::BaseApplication
|
|
|
15
18
|
exit
|
|
16
19
|
end
|
|
17
20
|
|
|
21
|
+
<%- if feature_enabled?(Rubiclifier::Feature::SERVER) -%>
|
|
22
|
+
def server_class
|
|
23
|
+
Server
|
|
24
|
+
end
|
|
25
|
+
<%- else -%>
|
|
18
26
|
def run_application
|
|
19
27
|
while true
|
|
20
28
|
puts "Running!"
|
|
21
29
|
sleep 5
|
|
22
30
|
end
|
|
23
31
|
end
|
|
32
|
+
<%- end -%>
|
|
24
33
|
<%- if !features.empty? -%>
|
|
25
34
|
|
|
26
35
|
def features
|
metadata
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rubiclifier
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kyle Grinstead
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-07-
|
|
11
|
+
date: 2020-07-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
|
-
description:
|
|
13
|
+
description:
|
|
14
14
|
email: kyleag@hey.com
|
|
15
15
|
executables:
|
|
16
16
|
- rubiclifier
|
|
@@ -31,6 +31,7 @@ files:
|
|
|
31
31
|
- lib/idle_detector.rb
|
|
32
32
|
- lib/notification.rb
|
|
33
33
|
- lib/rubiclifier.rb
|
|
34
|
+
- lib/server.rb
|
|
34
35
|
- lib/setting.rb
|
|
35
36
|
- project_template/.gitignore
|
|
36
37
|
- project_template/Gemfile
|
|
@@ -40,13 +41,15 @@ files:
|
|
|
40
41
|
- project_template/bin/PROJECT_NAME.erb
|
|
41
42
|
- project_template/lib/PROJECT_NAME.rb.erb
|
|
42
43
|
- project_template/lib/api.rb
|
|
44
|
+
- project_template/lib/server.rb
|
|
43
45
|
- project_template/migrations.rb
|
|
46
|
+
- project_template/public/index.html.erb
|
|
44
47
|
homepage: https://rubygems.org/gems/rubiclifier
|
|
45
48
|
licenses:
|
|
46
49
|
- MIT
|
|
47
50
|
metadata:
|
|
48
51
|
source_code_uri: https://github.com/MrGrinst/rubiclifier
|
|
49
|
-
post_install_message:
|
|
52
|
+
post_install_message:
|
|
50
53
|
rdoc_options: []
|
|
51
54
|
require_paths:
|
|
52
55
|
- lib
|
|
@@ -61,9 +64,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
61
64
|
- !ruby/object:Gem::Version
|
|
62
65
|
version: '0'
|
|
63
66
|
requirements: []
|
|
64
|
-
rubyforge_project:
|
|
67
|
+
rubyforge_project:
|
|
65
68
|
rubygems_version: 2.7.6.2
|
|
66
|
-
signing_key:
|
|
69
|
+
signing_key:
|
|
67
70
|
specification_version: 4
|
|
68
71
|
summary: Easily spin up new Ruby CLI applications with built-in backgrounding and
|
|
69
72
|
data storage.
|