rubiclifier 2.0.1 → 2.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1753ed507a207f88fd8aba7994f83e5f3a86203548117e732fc668294b265842
4
- data.tar.gz: ed9591fea028c5a42865a49e21ae6a981a09bf4e29117ff425a18ccdd786b5dc
3
+ metadata.gz: 28017918c897dbe2c073355b9a7fb68b868a76c7d171089fab957b63943bb106
4
+ data.tar.gz: f183ea8e536a1a889c3c210aa88f3b103276858bbb8e713b7a84d95e23f272a9
5
5
  SHA512:
6
- metadata.gz: 4d240503feaf41d7f11c0254ded3f77774827fdfca21cde0311ab484f33317697584372b714b80c2ae10e5b8b6cd2b764c66e4a0b402b78cd3aa877191e3b9ae
7
- data.tar.gz: e2fadd448f8a290cc76fbb6860548ac2b744f53c3a895c07730f9ff496fb8e72da968b60e6730178ef2594bf5d16c2428488c619dce97fce589b7a8c19d3b357
6
+ metadata.gz: 397b8a9dceedab109ef2335e6ad0d243bd355b1b776ef39120efbe181e075baba6cc55d597af05651feaada5ef3dff69572cabab4395437b24988dc058a0865a
7
+ data.tar.gz: 37f1383afa0fcd7d9a62803af517ef7136e8c546c9721a89be07500ef5e56ae9eafcd23c764fc27c087230852dbf0d374f9957f4cfbbe59918dab18ce7a4bb30
data/Gemfile CHANGED
@@ -4,3 +4,9 @@ gemspec
4
4
 
5
5
  gem "httparty"
6
6
  gem "sqlite3"
7
+ gem "sinatra"
8
+
9
+ group :test do
10
+ gem "byebug"
11
+ gem "rspec"
12
+ end
@@ -18,17 +18,30 @@ 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
- run_application
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
 
@@ -45,6 +45,10 @@ class RubiclifierCli < Rubiclifier::BaseApplication
45
45
  unless template_hydrator.feature_enabled?(Rubiclifier::Feature::DATABASE)
46
46
  system("rm #{project_name}/migrations.rb")
47
47
  end
48
+ unless template_hydrator.feature_enabled?(Rubiclifier::Feature::SERVER)
49
+ system("rm #{project_name}/lib/server.rb")
50
+ system("rm -rf #{project_name}/public")
51
+ end
48
52
  puts("Finished creating project #{project_name}! Build out the application in #{project_name}/lib/#{project_name}.rb".green)
49
53
  end
50
54
 
@@ -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
 
@@ -4,6 +4,7 @@ module Rubiclifier
4
4
  DATABASE = "DATABASE"
5
5
  NOTIFICATIONS = "NOTIFICATIONS"
6
6
  IDLE_DETECTION = "IDLE_DETECTION"
7
+ SERVER = "SERVER"
7
8
 
8
9
  def self.set_enabled(features)
9
10
  @enabled = features
@@ -0,0 +1,13 @@
1
+ require 'sinatra/base'
2
+
3
+ module Rubiclifier
4
+ class Server < Sinatra::Base
5
+ def self.hydrate
6
+ raise NotImplementedError
7
+ end
8
+
9
+ get "/" do
10
+ redirect("/index.html")
11
+ end
12
+ end
13
+ end
@@ -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
@@ -0,0 +1,8 @@
1
+ require "rubiclifier"
2
+
3
+ class Server < Rubiclifier::Server
4
+ def self.hydrate
5
+ set :public_folder, "#{File.expand_path(File.dirname(__FILE__) + "/..")}/public"
6
+ set :port, 5000
7
+ end
8
+ end
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <title><%= project_name %></title>
7
+ </head>
8
+
9
+ <body>
10
+ <h1><%= project_name %></h1>
11
+ </body>
12
+ </html>
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.0.1
4
+ version: 2.1.0
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-10 00:00:00.000000000 Z
11
+ date: 2020-07-14 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.