jeanine 0.7.3 → 0.7.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
  SHA1:
3
- metadata.gz: ae2f211b64bde8d5c7b65837dec687314bafedff
4
- data.tar.gz: 119368f1a2e7ca316aba774c89cf14caa7b8b0dc
3
+ metadata.gz: d1c60f940af49afd44e3165d198a21b43c0d4121
4
+ data.tar.gz: f9bcc4c7e7498416d01f62208c3f46ccf51f9bef
5
5
  SHA512:
6
- metadata.gz: 59fa12a8e324f5f8d5d23ab87c7e778f8ea746b87744d3a865f29b4725e4f1d3470a75f3db2947d425f063d6edcd583ea0316ac19823f92784b9378e8162f333
7
- data.tar.gz: 6f142f86f7b67441e35bdbffacad9cc083007333b36165f3925f27aae4132a1d72418ac73ad850c51cc366730f2e8ca1f60c8dfd737564b83f3ea09fe8cb2870
6
+ metadata.gz: d5ad15e4daf7f229b475db2c6d57e16e6487cada74446a2db89e7cbc6c70c7e9c34ede24b8beb7a9a912d2657b6d599bd275140e7a3d1b81144768c62bec40cd
7
+ data.tar.gz: 7a8b8ac8a5a159d872adf5953b533a054e5c2753b10df213c09595e28591c6ef92d10ea32598b995a4c912aed366bdefd81a0de12d501974157fa42295652853
data/README.md CHANGED
@@ -43,6 +43,16 @@ run App
43
43
 
44
44
  `$ rackup`
45
45
 
46
+ Or generate a new app:
47
+
48
+ ```
49
+ $ gem install jeanine
50
+ $ jeanine new my_api
51
+ $ cd my_api
52
+ $ bundle
53
+ $ rackup
54
+ ```
55
+
46
56
  ## Advanced usage
47
57
 
