rubiclifier 1.2.0 → 2.1.2
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/bin/rubiclifier +1 -1
- data/lib/base_application.rb +30 -12
- data/lib/cli/rubiclifier_cli.rb +7 -1
- data/lib/cli/template_hydrator.rb +3 -1
- data/lib/feature.rb +1 -0
- data/lib/server.rb +13 -0
- data/project_template/PROJECT_NAME.gemspec.erb +1 -1
- data/project_template/bin/PROJECT_NAME.erb +1 -1
- data/project_template/lib/PROJECT_NAME.rb.erb +9 -6
- 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: ecbd1aec5afc842587c43cc413526cedc13f58468c09cf3ce415cc84bf800aee
|
|
4
|
+
data.tar.gz: 7d9b7298cbcd59aa13ee45507eb70ae2d9ac938dc581983880847f6e8d82d31b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5b3c7fc9dd07510ec42fce69ec202f2de6a1640b5c24db6a8ad4b2871bf996ae59b63f65b362536c690663f49101741b85a3bb9e204a24d75e3283cebe75d808
|
|
7
|
+
data.tar.gz: b5d29256a4552a9b4cbd59c7b73cb0f1b161ac718f22f16de5f22963e0e3d3d5c7fcbde3110714bd268082b31e747c0d85c1a7fd81edca601e6f996608d62c05
|
data/Gemfile
CHANGED
data/bin/rubiclifier
CHANGED
data/lib/base_application.rb
CHANGED
|
@@ -5,11 +5,12 @@ require_relative "./setting.rb"
|
|
|
5
5
|
|
|
6
6
|
module Rubiclifier
|
|
7
7
|
class BaseApplication
|
|
8
|
-
attr_reader :args
|
|
9
|
-
private :args
|
|
8
|
+
attr_reader :args, :executable_name
|
|
9
|
+
private :args, :executable_name
|
|
10
10
|
|
|
11
|
-
def initialize(args)
|
|
11
|
+
def initialize(args, executable_name)
|
|
12
12
|
@args = Args.new(args)
|
|
13
|
+
@executable_name = executable_name
|
|
13
14
|
Feature.set_enabled(all_features)
|
|
14
15
|
DB.hydrate(data_directory, migrations_location) if Feature.enabled?(Feature::DATABASE)
|
|
15
16
|
end
|
|
@@ -17,20 +18,36 @@ module Rubiclifier
|
|
|
17
18
|
def call
|
|
18
19
|
show_help if args.command == "help" || args.boolean("help", "h")
|
|
19
20
|
setup_or_fail if needs_setup?
|
|
20
|
-
|
|
21
|
+
if Feature.enabled?(Feature::SERVER)
|
|
22
|
+
run_server
|
|
23
|
+
else
|
|
24
|
+
run_application
|
|
25
|
+
end
|
|
21
26
|
end
|
|
22
27
|
|
|
23
28
|
def show_help
|
|
24
29
|
raise NotImplementedError
|
|
25
30
|
end
|
|
26
31
|
|
|
32
|
+
def run_server
|
|
33
|
+
raise NotImplementedError
|
|
34
|
+
end
|
|
35
|
+
|
|
27
36
|
def run_application
|
|
28
37
|
raise NotImplementedError
|
|
29
38
|
end
|
|
30
39
|
|
|
40
|
+
def run_server
|
|
41
|
+
server_class.hydrate
|
|
42
|
+
server_class.run!
|
|
43
|
+
end
|
|
44
|
+
|
|
31
45
|
def additional_setup
|
|
32
46
|
end
|
|
33
47
|
|
|
48
|
+
def post_setup_message
|
|
49
|
+
end
|
|
50
|
+
|
|
34
51
|
def not_setup
|
|
35
52
|
end
|
|
36
53
|
|
|
@@ -42,10 +59,6 @@ module Rubiclifier
|
|
|
42
59
|
[]
|
|
43
60
|
end
|
|
44
61
|
|
|
45
|
-
def executable_name
|
|
46
|
-
raise NotImplementedError
|
|
47
|
-
end
|
|
48
|
-
|
|
49
62
|
def data_directory
|
|
50
63
|
raise NotImplementedError if Feature.enabled?(Feature::DATABASE)
|
|
51
64
|
end
|
|
@@ -70,7 +83,7 @@ module Rubiclifier
|
|
|
70
83
|
|
|
71
84
|
def brew_dependencies_installed?
|
|
72
85
|
all_brew_dependencies.all? do |dep|
|
|
73
|
-
system("brew list #{dep} &> /dev/null")
|
|
86
|
+
system("/usr/local/bin/brew list #{dep} &> /dev/null")
|
|
74
87
|
end
|
|
75
88
|
end
|
|
76
89
|
|
|
@@ -115,6 +128,7 @@ module Rubiclifier
|
|
|
115
128
|
setup_as_background_service
|
|
116
129
|
else
|
|
117
130
|
puts("Finished setup! Run with `".green + "#{executable_name}" + "`".green)
|
|
131
|
+
post_setup_message
|
|
118
132
|
end
|
|
119
133
|
exit
|
|
120
134
|
elsif !settings.all?(&:is_setup?) || !brew_dependencies_installed?
|
|
@@ -132,15 +146,19 @@ module Rubiclifier
|
|
|
132
146
|
puts
|
|
133
147
|
print("Would you like this script to set it up for you? (y/n) ")
|
|
134
148
|
if STDIN.gets.chomp.downcase == "y"
|
|
135
|
-
|
|
136
|
-
|
|
149
|
+
unless system("ls \"$HOME/.local/bin/serviceman\" &> /dev/null")
|
|
150
|
+
puts "Installing serviceman..."
|
|
151
|
+
system("-sL https://webinstall.dev/serviceman | bash")
|
|
152
|
+
end
|
|
137
153
|
puts "Adding #{executable_name} as a service..."
|
|
138
|
-
system("serviceman add --name #{executable_name} #{executable_name}")
|
|
154
|
+
system("$HOME/.local/bin/serviceman add --name #{executable_name} #{executable_name}")
|
|
139
155
|
puts
|
|
140
156
|
puts("Finished setup! The service is set to run in the background!".green)
|
|
157
|
+
post_setup_message
|
|
141
158
|
else
|
|
142
159
|
puts
|
|
143
160
|
puts("Finished setup!".green)
|
|
161
|
+
post_setup_message
|
|
144
162
|
end
|
|
145
163
|
end
|
|
146
164
|
end
|
data/lib/cli/rubiclifier_cli.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
require_relative "../rubiclifier.rb"
|
|
2
2
|
|
|
3
3
|
class RubiclifierCli < Rubiclifier::BaseApplication
|
|
4
4
|
attr_reader :project_name
|
|
@@ -14,7 +14,9 @@ class RubiclifierCli < Rubiclifier::BaseApplication
|
|
|
14
14
|
puts(" --background | Generate with background service setup steps")
|
|
15
15
|
puts(" --database | Generate with a persistent database")
|
|
16
16
|
puts(' --homebrew "[first [second]]" | Require specific homebrew kegs')
|
|
17
|
+
puts(" --idle-detection | Generate with ability to detect if user is idle")
|
|
17
18
|
puts(" --notifications | Generate with notification functionality")
|
|
19
|
+
puts(" --server | Generate with server")
|
|
18
20
|
puts(" --settings | Generate with persistent setting functionality")
|
|
19
21
|
puts
|
|
20
22
|
exit
|
|
@@ -44,6 +46,10 @@ class RubiclifierCli < Rubiclifier::BaseApplication
|
|
|
44
46
|
unless template_hydrator.feature_enabled?(Rubiclifier::Feature::DATABASE)
|
|
45
47
|
system("rm #{project_name}/migrations.rb")
|
|
46
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
|
|
47
53
|
puts("Finished creating project #{project_name}! Build out the application in #{project_name}/lib/#{project_name}.rb".green)
|
|
48
54
|
end
|
|
49
55
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
require_relative "../rubiclifier.rb"
|
|
2
2
|
|
|
3
3
|
class TemplateHydrator
|
|
4
4
|
attr_reader :args, :project_name
|
|
@@ -33,7 +33,9 @@ class TemplateHydrator
|
|
|
33
33
|
@features ||= [
|
|
34
34
|
(Rubiclifier::Feature::BACKGROUND if args.boolean("background")),
|
|
35
35
|
(Rubiclifier::Feature::DATABASE if (args.boolean("database") || include_settings?)),
|
|
36
|
+
(Rubiclifier::Feature::IDLE_DETECTION if args.boolean("idle-detection")),
|
|
36
37
|
(Rubiclifier::Feature::NOTIFICATIONS if args.boolean("notifications")),
|
|
38
|
+
(Rubiclifier::Feature::SERVER if args.boolean("server")),
|
|
37
39
|
].compact
|
|
38
40
|
end
|
|
39
41
|
|
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
|
|
@@ -36,12 +45,6 @@ class <%= project_name_camel_case %> < Rubiclifier::BaseApplication
|
|
|
36
45
|
]
|
|
37
46
|
end
|
|
38
47
|
<%- end -%>
|
|
39
|
-
<%- if needs_setup? -%>
|
|
40
|
-
|
|
41
|
-
def executable_name
|
|
42
|
-
"<%= project_name %>"
|
|
43
|
-
end
|
|
44
|
-
<%- end -%>
|
|
45
48
|
<%- if feature_enabled?(Rubiclifier::Feature::DATABASE) -%>
|
|
46
49
|
|
|
47
50
|
def data_directory
|
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: 1.2
|
|
4
|
+
version: 2.1.2
|
|
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-15 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.
|