work_md 0.2.0 → 0.2.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
  SHA256:
3
- metadata.gz: f2935dcad2a4d572722fa3c39017ca68b3446fc07bad13fa8c993c7d3a60529f
4
- data.tar.gz: add270c4aa64a634f4a22ff0f37246940d1216f78fc20b378be7c1a1d374af0e
3
+ metadata.gz: 2f60288ea3fcd8489f2954550b208575e6b1a1fcb1b34aaeca43e9a4c0132a55
4
+ data.tar.gz: 220ac9954f8cf8c654023f5f2a0cb24d82942f103f06b7045aca90c6684657a8
5
5
  SHA512:
6
- metadata.gz: a7c21fa7695913b8161a6b85514b69a77bb15a86a6ddc14692f6b9db1178ac8088028c108e94536e29588d899e8b83d63c1d9b52cbdf3a93cdeab7402c5371b7
7
- data.tar.gz: 3ebadf962e40746eaaf6005005e2608af36d968c6bbfb675cd0dbc37b8dfb409dbeb2aab0902df45f3a5f6bb70684248acaebe28039db166ef20d848af3ccf5f
6
+ metadata.gz: de934d77253bad8c9569d1461f6eef015a56ec2b317fdc7547952271f1a7780e2d4e59fd95705454f4f40f49ddfa67eb75593206142bd9ba76a625faf170dae7
7
+ data.tar.gz: 1c24f71868455beee3c8cf80300cff9a768d3745aee2ae33545ce750ca6e5ccd9d05f8c4ef7303611ed72cca652178d5a356ba34274e45f367d23335e6330dd9
@@ -5,7 +5,6 @@ require 'yaml'
5
5
  module WorkMd
6
6
  module Config
7
7
  DEFAULT_WORK_DIR = Dir.home + '/work_md'
8
- YAML_FILE = YAML.load_file(DEFAULT_WORK_DIR + '/config.yml')
9
8
  DEFAULT_EDITOR = 'vi'
10
9
  TRANSLATIONS = {
11
10
  'pt' =>
@@ -31,11 +30,11 @@ module WorkMd
31
30
  }.freeze
32
31
 
33
32
  def self.title
34
- YAML_FILE['title'] || ''
33
+ yaml_file['title'] || ''
35
34
  end
36
35
 
37
36
  def self.editor
38
- ENV['EDITOR'] || ENV['VISUAL'] || YAML_FILE['editor'] || DEFAULT_EDITOR
37
+ ENV['EDITOR'] || ENV['VISUAL'] || yaml_file['editor'] || DEFAULT_EDITOR
39
38
  end
40
39
 
41
40
  def self.work_dir
@@ -44,8 +43,14 @@ module WorkMd
44
43
 
45
44
  def self.translations
46
45
  TRANSLATIONS[ENV['WORK_MD_LANG']] ||
47
- TRANSLATIONS[YAML_FILE['lang']] ||
46
+ TRANSLATIONS[yaml_file['lang']] ||
48
47
  TRANSLATIONS['en']
49
48
  end
49
+
50
+ def self.yaml_file
51
+ YAML.load_file(DEFAULT_WORK_DIR + '/config.yml')
52
+ rescue StandardError
53
+ {}
54
+ end
50
55
  end
51
56
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WorkMd
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: work_md
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrique Fernandez Teixeira