producing 0.1.0 → 0.3.0

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: ef5c0b6b89dfb84805f87c477137f8ee0661d8c9bcc24f44215f16932d8ee638
4
- data.tar.gz: fd00b1bd28b96a830a38206e707e6c600d6ad29bd97dfdf2d8ed0bfef97ada6f
3
+ metadata.gz: 72553fd76a012c7bb15a41de4b756551aef6ae80c3831c58f32bc95d929b5af0
4
+ data.tar.gz: f215e0733579d9f4cd1d8ed57bd6e0818329a86a2de0fb34eee1659caf8e9188
5
5
  SHA512:
6
- metadata.gz: df2c18c87199297a7538e5b6cd5f827931890686f2d616fa79c7d54800ef543959abad3572071cd1b766ceb963d95243420cf8dddbd4e71ea1a513a2db27509a
7
- data.tar.gz: 66f34b68ace813ebad60731ce33f4f753211c084ba83efe3791587f7dab02bac420925146ae501f77d88292d93e000ad3ede8735432dc053432b9411b8d546b0
6
+ metadata.gz: 24f34c7c8643e21fede64f4986396ba985389fa1a87928e043145a34d6db6f8d7bcec98b9924de302996dbc8a9c83d4dc40881b508eea844a467445dbcabcae9
7
+ data.tar.gz: ee34e16639be558f9395c308c134820577d6e51885880ba34f9216ca69d3f0653785b76e801a416240cc5c0ab96b76f91ec70fb6f1674ccd6da44390815f7120
data/exe/producing ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/producing'
4
+
5
+ puts Producing.environment
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Producing
4
- VERSION = "0.1.0"
4
+ VERSION = "0.3.0"
5
5
  end
data/lib/producing.rb CHANGED
@@ -4,10 +4,42 @@ require "git_on"
4
4
 
5
5
  module Producing
6
6
  def self.true?
7
- return true if ENV['RAILS_ENV']&.downcase == 'production'
8
- return true if ENV['RACK_ENV']&.downcase == 'production'
7
+ environment == :production
8
+ end
9
+
10
+ def self.production?
11
+ true?
12
+ end
13
+
14
+ def self.development?
15
+ environment == :development
16
+ end
17
+
18
+ def self.test?
19
+ environment == :test
20
+ end
21
+
22
+ def self.environment
23
+ if ENV['ENVIRONMENT']
24
+ case ENV['ENVIRONMENT'].downcase
25
+ when 'production'
26
+ return :production
27
+ when 'development'
28
+ return :development
29
+ when 'test'
30
+ return :test
31
+ end
32
+ end
33
+ if ENV['RAILS_ENV']
34
+ return ENV['RAILS_ENV'].downcase.to_sym
35
+ end
36
+ if ENV['RACK_ENV']
37
+ return ENV['RACK_ENV'].downcase.to_sym
38
+ end
9
39
  git_status = GitOn.status
10
- return true if git_status[:git] == :active && git_status[:branch] == "master"
11
- false
40
+ if git_status[:git] == :active
41
+ return :production if git_status[:branch] == "master"
42
+ end
43
+ :development
12
44
  end
13
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: producing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard LeBer
@@ -16,7 +16,8 @@ description: |2
16
16
  - Failing the above, are we on the Git "master" branch?
17
17
  email:
18
18
  - richard.leber@gmail.com
19
- executables: []
19
+ executables:
20
+ - producing
20
21
  extensions: []
21
22
  extra_rdoc_files: []
22
23
  files:
@@ -27,6 +28,7 @@ files:
27
28
  - LICENSE.txt
28
29
  - README.md
29
30
  - Rakefile
31
+ - exe/producing
30
32
  - lib/producing.rb
31
33
  - lib/producing/version.rb
32
34
  - sig/producing.rbs
@@ -50,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
50
52
  - !ruby/object:Gem::Version
51
53
  version: '0'
52
54
  requirements: []
53
- rubygems_version: 3.6.8
55
+ rubygems_version: 3.6.9
54
56
  specification_version: 4
55
57
  summary: 'Check: Are we in production?'
56
58
  test_files: []