learn-config 1.0.0 → 1.0.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: cb03acc57001c37cbe478f0643a06dd3dfaa382a
4
- data.tar.gz: d2c7e51ab9b44078230c00dc6b6d824b47be9ca7
3
+ metadata.gz: f03f388280b75998a4a1db19a85291a6be317011
4
+ data.tar.gz: 7148f93dfa09e3cd38c9d3c9538027702bd246ac
5
5
  SHA512:
6
- metadata.gz: a4466289fdd1415b918f20646745589e5cd36b8f9fa3bb3bcdf1335faabfd6fd81b06d2cb4ccaefed4d242346f6e45776664b63293a1dfe70e6df4973334bbb8
7
- data.tar.gz: 73c820c29bd1a684bf6c119f29e93e17d75f8e761684035a857cc22ea34abd6bd54c5fb8c1217d943377f5d9168baa64bed1b0d5bcaba1a23749ac4da6648d80
6
+ metadata.gz: 43d00494044dcda52d42b1395f899854650e0c9cbb402a9909b63ffa45e33d325eb625f5f87ed3e691c88d3c437dee1c2e6691270da5e0976917b2eba0d48110
7
+ data.tar.gz: 254984468e03b96d3a2a8781658d0ddee210f33afb5ae0b1005500365ed98dbc6091e481d9827195b9174bb7a28620f53fdfef2513dbda5d20dded90f3d8b3c2
@@ -184,11 +184,21 @@ module LearnConfig
184
184
  ensure_default_dir_exists!(learn_dir)
185
185
  ensure_config_file_exists!(config_path)
186
186
 
187
- data = YAML.dump({ learn_directory: learn_dir, editor: "subl" })
187
+ editor = get_default_editor
188
+
189
+ data = YAML.dump({ learn_directory: learn_dir, editor: editor })
188
190
 
189
191
  File.write(config_path, data)
190
192
  end
191
193
 
194
+ def get_default_editor
195
+ ENV['EDITOR'] || (on_a_mac? ? 'subl' : '')
196
+ end
197
+
198
+ def on_a_mac?
199
+ !!RUBY_PLATFORM.match(/darwin/)
200
+ end
201
+
192
202
  def ensure_default_dir_exists!(learn_dir)
193
203
  FileUtils.mkdir_p(learn_dir)
194
204
  end
@@ -1,3 +1,3 @@
1
1
  module LearnConfig
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: learn-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flatiron School