producing 0.1.0 → 0.2.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: ebbf45337f750731b0edbce675f610396e8176775042020c094866a06d043d69
4
+ data.tar.gz: de52fda591e968a6dd2b5aefa09aa1ab1b868ad0b895c3ac912d571049b5506c
5
5
  SHA512:
6
- metadata.gz: df2c18c87199297a7538e5b6cd5f827931890686f2d616fa79c7d54800ef543959abad3572071cd1b766ceb963d95243420cf8dddbd4e71ea1a513a2db27509a
7
- data.tar.gz: 66f34b68ace813ebad60731ce33f4f753211c084ba83efe3791587f7dab02bac420925146ae501f77d88292d93e000ad3ede8735432dc053432b9411b8d546b0
6
+ metadata.gz: 6f2f715d77f96175447c608a9f8c06171b9730b001bc6e1e60afd3188e7c4b3b1380440078d880c66d8754278dfeedf0c7feb373db009f786e6ff2e99441cda9
7
+ data.tar.gz: 6adc25523892392a4bf788fff2ba0dbfe8cad98fdc53ebba481504e60c7c40d0a6962b61f19d52e6740c1e5d5e17cf00db2f71bb0b60318e6072764b0acd26b0
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Producing
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.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.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard LeBer
@@ -50,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
50
50
  - !ruby/object:Gem::Version
51
51
  version: '0'
52
52
  requirements: []
53
- rubygems_version: 3.6.8
53
+ rubygems_version: 3.6.9
54
54
  specification_version: 4
55
55
  summary: 'Check: Are we in production?'
56
56
  test_files: []