railz_lite 0.1.4 → 0.1.5

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: 716364f3c368904ff0a5a37735400997167386db8029d6a7a6c9cb7325f125ea
4
- data.tar.gz: 04c3382909618767749b010ccc05ef3e08b53a87529050783a932b668109bac6
3
+ metadata.gz: 07446c0f1293c9787a7b5cec35a8233636f6cec7ad3d8e345322752e097c079d
4
+ data.tar.gz: ec30710be4eab8f65ee54ce643e85045c16d314875624cc275e232af1b9e5c19
5
5
  SHA512:
6
- metadata.gz: 281fa461490bc827c717b91200665f81654a03b29c7b314e2545cf6dbcc10f3207afb9f1d63dd4d74e679c2b5c4de7138aaec3c15d11bd3a4ea3097f68e331db
7
- data.tar.gz: 0a57ecbba2796a2444fb137c7b8afe392dde2852f88c1d6e5d64f2e12a2d514e631adb09bc0b67fef57fdbec266447fa1a91dd68dbb85bd2b4733c58faa2718d
6
+ metadata.gz: c8ffaf30221216b8660be9b174c45c9f09412b5382056a3a690fbd7e67e86869e2ee3979e0c5229c93962ab661de06376ae9482915e0368eec40051aec4ea7b1
7
+ data.tar.gz: e4c225cefab1014f801fc0396497808a65d82d1c2735427b63c8aaa5d5cfb5b4d90262e2b3b9b51acf8b4584f5f63d56abea3ad5f8e380dd166183b6dfcb078b
@@ -6,12 +6,17 @@ module RailzLite
6
6
  class CLI < Thor
7
7
  desc 'new', 'Generates a new RailzLite project'
8
8
  def new
9
- RailzLite::Generators::Project.start([])
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
@@ -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
@@ -5,7 +5,7 @@ class Session
5
5
  # deserialize the cookie into a hash
6
6
  def initialize(req)
7
7
  cookie = req.cookies['_rails_lite_app']
8
- @data = cookie.present? ? JSON.parse(cookie) : {}
8
+ @data = !cookie.nil? ? JSON.parse(cookie) : {}
9
9
  end
10
10
 
11
11
  def [](key)
@@ -4,6 +4,7 @@ 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"
@@ -15,23 +16,23 @@ module RailzLite
15
16
  end
16
17
 
17
18
  def add_controllers
18
- empty_directory("controllers")
19
+ empty_directory("#{project_name}/controllers")
19
20
  end
20
21
 
21
22
  def add_models
22
- empty_directory("models")
23
+ empty_directory("#{project_name}/models")
23
24
  end
24
25
 
25
26
  def add_server
26
- template("server.rb", "config/server.rb")
27
+ template("#{project_name}/server.rb", "config/server.rb")
27
28
  end
28
29
 
29
30
  def add_views
30
- empty_directory("views")
31
+ empty_directory("#{project_name}/views")
31
32
  end
32
33
 
33
34
  def add_public
34
- empty_directory("public")
35
+ empty_directory("#{project_name}/public")
35
36
  end
36
37
  end
37
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,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailzLite
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.5"
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.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - bryan lynch
@@ -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