48
58
  ```ruby
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'jeanine/cli'
3
+ require_relative '../lib/jeanine/cli'
4
4
 
5
5
  Jeanine::CLI.new(ARGV).execute
@@ -5,8 +5,24 @@ require 'logger'
5
5
 
6
6
  require "jeanine/version"
7
7
  require 'jeanine/core_ext'
8
+ require 'jeanine/environment'
8
9
 
9
10
  module Jeanine
11
+ def env
12
+ @_env ||= (ENV["RACK_ENV"].presence || "development")
13
+ end
14
+
15
+ def groups(*groups)
16
+ hash = groups.extract_options!
17
+ env = Jeanine.env
18
+ groups.unshift(:default, env)
19
+ groups.concat ENV["JEANINE_GROUPS"].to_s.split(",")
20
+ groups.concat hash.map { |k, v| k if v.map(&:to_s).include?(env) }
21
+ groups.compact!
22
+ groups.uniq!
23
+ groups
24
+ end
25
+
10
26
  def self._installed_plugins
11
27
  @_installed_plugins ||= []
12
28
  end
@@ -24,5 +40,5 @@ module Jeanine
24
40
  end
25
41
 
26
42
  autoload :Router, 'jeanine/router'
27
- autoload :App, 'jeanine/app'
43
+ autoload :App, 'jeanine/app'
28
44
  end
@@ -1,4 +1,3 @@
1
- require 'jeanine/cli'
2
1
  require 'jeanine/mimes'
3
2
  require 'jeanine/request'
4
3
  require 'jeanine/response'
@@ -15,18 +15,23 @@ module Jeanine
15
15
  end
16
16
 
17
17
  def command_new!
18
+ $stdout.puts("Creating new app #{@args[1]}")
18
19
  FileUtils.mkdir("#{@args[1]}") unless Dir.exists?("#{@args[1]}")
19
20
  FileUtils.mkdir("#{@args[1]}/config") unless Dir.exists?("#{@args[1]}/config")
20
- relative_dir = "lib/jeanine/generator/new"
21
- Dir.glob("lib/jeanine/generator/new/**/*.*").each do |file|
21
+ FileUtils.mkdir("#{@args[1]}/tmp") unless Dir.exists?("#{@args[1]}/tmp")
22
+ FileUtils.mkdir("#{@args[1]}/tmp/pids") unless Dir.exists?("#{@args[1]}/tmp/pids")
23
+ FileUtils.touch("#{@args[1]}/tmp/pids/.keep") unless File.exists?("#{@args[1]}/tmp/pids/.keep")
24
+ relative_dir = "#{__dir__}/generator/new"
25
+ Dir.glob("#{__dir__}/generator/new/**/*.*").each do |file|
22
26
  new_dir = file.gsub(relative_dir, "#{@args[1]}")[0...-3]
23
27
  FileUtils.copy_file(file, new_dir)
24
28
  end
25
- relative_dir = "lib/jeanine/generator/new/config"
26
- Dir.glob("lib/jeanine/generator/new/config/**/*.*").each do |file|
29
+ relative_dir = "#{__dir__}/generator/new/config"
30
+ Dir.glob("#{__dir__}/generator/new/config/**/*.*").each do |file|
27
31
  new_dir = file.gsub(relative_dir, "#{@args[1]}/config")[0...-3]
28
32
  FileUtils.copy_file(file, new_dir)
29
33
  end
34
+ $stdout.puts("Created #{@args[1]}!")
30
35
  end
31
36
  end
32
37
  end
@@ -1,7 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- ruby "$RUBY_VERSION$"
4
-
5
3
  gem "jeanine"
6
4
 
7
5
  group :production do
@@ -1,4 +1,4 @@
1
- require_relative 'boot'
1
+ require_relative 'config/boot'
2
2
 
3
3
  require 'jeanine'
4
4
 
@@ -7,4 +7,23 @@ require 'jeanine'
7
7
  Bundler.require(*Jeanine.groups)
8
8
 
9
9
  class App < ::Jeanine::App
10
+ # plugin :Callbacks
11
+ # plugin :Rescuable
12
+ # plugin :Rendering
13
+ # plugin :Session
14
+
15
+ root do
16
+ "Hello world!"
17
+ end
18
+
19
+ get "/health" do
20
+ if request.json?
21
+ # Get this for free with plugin :Rendering
22
+ # and `render json: { status: "Healthy" }`
23
+ response.content_type = ::Rack::Mime::MIME_TYPES[".json"]
24
+ { status: "Healthy" }.to_json
25
+ else
26
+ "Healthy!"
27
+ end
28
+ end
10
29
  end
@@ -1,5 +1,4 @@
1
1
  require 'jeanine/view'
2
- require 'jeanine/view_paths'
3
2
 
4
3
  module Jeanine
5
4
  def self.view_paths
@@ -1,3 +1,3 @@
1
1
  module Jeanine
2
- VERSION = "0.7.3"
2
+ VERSION = "0.7.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jeanine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Brody
@@ -111,7 +111,8 @@ dependencies:
111
111
  description: A lightning-fast, batteries-included Ruby web micro-framework.
112
112
  email:
113
113
  - git@josh.mn
114
- executables: []
114
+ executables:
115
+ - jeanine
115
116
  extensions: []
116
117
  extra_rdoc_files: []
117
118
  files:
@@ -126,7 +127,6 @@ files:
126
127
  - lib/jeanine/core_ext/hash.rb
127
128
  - lib/jeanine/core_ext/nil_class.rb
128
129
  - lib/jeanine/core_ext/string.rb
129
- - lib/jeanine/environment.rb
130
130
  - lib/jeanine/generator/new/Gemfile.tt
131
131
  - lib/jeanine/generator/new/README.md.tt
132
132
  - lib/jeanine/generator/new/app.rb.tt
@@ -148,7 +148,6 @@ files:
148
148
  - lib/jeanine/session.rb
149
149
  - lib/jeanine/version.rb
150
150
  - lib/jeanine/view.rb
151
- - lib/jeanine/view_paths.rb
152
151
  homepage: https://github.com/joshmn/jeanine
153
152
  licenses:
154
153
  - MIT
@@ -1,16 +0,0 @@
1
- module Broding
2
- def env
3
- @_env ||= (ENV["RACK_ENV"].presence || "development")
4
- end
5
-
6
- def groups(*groups)
7
- hash = groups.extract_options!
8
- env = Jeanine.env
9
- groups.unshift(:default, env)
10
- groups.concat ENV["BRODY_GROUPS"].to_s.split(",")
11
- groups.concat hash.map { |k, v| k if v.map(&:to_s).include?(env) }
12
- groups.compact!
13
- groups.uniq!
14
- groups
15
- end
16
- end
@@ -1,8 +0,0 @@
1
- require 'tilt'
2
-
3
- module Jeanine
4
-
5
- module ViewPaths
6
-
7
- end
8
- end