pliny 0.14.0 → 0.14.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13b0d6020bd07cb9d55632ccc06ee95bf4114fbd
4
- data.tar.gz: 40fd92d34a2c2c75e124a5893454335b14ffdd1b
3
+ metadata.gz: 9fd74ed75ef414a1f1602c0548d2f56fdfb4d97d
4
+ data.tar.gz: 07b464141302bb46918948da5af25fcd5ee1ff0a
5
5
  SHA512:
6
- metadata.gz: c240442d80aea58d7327885bb1c573152ed5d831420da2b6f0e07e0c7838101c8d5aeeed1e44a8ebdb344fe36dfba0b8679ccd7e1c4b82b773c1af7685dac509
7
- data.tar.gz: dfc01de138d783f33cc28b640382155311e363e4137e4791fb9e15a07b93df2a72350d5ec983b81face3c9fb5d8912fe116d6ce4a1971c9c29d51a7afc885000
6
+ metadata.gz: 740e5f9300ec9d45f8f8bba3f4523684204a94fea7bfd5907a448a56783a791bd3a38d52d9817a51c48fdae2103e5edba5578e36f21916f4681704dd4dff0fbf
7
+ data.tar.gz: 76f70b7c91576c41c3f7101417512dce9a16915ea06b02cefee49631fecc38e6acaee001351c877630c506d5d83757233874cd66a47f91f86d02a2bf2bd82b14
@@ -49,6 +49,14 @@ module Pliny
49
49
  end
50
50
  end
51
51
 
52
+ def rack_env
53
+ if pliny_env == "development" || pliny_env == "test"
54
+ "development"
55
+ else
56
+ "deployment"
57
+ end
58
+ end
59
+
52
60
  private
53
61
 
54
62
  def cast(value, method)
@@ -96,5 +104,7 @@ module Pliny
96
104
 
97
105
  end
98
106
 
99
- # Supress the "use RbConfig instead" warning.
100
- Object.send(:remove_const, :Config) if Object.const_defined?(:Config)
107
+ # Supress the "use RbConfig instead" warning
108
+ if Object.const_defined?(:Config) && !Config.is_a?(Pliny::CastingConfigHelpers)
109
+ Object.send(:remove_const, :Config)
110
+ end
@@ -92,7 +92,7 @@ begin
92
92
  task :dump do
93
93
  file = File.join("db", "schema.sql")
94
94
  database_url = database_urls.first
95
- `pg_dump -i -s -x -O -f #{file} #{database_url}`
95
+ `pg_dump -s -x -O -f #{file} #{database_url}`
96
96
 
97
97
  schema = File.read(file)
98
98
  # filter all COMMENT ON EXTENSION, only owners and the db
data/lib/pliny/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pliny
2
- VERSION = "0.14.0"
2
+ VERSION = "0.14.1"
3
3
  end
@@ -28,7 +28,6 @@ module Config
28
28
  override :puma_max_threads, 16, int
29
29
  override :puma_min_threads, 1, int
30
30
  override :puma_workers, 3, int
31
- override :rack_env, 'development', string
32
31
  override :raise_errors, false, bool
33
32
  override :root, File.expand_path("../../", __FILE__), string
34
33
  override :timeout, 10, int
@@ -1,6 +1,6 @@
1
1
  require "./config/config"
2
2
 
3
- environment Config.pliny_env
3
+ environment Config.rack_env
4
4
  port Config.port
5
5
  quiet
6
6
  threads Config.puma_min_threads, Config.puma_max_threads
@@ -0,0 +1,52 @@
1
+ require "spec_helper"
2
+ require "pliny/config_helpers"
3
+
4
+ describe Pliny::CastingConfigHelpers do
5
+
6
+ describe "#rack_env" do
7
+ it "is development if pliny_env is development" do
8
+ config = Class.new do
9
+ extend Pliny::CastingConfigHelpers
10
+ override :pliny_env, 'development', string
11
+ end
12
+
13
+ assert_equal "development", config.rack_env
14
+ end
15
+
16
+ it "is development if pliny_env is test" do
17
+ config = Class.new do
18
+ extend Pliny::CastingConfigHelpers
19
+ override :pliny_env, 'test', string
20
+ end
21
+
22
+ assert_equal "development", config.rack_env
23
+ end
24
+
25
+ it "is deployment if pliny_env is production" do
26
+ config = Class.new do
27
+ extend Pliny::CastingConfigHelpers
28
+ override :pliny_env, 'production', string
29
+ end
30
+
31
+ assert_equal "deployment", config.rack_env
32
+ end
33
+
34
+ it "is deployment if pliny_env is nil" do
35
+ config = Class.new do
36
+ extend Pliny::CastingConfigHelpers
37
+ override :pliny_env, '', string
38
+ end
39
+
40
+ assert_equal "deployment", config.rack_env
41
+ end
42
+
43
+ it "is deployment if pliny_env is another value" do
44
+ config = Class.new do
45
+ extend Pliny::CastingConfigHelpers
46
+ override :pliny_env, 'staging', string
47
+ end
48
+
49
+ assert_equal "deployment", config.rack_env
50
+ end
51
+ end
52
+ end
@@ -1,7 +1,13 @@
1
+ require "pliny/config_helpers"
2
+
1
3
  # Supress the "use RbConfig instead" warning.
2
- Object.send(:remove_const, :Config) if Object.const_defined?(:Config)
4
+ if Object.const_defined?(:Config) && !Config.is_a?(Pliny::CastingConfigHelpers)
5
+ Object.send(:remove_const, :Config)
6
+ end
3
7
 
4
8
  module Config
9
+ extend Pliny::CastingConfigHelpers
10
+
5
11
  def self.pretty_json
6
12
  true
7
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pliny
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandur Leach
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-12 00:00:00.000000000 Z
12
+ date: 2016-01-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -428,6 +428,7 @@ files:
428
428
  - spec/commands/generator/serializer_spec.rb
429
429
  - spec/commands/generator_spec.rb
430
430
  - spec/commands/updater_spec.rb
431
+ - spec/config_helpers_spec.rb
431
432
  - spec/db_support_spec.rb
432
433
  - spec/errors_spec.rb
433
434
  - spec/helpers/encode_spec.rb
@@ -464,7 +465,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
464
465
  version: '0'
465
466
  requirements: []
466
467
  rubyforge_project:
467
- rubygems_version: 2.4.3
468
+ rubygems_version: 2.4.5.1
468
469
  signing_key:
469
470
  specification_version: 4
470
471
  summary: Basic tooling to support API apps in Sinatra