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 +4 -4
- data/lib/learn_config/setup.rb +11 -1
- data/lib/learn_config/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f03f388280b75998a4a1db19a85291a6be317011
|
4
|
+
data.tar.gz: 7148f93dfa09e3cd38c9d3c9538027702bd246ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43d00494044dcda52d42b1395f899854650e0c9cbb402a9909b63ffa45e33d325eb625f5f87ed3e691c88d3c437dee1c2e6691270da5e0976917b2eba0d48110
|
7
|
+
data.tar.gz: 254984468e03b96d3a2a8781658d0ddee210f33afb5ae0b1005500365ed98dbc6091e481d9827195b9174bb7a28620f53fdfef2513dbda5d20dded90f3d8b3c2
|
data/lib/learn_config/setup.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/learn_config/version.rb
CHANGED