dotenv-ios 0.1.1 → 0.1.2

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
  SHA256:
3
- metadata.gz: 642b43993463a7ed737d80675e3179a51c215091a27dc9a59ac85fb89a074002
4
- data.tar.gz: cd29804a13d3bd949595a56e4ecd97d71a847a427f40c51737499a3c20053bc9
3
+ metadata.gz: 9092e00a68fd903a04d60a3f4b779981aa5ea2d8790b769fb3eb44aba9980ef9
4
+ data.tar.gz: f5169bd131725c2af3be918ba10e5fc477d5eebbf82d42d687329d68e74afda5
5
5
  SHA512:
6
- metadata.gz: 3e0b49d677ed084d8e30f3b5fdefa10cdcac0f1eea1a71d1f8669b3fd803e6c3286d97927b702d36a725b549503a330bc3dd20b7a70d7c6b9694d876db97f53c
7
- data.tar.gz: 35f045d52e3e8cef04312ef437de601ae48747cda77496ce89a8db467301c4572e92e01d2c1821e3483f70a348048959a7d21f0b24985cfe6c9c38d15571fb16
6
+ metadata.gz: 2c0e41544d932fc28ac91c25963ee030035ca0921b378ae6cc52158da1a4a5fa17171c450128ac51f4b7d87f5488284ae45f3554233c8f9ba001e353fda6dc14
7
+ data.tar.gz: ae311a6359e6f19422bb3196aa2eabed4e25bd5bc29915d427b7923474429b6ff7b9853d4b0988c180e5a8fb5d3d6a6393d4ddf50a671d348090c286cae1f57a
@@ -1,3 +1,8 @@
1
+ # [0.1.2] - 2019-12-30
2
+
3
+ ## Fixed
4
+ - Special characters at end of var ignored. [Issue](https://github.com/levibostian/dotenv-ios/issues/3)
5
+
1
6
  # [0.1.1] - 2019-11-30
2
7
 
3
8
  ## Fixed
data/README.md CHANGED
@@ -24,11 +24,30 @@ let apiHost: String = Env.apiHost
24
24
 
25
25
  At first, XCode will complain that `Env.apiHost` cannot be found. Don't worry. We will be fixing that. `dotenv-ios` CLI crawls your source code looking for `Env.X` requests and generating a `Env.swift` file for you! Anytime you want to use environmental variables, you just need to add it to your source. Super easy.
26
26
 
27
- * Create a new Build Phase in XCode to run this command.
27
+ * Create a new Build Phase in XCode to run this command. Reorder the new Build Phase to be first to run. That way this tool can generate the environment variables before XCode tries to compile your app's source code.
28
28
 
29
- The shell command for this build phase is quite simple: `dotenv-ios --source PathToYourSourceCode/`
29
+ First, create a bash script in your project (for example purposes here, we created a script named, `dot_env_ios.rb` in the root of the project. It's important to put it there so dotenv-ios can find the `.env` file in the root):
30
30
 
31
- Reorder the new Build Phase to be first to run. That way this tool can generate the environment variables before XCode tries to compile your app's source code.
31
+ ```ruby
32
+ #!/usr/bin/env ruby
33
+
34
+ require 'dotenv'
35
+ Dotenv.load('.env')
36
+
37
+ `bundle exec dotenv-ios --source #{ENV["SOURCE_CODE_DIRECTORY"]}`
38
+ ```
39
+
40
+ You will notice above that I am also using the `dotenv` ruby gem to make life even easier storing a variable `SOURCE_CODE_DIRECTORY` in `.env` I can use in this script.
41
+
42
+ Now, back to XCode build scripts. Leave the shell as the default, `/bin/sh` and have the script in XCode simply execute your bash script you just made:
43
+
44
+ ```
45
+ ./dot_env_ios.rb
46
+ ```
47
+
48
+ Done!
49
+
50
+ *Note: It's highly recommended you checkout [this quick doc](https://gist.github.com/levibostian/aac45628ff00f677888824d651cc7724) on how to run ruby scripts within XCode as you may encounter issues along the way.*
32
51
 
33
52
  * Run a build in XCode (Cmd + B) to run the `dotenv-ios` CLI tool.
34
53
 
@@ -44,9 +44,12 @@ module DotEnviOS
44
44
  requests = []
45
45
 
46
46
  File.readlines(file).each do |line|
47
- line.split(' ').each do |word|
48
- # https://regexr.com/4pmp0
49
- next unless /Env\.[a-z]\w*/.match? word
47
+ # Regex matcher: https://regexr.com/4rf2s
48
+ matches = line.match(/Env\.[a-z]\w*/)
49
+ next if matches.nil?
50
+
51
+ matches.to_a.each do |word|
52
+ word = word.gsub('_', '') # \w in regex pattern above allows underscores. We want to remove those.
50
53
 
51
54
  requested_variable = word.split('.')[1]
52
55
  requested_variable = DotEnviOS::Util.to_snakecase(requested_variable).upcase
@@ -3,7 +3,7 @@
3
3
  module DotEnviOS
4
4
  class Version
5
5
  def self.get
6
- '0.1.1'
6
+ '0.1.2'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dotenv-ios
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Levi Bostian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-30 00:00:00.000000000 Z
11
+ date: 2019-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -94,22 +94,22 @@ dependencies:
94
94
  name: rspec
95
95
  requirement: !ruby/object:Gem::Requirement
96
96
  requirements:
97
- - - "~>"
98
- - !ruby/object:Gem::Version
99
- version: '3.8'
100
97
  - - ">="
101
98
  - !ruby/object:Gem::Version
102
99
  version: 3.8.0
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '3.8'
103
103
  type: :development
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: '3.8'
110
107
  - - ">="
111
108
  - !ruby/object:Gem::Version
112
109
  version: 3.8.0
110
+ - - "~>"
111
+ - !ruby/object:Gem::Version
112
+ version: '3.8'
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: rspec_junit_formatter
115
115
  requirement: !ruby/object:Gem::Requirement
@@ -169,8 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  - !ruby/object:Gem::Version
170
170
  version: '0'
171
171
  requirements: []
172
- rubyforge_project:
173
- rubygems_version: 2.7.7
172
+ rubygems_version: 3.0.6
174
173
  signing_key:
175
174
  specification_version: 4
176
175
  summary: Access environment variables at runtime of iOS app