railz_lite 0.1.8 → 0.1.9

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: 67884b77d71307c891be0cc4402f6c6fb0adf04498956df13ea66bdb2bc36bba
4
- data.tar.gz: 9ca0c311a2424173ef01cadac5a762ac8ecb59bde762057faa153c64ba2d6560
3
+ metadata.gz: 81d26ed037ad3c977f1cb81938ae67fe84e5d61bb003b56fc4a42cfefa66c85e
4
+ data.tar.gz: 83094af33c58caab3053c15a6325360d4d865739a127180cb8b601010e3f20ca
5
5
  SHA512:
6
- metadata.gz: '08dcd22b2260b9ef62ae1927bd37d5ad0bfa53dfe504199712c587dcd75a550c493067fcb4b0675841a01877ebcc01e5d885858c509608e058d52b49fbbff0ba'
7
- data.tar.gz: 7cfdc71ef797a18e6b34b3fd13e2d08c1be630845b54f1f0e2c7aed20e928239f7b5b0d901a7b6d6e198fba3cb9dd0320fbc22d57dbf866bb80f3ba4794afb0b
6
+ metadata.gz: 7fc0c8c888e5c2d906c0d3c7be43d240ad13197ce19681547232308eca1dc6fe06f5805d18a52743923445d9916408caddb95c043b8f1b865ae16bca8657c7ad
7
+ data.tar.gz: 36bef73dd88344e44ad8066f73489fc8bc2e9d709013eff7e16ddb098992d34840fe6230e35f8770e089bbecabc8c35c71e9a301e2b6c60191b46e4987fded59
@@ -1,6 +1,7 @@
1
1
  require 'thor'
2
2
  require 'railz_lite'
3
3
  require 'railz_lite/generators/project'
4
+ require 'railz_lite/models/db_connection'
4
5
 
5
6
  module RailzLite
6
7
  class CLI < Thor
@@ -9,14 +10,20 @@ module RailzLite
9
10
  RailzLite::Generators::Project.start([project_name])
10
11
  end
11
12
 
12
- desc 'server', 'Starts up a puma server within RailzLite project'
13
+ desc 'server', 'Starts up a puma server within RailzLite project. Also initializes '
13
14
  def server
14
15
  file = File.join(Dir.pwd, 'config', 'server.rb')
15
16
  if File.exist?(file)
17
+ DBConnection.start # load our db connection
16
18
  system('ruby', file)
17
19
  else
18
20
  raise "File not found at #{file}"
19
21
  end
20
22
  end
23
+
24
+ desc 'db_reset', 'Restarts the database and reads db/app.sql file'
25
+ def db_reset
26
+ DBConnection.reset
27
+ end
21
28
  end
22
29
  end
@@ -26,12 +26,16 @@ module RailzLite
26
26
  template('server.rb', "#{project_name}/config/server.rb")
27
27
  end
28
28
 
29
- def add_views
30
- empty_directory("#{project_name}/views")
29
+ def add_welcome_view
30
+ template('welcome_view.index.html.erb', "#{project_name}/views/welcome_controller/welcome_view.index.html.erb")
31
31
  end
32
32
 
33
33
  def add_public
34
- empty_directory("#{project_name}/public")
34
+ copy_file('winter_fox_large.jpg', "#{project_name}/public")
35
+ end
36
+
37
+ def create_sql_file
38
+ create_file("#{project_name}/db/app.sql")
35
39
  end
36
40
  end
37
41
  end
@@ -2,10 +2,17 @@ require 'rack'
2
2
  require 'railz_lite/controllers/static'
3
3
  require 'railz_lite/controllers/show_exceptions'
4
4
  require 'railz_lite/controllers/router'
5
+ require 'railz_lite'
6
+
7
+ # example controller config
8
+ class WelcomeController < RailzLite::ControllerBase
9
+ def index; end
10
+ end
5
11
 
6
12
  router = Router.new
7
13
  router.draw do
8
14
  # add routes here
15
+ get Regexp.new('^/$'), WelcomeController, :index
9
16
  end
10
17
 
11
18
  app = Proc.new do |env|
@@ -0,0 +1,12 @@
1
+ <div style="
2
+ width: 50%;
3
+ margin: 0 auto;
4
+ margin-top: 18px;
5
+ text-align: center;
6
+ ">
7
+ <h1>Welcome To Railz Lite!</h1>
8
+
9
+ <img src="../public/winter_fox_large.jpg" />
10
+
11
+ <h3>For guidelines on how to build an app with this framework see <a href="https://github.com/bryanqb07/railz_lite">here</a>.</h3>
12
+ </div>
@@ -1,11 +1,15 @@
1
1
  require 'sqlite3'
2
2
 
3
- PRINT_QUERIES = ENV['PRINT_QUERIES'] == 'true'
4
- ROOT_FOLDER = Dir.pwd
5
- SQL_FILE = File.join(ROOT_FOLDER, 'app.sql')
6
- DB_FILE = File.join(ROOT_FOLDER, 'app.db')
7
-
8
3
  class DBConnection
4
+ PRINT_QUERIES = ENV['PRINT_QUERIES'] == 'true'
5
+ ROOT_FOLDER = Dir.pwd
6
+ SQL_FILE = File.join(ROOT_FOLDER, 'db', 'app.sql')
7
+ DB_FILE = File.join(ROOT_FOLDER, 'db', 'app.db')
8
+
9
+ def self.start
10
+ DBConnection.open(DB_FILE)
11
+ end
12
+
9
13
  def self.open(db_file_name)
10
14
  @db = SQLite3::Database.new(db_file_name)
11
15
  @db.results_as_hash = true
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailzLite
4
- VERSION = "0.1.8"
4
+ VERSION = "0.1.9"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railz_lite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - bryan lynch
@@ -168,6 +168,8 @@ files:
168
168
  - lib/railz_lite/generators/project.rb~
169
169
  - lib/railz_lite/generators/templates/application_controller.rb~
170
170
  - lib/railz_lite/generators/templates/server.rb
171
+ - lib/railz_lite/generators/templates/welcome_view.index.html.erb
172
+ - lib/railz_lite/generators/templates/winter_fox_large.jpg
171
173
  - lib/railz_lite/models/associatable.rb
172
174
  - lib/railz_lite/models/associatable2.rb
173
175
  - lib/railz_lite/models/attr_accessor_object.rb