railz_lite 0.1.1 → 0.1.6

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: debcfc1ee0b528a1b64f81eec5f716ed724b18846185718633da6d5cc3d71a28
4
- data.tar.gz: 34d1df37b4743d54bab4d62691d7811772d9a2a61f6eaf4ce5da1291fbd7d442
3
+ metadata.gz: e7acea7b75dc9f8d1e05768f9c6c172f6e7984307824c69e9eb6b3c1055b993a
4
+ data.tar.gz: 74bbe9fc95b69704453b158f4ca9d1625778942aefa23a0ecfbe4b7332ba79f3
5
5
  SHA512:
6
- metadata.gz: 72467b86db0a0a7be1c949312669f269580c9d66f8ecb4c1f530d5d6bca51a297b8357c617ad656a910a52c7ae9332ccfb65cddecd397c6f25c816349f1ccbf1
7
- data.tar.gz: 9cdd55bd2a0ec29db69454663027d108aa8c93877ab5a9dc227f881270fa002d99b94acbe44268531bdef64ada89d99ab67a230b8f089a2cc500f685517f3b3d
6
+ metadata.gz: 939f6f260cb17e847feb26d256f688eb1105bd35707c96c61036f32f609cedeb432e298c853112985f350be35561fd9526f4d0138ba2c1a2b74cef6b4c65ef18
7
+ data.tar.gz: ec8d14870fe345b88359148e42c766c77c04f57747cd5f21381cd0dd654ccab5ceb30348b858c6b5e200072032d14e8c289368b78d1e1d8184e5b364180b266d
@@ -5,13 +5,18 @@ require 'railz_lite/generators/project'
5
5
  module RailzLite
6
6
  class CLI < Thor
7
7
  desc 'new', 'Generates a new RailzLite project'
8
- def new
9
- RailzLite::Generators::Project.start([])
8
+ def new(project_name)
9
+ RailzLite::Generators::Project.start([project_name])
10
10
  end
11
11
 
12
12
  desc 'server', 'Starts up a puma server within RailzLite project'
13
13
  def server
14
- puts "hello world"
14
+ file = File.join(Dir.pwd, 'config', 'server.rb')
15
+ if File.exist?(file)
16
+ system('ruby', file)
17
+ else
18
+ raise "File not found at #{file}"
19
+ end
15
20
  end
16
21
  end
17
22
  end
@@ -1,4 +1,3 @@
1
- require 'byebug'
2
1
  require 'active_support'
3
2
  require 'active_support/core_ext'
4
3
  require 'erb'
@@ -4,7 +4,7 @@ class Flash
4
4
  attr_reader :now
5
5
  def initialize(req)
6
6
  cookie = req.cookies['_rails_lite_app_flash']
7
- @now = cookie.present? ? JSON.parse(cookie) : {}
7
+ @now = !cookie.nil? ? JSON.parse(cookie) : {}
8
8
  @flash = {}
9
9
  end
10
10
 
@@ -58,11 +58,11 @@ class Router
58
58
  # either throw 404 or call run on a matched route
59
59
  def run(req, res)
60
60
  matching_route = match(req)
61
- if matching_route.present?
62
- matching_route.run(req, res)
63
- else
61
+ if matching_route.nil?
64
62
  res.status = 404
65
63
  res.write("Matching route not found for #{req.path}")
64
+ else
65
+ matching_route.run(req, res)
66
66
  end
67
67
  end
68
68
  end
@@ -1,12 +1,11 @@
1
1
  require 'json'
2
- require 'byebug'
3
2
 
4
3
  class Session
5
4
  # find the cookie for this app
6
5
  # deserialize the cookie into a hash
7
6
  def initialize(req)
8
7
  cookie = req.cookies['_rails_lite_app']
9
- @data = cookie.present? ? JSON.parse(cookie) : {}
8
+ @data = !cookie.nil? ? JSON.parse(cookie) : {}
10
9
  end
11
10
 
12
11
  def [](key)
@@ -1,5 +1,4 @@
1
1
  require 'erb'
2
- require 'byebug'
3
2
 
4
3
  class ShowExceptions
5
4
  attr_reader :app
@@ -1,4 +1,5 @@
1
- require 'byebug'
1
+ require 'rack'
2
+
2
3
  class Static
3
4
  attr_reader :app, :file_server, :root
4
5
 
@@ -4,29 +4,35 @@ module RailzLite
4
4
  module Generators
5
5
  class Project < Thor::Group
6
6
  include Thor::Actions
7
+ argument :project_name, type: :string
7
8
 
8
9
  def self.source_root
9
10
  File.dirname(__FILE__) + "/templates"
10
11
  end
12
+
13
+ def self.destination_root
14
+ puts "destination for folder #{Dir.pwd}"
15
+ Dir.pwd
16
+ end
11
17
 
12
18
  def add_controllers
13
- empty_directory("/controllers")
19
+ empty_directory("#{project_name}/controllers")
14
20
  end
15
21
 
16
22
  def add_models
17
- empty_directory("/models")
23
+ empty_directory("#{project_name}/models")
18
24
  end
19
25
 
20
26
  def add_server
21
- template("server.rb", "/config/server.rb")
27
+ template("#{project_name}/server.rb", "config/server.rb")
22
28
  end
23
29
 
24
30
  def add_views
25
- empty_directory("/views")
31
+ empty_directory("#{project_name}/views")
26
32
  end
27
33
 
28
34
  def add_public
29
- empty_directory("/public")
35
+ empty_directory("#{project_name}/public")
30
36
  end
31
37
  end
32
38
  end
@@ -16,7 +16,7 @@ app = Proc.new do |env|
16
16
  end
17
17
 
18
18
  app = Rack::Builder.new do
19
- use Show_Exceptions # generates helpful error messages
19
+ use ShowExceptions # generates helpful error messages
20
20
  use Static # serves static assets from /public
21
21
  run app
22
22
  end.to_app
@@ -1,6 +1,5 @@
1
1
  require_relative 'db_connection'
2
2
  require 'active_support/inflector'
3
- require 'byebug'
4
3
 
5
4
  module RailzLite
6
5
  class SQLObject
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailzLite
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.6"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railz_lite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - bryan lynch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-01 00:00:00.000000000 Z
11
+ date: 2021-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -170,7 +170,6 @@ files:
170
170
  - lib/railz_lite/generators/project.rb
171
171
  - lib/railz_lite/generators/project.rb~
172
172
  - lib/railz_lite/generators/templates/application_controller.rb~
173
- - lib/railz_lite/generators/templates/routes.rb
174
173
  - lib/railz_lite/generators/templates/server.rb
175
174
  - lib/railz_lite/models/associatable.rb
176
175
  - lib/railz_lite/models/associatable.rb~
File without changes