gloo 0.3.0 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/.rubocop.yml +73 -0
  4. data/Gemfile +2 -2
  5. data/Gemfile.lock +86 -83
  6. data/Rakefile +7 -6
  7. data/bin/console +4 -4
  8. data/gloo.gemspec +22 -18
  9. data/lib/gloo.rb +6 -6
  10. data/lib/gloo/app/args.rb +30 -31
  11. data/lib/gloo/app/engine.rb +80 -30
  12. data/lib/gloo/app/help.rb +17 -11
  13. data/lib/gloo/app/info.rb +3 -3
  14. data/lib/gloo/app/log.rb +17 -17
  15. data/lib/gloo/app/mode.rb +4 -4
  16. data/lib/gloo/app/settings.rb +51 -41
  17. data/lib/gloo/convert/string_to_datetime.rb +21 -0
  18. data/lib/gloo/convert/string_to_decimal.rb +20 -0
  19. data/lib/gloo/convert/string_to_integer.rb +20 -0
  20. data/lib/gloo/core/baseo.rb +7 -7
  21. data/lib/gloo/core/dictionary.rb +30 -27
  22. data/lib/gloo/core/error.rb +50 -0
  23. data/lib/gloo/core/event_manager.rb +17 -23
  24. data/lib/gloo/core/factory.rb +149 -39
  25. data/lib/gloo/core/gloo_system.rb +121 -54
  26. data/lib/gloo/core/heap.rb +15 -13
  27. data/lib/gloo/core/it.rb +5 -5
  28. data/lib/gloo/core/literal.rb +7 -7
  29. data/lib/gloo/core/obj.rb +138 -79
  30. data/lib/gloo/core/obj_finder.rb +9 -14
  31. data/lib/gloo/core/op.rb +8 -8
  32. data/lib/gloo/core/parser.rb +27 -26
  33. data/lib/gloo/core/pn.rb +68 -52
  34. data/lib/gloo/core/script.rb +7 -7
  35. data/lib/gloo/core/tokens.rb +39 -41
  36. data/lib/gloo/core/verb.rb +30 -19
  37. data/lib/gloo/exec/dispatch.rb +30 -0
  38. data/lib/gloo/exec/runner.rb +43 -0
  39. data/lib/gloo/expr/expression.rb +36 -43
  40. data/lib/gloo/expr/l_boolean.rb +7 -6
  41. data/lib/gloo/expr/l_decimal.rb +34 -0
  42. data/lib/gloo/expr/l_integer.rb +5 -4
  43. data/lib/gloo/expr/l_string.rb +13 -15
  44. data/lib/gloo/expr/op_div.rb +5 -5
  45. data/lib/gloo/expr/op_minus.rb +5 -5
  46. data/lib/gloo/expr/op_mult.rb +5 -5
  47. data/lib/gloo/expr/op_plus.rb +7 -7
  48. data/lib/gloo/objs/basic/alias.rb +111 -0
  49. data/lib/gloo/objs/basic/boolean.rb +63 -38
  50. data/lib/gloo/objs/basic/container.rb +71 -12
  51. data/lib/gloo/objs/basic/decimal.rb +96 -0
  52. data/lib/gloo/objs/basic/integer.rb +45 -16
  53. data/lib/gloo/objs/basic/script.rb +62 -38
  54. data/lib/gloo/objs/basic/string.rb +47 -15
  55. data/lib/gloo/objs/basic/text.rb +69 -21
  56. data/lib/gloo/objs/basic/untyped.rb +35 -10
  57. data/lib/gloo/objs/cli/banner.rb +137 -0
  58. data/lib/gloo/objs/cli/bar.rb +141 -0
  59. data/lib/gloo/objs/cli/colorize.rb +54 -24
  60. data/lib/gloo/objs/cli/confirm.rb +63 -29
  61. data/lib/gloo/objs/cli/menu.rb +236 -0
  62. data/lib/gloo/objs/cli/menu_item.rb +128 -0
  63. data/lib/gloo/objs/cli/pastel.rb +120 -0
  64. data/lib/gloo/objs/cli/prompt.rb +73 -31
  65. data/lib/gloo/objs/cli/select.rb +153 -0
  66. data/lib/gloo/objs/ctrl/each.rb +128 -61
  67. data/lib/gloo/objs/ctrl/repeat.rb +129 -0
  68. data/lib/gloo/objs/data/markdown.rb +109 -0
  69. data/lib/gloo/objs/data/table.rb +168 -0
  70. data/lib/gloo/objs/dev/git.rb +98 -64
  71. data/lib/gloo/objs/dt/date.rb +72 -0
  72. data/lib/gloo/objs/dt/datetime.rb +84 -0
  73. data/lib/gloo/objs/dt/time.rb +72 -0
  74. data/lib/gloo/objs/ror/erb.rb +82 -41
  75. data/lib/gloo/objs/ror/eval.rb +73 -31
  76. data/lib/gloo/objs/snd/play.rb +71 -0
  77. data/lib/gloo/objs/snd/say.rb +120 -0
  78. data/lib/gloo/objs/system/file_handle.rb +129 -48
  79. data/lib/gloo/objs/system/system.rb +84 -38
  80. data/lib/gloo/objs/web/http_get.rb +103 -46
  81. data/lib/gloo/objs/web/http_post.rb +70 -44
  82. data/lib/gloo/objs/web/json.rb +155 -0
  83. data/lib/gloo/objs/web/slack.rb +89 -58
  84. data/lib/gloo/objs/web/teams.rb +88 -53
  85. data/lib/gloo/objs/web/uri.rb +160 -0
  86. data/lib/gloo/persist/file_loader.rb +95 -85
  87. data/lib/gloo/persist/file_saver.rb +12 -12
  88. data/lib/gloo/persist/file_storage.rb +15 -15
  89. data/lib/gloo/persist/line_splitter.rb +79 -0
  90. data/lib/gloo/persist/persist_man.rb +63 -39
  91. data/lib/gloo/utils/words.rb +2 -2
  92. data/lib/gloo/verbs/alert.rb +67 -16
  93. data/lib/gloo/verbs/beep.rb +70 -0
  94. data/lib/gloo/verbs/cls.rb +67 -0
  95. data/lib/gloo/verbs/context.rb +61 -21
  96. data/lib/gloo/verbs/create.rb +52 -21
  97. data/lib/gloo/verbs/help.rb +186 -27
  98. data/lib/gloo/verbs/if.rb +55 -21
  99. data/lib/gloo/verbs/list.rb +55 -24
  100. data/lib/gloo/verbs/load.rb +47 -12
  101. data/lib/gloo/verbs/move.rb +128 -0
  102. data/lib/gloo/verbs/put.rb +90 -34
  103. data/lib/gloo/verbs/quit.rb +43 -12
  104. data/lib/gloo/verbs/run.rb +63 -18
  105. data/lib/gloo/verbs/save.rb +45 -10
  106. data/lib/gloo/verbs/show.rb +56 -22
  107. data/lib/gloo/verbs/tell.rb +45 -13
  108. data/lib/gloo/verbs/unless.rb +56 -21
  109. data/lib/gloo/verbs/version.rb +42 -12
  110. data/lib/gloo/verbs/wait.rb +73 -0
  111. data/lib/run.rb +5 -5
  112. metadata +90 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa0507913bb322d98577252dce4f699185f09d2dc87dc4a8f80ea4fc71859fcc
4
- data.tar.gz: 7539b9d58d14baeb60cd98cdea9c92f3330d00da5e1c743fd81aefc7246d03e8
3
+ metadata.gz: d3c1b097b88823cb4f2295c3f5c78cea3d03f5150c77417e013678dcec59b6ee
4
+ data.tar.gz: 73ecf73cc7d4879c1abd1cad7a2fb9f8a60bdcc39eccf77671c2f2d44583a6f5
5
5
  SHA512:
6
- metadata.gz: c1df92b449aeb3344d47fd8aa3d68b1b7e0ef9001444efbb66897038d8e189d435439c9844afa54948e19c2c161c31213e31ef5ea0573ea31429e30d2f718c51
7
- data.tar.gz: '028f3fe632304b2e947f9955e42d1aa0b768384c9649a112dc47e2d4c2d69e034f586c8b10f0c416dd09f506ec814f8a61f0ca6c7bb2e442e8d0e85846a98d94'
6
+ metadata.gz: 8a108a19699bc347f4dced3b53863a39f6eec154861c40cd673d6964d27549b38607e5e276c5c74313d1648fd454db9667296ee0429abed3a793a687261b67c3
7
+ data.tar.gz: 0e0e9e2540d76a57ae268f1f70e51e8735575743819a5d89e7c3947bdb6cdfb3d44566cbc0359081056bd93e0f75c745046686cb3a5183f94681bd09d410f9c1
Binary file
@@ -0,0 +1,73 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'gloo.gemspec'
4
+
5
+ # -------------- Layout -------------- #
6
+ Layout/SpaceInsideParens:
7
+ EnforcedStyle: space
8
+ Layout/EmptyLinesAroundClassBody:
9
+ EnforcedStyle: empty_lines
10
+ Layout/SpaceAroundMethodCallOperator:
11
+ Enabled: true
12
+ Layout/SpaceInsideArrayLiteralBrackets:
13
+ EnforcedStyle: space
14
+ Layout/SpaceInsideReferenceBrackets:
15
+ Enabled: true
16
+ EnforcedStyle: space
17
+
18
+ # -------------- Style -------------- #
19
+ Style/RescueStandardError:
20
+ EnforcedStyle: implicit
21
+ Style/HashSyntax:
22
+ EnforcedStyle: no_mixed_keys
23
+ Style/ExponentialNotation:
24
+ Enabled: true
25
+ Style/HashEachMethods:
26
+ Enabled: true
27
+ Style/HashTransformKeys:
28
+ Enabled: true
29
+ Style/HashTransformValues:
30
+ Enabled: true
31
+ Style/RedundantReturn:
32
+ Enabled: false
33
+ Style/FrozenStringLiteralComment:
34
+ Enabled: false
35
+ Style/GlobalVars:
36
+ Enabled: false
37
+ Style/Documentation:
38
+ Enabled: false
39
+ Style/RedundantSelf:
40
+ Enabled: false
41
+
42
+ # -------------- Naming -------------- #
43
+ Naming/PredicateName:
44
+ Enabled: true
45
+ Naming/AccessorMethodName:
46
+ Enabled: false
47
+
48
+ # -------------- Metrics -------------- #
49
+ Metrics/MethodLength:
50
+ Max: 17 # Default is 10
51
+ Enabled: true
52
+ Metrics/CyclomaticComplexity:
53
+ Max: 9 # Default is 6
54
+ Naming/MethodParameterName:
55
+ MinNameLength: 2 # Default value is 3
56
+ Metrics/PerceivedComplexity:
57
+ Max: 10 # default value is 7
58
+ Metrics/ClassLength:
59
+ Max: 157 # default is 100
60
+ Metrics/AbcSize:
61
+ Max: 37 # default is 15
62
+
63
+ # -------------- Lint -------------- #
64
+ Lint/RaiseException:
65
+ Enabled: true
66
+ Lint/StructNewOverride:
67
+ Enabled: true
68
+ Lint/NonDeterministicRequireOrder:
69
+ Enabled: false
70
+
71
+ # -------------- Security -------------- #
72
+ Security/Eval:
73
+ Enabled: true
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in gloo.gemspec
6
6
  gemspec
@@ -1,130 +1,133 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gloo (0.3.0)
5
- activesupport (~> 5.2, >= 5.2.1)
4
+ gloo (0.5.2)
5
+ activesupport (~> 5.2, >= 5.2.4.3)
6
6
  chronic (~> 0.10, >= 0.10.2)
7
7
  colorize (~> 0.8, >= 0.8.1)
8
+ json (~> 2.1, >= 2.1.0)
9
+ openssl (~> 2.1, >= 2.1.0)
8
10
  tty (~> 0.8, >= 0.8.1)
9
11
 
10
12
  GEM
11
13
  remote: https://rubygems.org/
12
14
  specs:
13
- activesupport (5.2.2)
15
+ activesupport (5.2.4.3)
14
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
17
  i18n (>= 0.7, < 2)
16
18
  minitest (~> 5.1)
17
19
  tzinfo (~> 1.1)
18
20
  chronic (0.10.2)
19
21
  colorize (0.8.1)
20
- concurrent-ruby (1.1.4)
21
- diff-lcs (1.3)
22
- equatable (0.5.0)
23
- i18n (1.3.0)
22
+ concurrent-ruby (1.1.7)
23
+ diff-lcs (1.4.4)
24
+ equatable (0.6.1)
25
+ i18n (1.8.5)
24
26
  concurrent-ruby (~> 1.0)
27
+ json (2.3.1)
25
28
  kramdown (1.16.2)
26
29
  minitest (5.11.3)
27
- necromancer (0.4.0)
28
- pastel (0.7.2)
29
- equatable (~> 0.5.0)
30
- tty-color (~> 0.4.0)
31
- rake (10.5.0)
32
- rouge (3.3.0)
33
- strings (0.1.4)
34
- strings-ansi (~> 0.1.0)
35
- unicode-display_width (~> 1.4.0)
36
- unicode_utils (~> 1.4.0)
30
+ necromancer (0.5.1)
31
+ openssl (2.2.0)
32
+ pastel (0.7.4)
33
+ equatable (~> 0.6)
34
+ tty-color (~> 0.5)
35
+ rake (13.0.1)
36
+ rouge (3.22.0)
37
+ strings (0.1.8)
38
+ strings-ansi (~> 0.1)
39
+ unicode-display_width (~> 1.5)
40
+ unicode_utils (~> 1.4)
37
41
  strings-ansi (0.1.0)
38
42
  thor (0.20.3)
39
43
  thread_safe (0.3.6)
40
- timers (4.2.0)
41
- tty (0.9.1)
44
+ tty (0.10.0)
42
45
  bundler (~> 1.16, < 2.0)
43
46
  equatable (~> 0.5)
44
47
  pastel (~> 0.7.2)
45
48
  thor (~> 0.20.0)
46
- tty-box (~> 0.3.0)
47
- tty-color (~> 0.4)
48
- tty-command (~> 0.8.0)
49
- tty-config (~> 0.3.0)
50
- tty-cursor (~> 0.6)
51
- tty-editor (~> 0.5.0)
52
- tty-file (~> 0.7.0)
53
- tty-font (~> 0.2.0)
54
- tty-markdown (~> 0.5.0)
55
- tty-pager (~> 0.12.0)
56
- tty-pie (~> 0.1.0)
57
- tty-platform (~> 0.2.0)
58
- tty-progressbar (~> 0.16.0)
59
- tty-prompt (~> 0.18.0)
60
- tty-screen (~> 0.6)
61
- tty-spinner (~> 0.9.0)
62
- tty-table (~> 0.10.0)
63
- tty-tree (~> 0.2.0)
49
+ tty-box (~> 0.4.1)
50
+ tty-color (~> 0.5)
51
+ tty-command (~> 0.9.0)
52
+ tty-config (~> 0.3.2)
53
+ tty-cursor (~> 0.7)
54
+ tty-editor (~> 0.5)
55
+ tty-file (~> 0.8.0)
56
+ tty-font (~> 0.4.0)
57
+ tty-logger (~> 0.2.0)
58
+ tty-markdown (~> 0.6.0)
59
+ tty-pager (~> 0.12)
60
+ tty-pie (~> 0.3.0)
61
+ tty-platform (~> 0.2)
62
+ tty-progressbar (~> 0.17)
63
+ tty-prompt (~> 0.19)
64
+ tty-screen (~> 0.7)
65
+ tty-spinner (~> 0.9)
66
+ tty-table (~> 0.11.0)
67
+ tty-tree (~> 0.3)
64
68
  tty-which (~> 0.4)
65
- tty-box (0.3.0)
69
+ tty-box (0.4.1)
66
70
  pastel (~> 0.7.2)
67
- strings (~> 0.1.4)
68
- tty-cursor (~> 0.6.0)
69
- tty-color (0.4.3)
70
- tty-command (0.8.2)
71
+ strings (~> 0.1.6)
72
+ tty-cursor (~> 0.7)
73
+ tty-color (0.5.2)
74
+ tty-command (0.9.0)
71
75
  pastel (~> 0.7.0)
72
- tty-config (0.3.0)
73
- tty-cursor (0.6.0)
74
- tty-editor (0.5.0)
75
- tty-prompt (~> 0.18)
76
+ tty-config (0.3.2)
77
+ tty-cursor (0.7.1)
78
+ tty-editor (0.5.1)
79
+ tty-prompt (~> 0.19)
76
80
  tty-which (~> 0.4)
77
- tty-file (0.7.0)
81
+ tty-file (0.8.0)
78
82
  diff-lcs (~> 1.3)
79
83
  pastel (~> 0.7.2)
80
84
  tty-prompt (~> 0.18)
81
- tty-font (0.2.0)
82
- tty-markdown (0.5.0)
85
+ tty-font (0.4.0)
86
+ tty-logger (0.2.0)
87
+ pastel (~> 0.7.0)
88
+ tty-markdown (0.6.0)
83
89
  kramdown (~> 1.16.2)
84
90
  pastel (~> 0.7.2)
85
91
  rouge (~> 3.3)
86
92
  strings (~> 0.1.4)
87
93
  tty-color (~> 0.4)
88
94
  tty-screen (~> 0.6)
89
- tty-pager (0.12.0)
90
- strings (~> 0.1.4)
91
- tty-screen (~> 0.6)
92
- tty-which (~> 0.4)
93
- tty-pie (0.1.0)
94
- pastel (~> 0.7.2)
95
- tty-cursor (~> 0.6.0)
96
- tty-platform (0.2.0)
97
- tty-progressbar (0.16.0)
95
+ tty-pager (0.13.0)
96
+ strings (~> 0.1.8)
97
+ tty-screen (~> 0.8)
98
+ tty-pie (0.3.0)
99
+ pastel (~> 0.7.3)
100
+ tty-cursor (~> 0.7)
101
+ tty-platform (0.3.0)
102
+ tty-progressbar (0.17.0)
98
103
  strings-ansi (~> 0.1.0)
99
- tty-cursor (~> 0.6.0)
100
- tty-screen (~> 0.6.4)
101
- unicode-display_width (~> 1.3)
102
- tty-prompt (0.18.1)
103
- necromancer (~> 0.4.0)
104
+ tty-cursor (~> 0.7)
105
+ tty-screen (~> 0.7)
106
+ unicode-display_width (~> 1.6)
107
+ tty-prompt (0.21.0)
108
+ necromancer (~> 0.5.0)
104
109
  pastel (~> 0.7.0)
105
- timers (~> 4.0)
106
- tty-cursor (~> 0.6.0)
107
- tty-reader (~> 0.5.0)
108
- tty-reader (0.5.0)
109
- tty-cursor (~> 0.6.0)
110
- tty-screen (~> 0.6.4)
110
+ tty-reader (~> 0.7.0)
111
+ tty-reader (0.7.0)
112
+ tty-cursor (~> 0.7)
113
+ tty-screen (~> 0.7)
111
114
  wisper (~> 2.0.0)
112
- tty-screen (0.6.5)
113
- tty-spinner (0.9.0)
114
- tty-cursor (~> 0.6.0)
115
- tty-table (0.10.0)
116
- equatable (~> 0.5.0)
117
- necromancer (~> 0.4.0)
115
+ tty-screen (0.8.1)
116
+ tty-spinner (0.9.3)
117
+ tty-cursor (~> 0.7)
118
+ tty-table (0.11.0)
119
+ equatable (~> 0.6)
120
+ necromancer (~> 0.5)
118
121
  pastel (~> 0.7.2)
119
- strings (~> 0.1.0)
120
- tty-screen (~> 0.6.4)
121
- tty-tree (0.2.0)
122
- tty-which (0.4.0)
123
- tzinfo (1.2.5)
122
+ strings (~> 0.1.5)
123
+ tty-screen (~> 0.7)
124
+ tty-tree (0.4.0)
125
+ tty-which (0.4.2)
126
+ tzinfo (1.2.7)
124
127
  thread_safe (~> 0.1)
125
- unicode-display_width (1.4.1)
128
+ unicode-display_width (1.7.0)
126
129
  unicode_utils (1.4.0)
127
- wisper (2.0.0)
130
+ wisper (2.0.1)
128
131
 
129
132
  PLATFORMS
130
133
  ruby
@@ -133,7 +136,7 @@ DEPENDENCIES
133
136
  bundler (~> 1.16)
134
137
  gloo!
135
138
  minitest (~> 5.0)
136
- rake (~> 10.0)
139
+ rake (~> 13.0, >= 13.0.1)
137
140
 
138
141
  BUNDLED WITH
139
142
  1.16.2
data/Rakefile CHANGED
@@ -1,12 +1,13 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
3
 
4
4
  Rake::TestTask.new(:test) do |t|
5
- ENV[ 'GLOO_ENV' ] = "TEST"
5
+ ENV[ 'GLOO_ENV' ] = 'TEST'
6
6
 
7
- t.libs << "test"
8
- t.libs << "lib"
9
- t.test_files = FileList["test/**/*_test.rb"]
7
+ t.warning = false
8
+ t.libs << 'test'
9
+ t.libs << 'lib'
10
+ t.test_files = FileList['test/**/*_test.rb']
10
11
  end
11
12
 
12
13
  task :default => :test
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "gloo"
3
+ require 'bundler/setup'
4
+ require 'gloo'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
8
8
 
9
9
  # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
10
+ # require 'pry'
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start(__FILE__)
@@ -4,15 +4,15 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require "gloo/app/info"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "gloo"
7
+ spec.name = 'gloo'
8
8
  spec.version = Gloo::App::Info::VERSION
9
- spec.authors = ["Eric Crane"]
10
- spec.email = ["eric.crane@mac.com"]
9
+ spec.authors = ['Eric Crane']
10
+ spec.email = ['eric.crane@mac.com']
11
11
 
12
12
  spec.summary = %q{Gloo scripting language. A scripting language built on ruby.}
13
13
  spec.description = %q{A scripting languge to keep it all together.}
14
14
  spec.homepage = "http://github.com/ecrane/gloo"
15
- spec.license = "MIT"
15
+ spec.license = 'MIT'
16
16
 
17
17
  # Specify which files should be added to the gem when it is released.
18
18
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -20,19 +20,23 @@ Gem::Specification.new do |spec|
20
20
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
21
  end
22
22
 
23
- spec.bindir = "exe"
23
+ spec.bindir = 'exe'
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
- spec.require_paths = ["lib"]
26
-
27
- spec.executables << "o"
28
- spec.executables << "gloo"
29
-
30
- spec.add_development_dependency "bundler", "~> 1.16"
31
- spec.add_development_dependency "rake", "~> 10.0"
32
- spec.add_development_dependency "minitest", "~> 5.0"
33
-
34
- spec.add_dependency "activesupport", "~> 5.2", '>= 5.2.1'
35
- spec.add_dependency "chronic", "~> 0.10", '>= 0.10.2'
36
- spec.add_dependency "tty", "~> 0.8", '>= 0.8.1'
37
- spec.add_dependency "colorize", "~> 0.8", '>= 0.8.1'
25
+ spec.require_paths = ['lib']
26
+
27
+ spec.executables << 'o'
28
+ spec.executables << 'gloo'
29
+
30
+ spec.add_development_dependency 'bundler', '~> 1.16'
31
+ spec.add_development_dependency 'minitest', '~> 5.0'
32
+ # spec.add_development_dependency 'rake', '~> 10.0'
33
+ spec.add_development_dependency "rake", '~> 13.0', '>= 13.0.1'
34
+
35
+ spec.add_dependency "activesupport", '~> 5.2', ">= 5.2.4.3"
36
+ # spec.add_dependency 'activesupport', '~> 5.2', '>= 5.2.1'
37
+ spec.add_dependency 'chronic', '~> 0.10', '>= 0.10.2'
38
+ spec.add_dependency 'colorize', '~> 0.8', '>= 0.8.1'
39
+ spec.add_dependency 'tty', '~> 0.8', '>= 0.8.1'
40
+ spec.add_dependency 'json', '~> 2.1', '>= 2.1.0'
41
+ spec.add_dependency 'openssl', '~> 2.1', '>= 2.1.0'
38
42
  end
@@ -5,15 +5,15 @@
5
5
  #
6
6
 
7
7
  path = File.dirname( File.absolute_path( __FILE__ ) )
8
- root = File.join( path, "gloo", "**/*.rb" )
9
- Dir.glob( root ) { |ruby_file| require ruby_file }
10
-
11
- module Gloo
8
+ root = File.join( path, 'gloo', '**/*.rb' )
9
+ Dir.glob( root ).each do |ruby_file|
10
+ require ruby_file
11
+ end
12
12
 
13
+ module Gloo
13
14
  def self.run
14
15
  params = []
15
- ( params << "--cli" ) if ARGV.count == 0
16
+ ( params << '--cli' ) if ARGV.count.zero?
16
17
  Gloo::App::Engine.new( params ).start
17
18
  end
18
-
19
19
  end
@@ -11,61 +11,60 @@ require 'colorize'
11
11
  module Gloo
12
12
  module App
13
13
  class Args
14
-
15
- attr_reader :switches, :files
16
-
14
+
15
+ attr_reader :switches, :files
16
+
17
17
  def initialize( params = [] )
18
18
  @switches = []
19
19
  @files = []
20
-
20
+
21
21
  params.each { |o| process_one_arg( o ) }
22
22
  ARGV.each { |o| process_one_arg( o ) }
23
23
  end
24
-
24
+
25
25
  # Was the --quiet arg passed?
26
26
  def quiet?
27
- return @switches.include?( "quiet" )
27
+ return @switches.include?( 'quiet' )
28
28
  end
29
-
30
- #
29
+
30
+ #
31
31
  # Detect the mode to be run in.
32
32
  # Start by seeing if a mode is specified.
33
33
  # Then look for the presence of files.
34
34
  # Then finally use the default: embedded mode.
35
- #
35
+ #
36
36
  def detect_mode
37
- if ENV[ 'GLOO_ENV' ] == "test"
38
- mode = Mode::TEST
39
- elsif @switches.include?( "version" )
40
- mode = Mode::VERSION
41
- elsif @switches.include?( "help" )
42
- mode = Mode::HELP
43
- elsif @switches.include?( "cli" )
44
- mode = Mode::CLI
45
- elsif @switches.include?( "embed" )
46
- mode = Mode::EMBED
47
- elsif @files.count > 0
48
- mode = Mode::SCRIPT
49
- else
50
- mode = Mode.default_mode
51
- end
37
+ mode = if ENV[ 'GLOO_ENV' ] == 'test'
38
+ Mode::TEST
39
+ elsif @switches.include?( 'version' )
40
+ Mode::VERSION
41
+ elsif @switches.include?( 'help' )
42
+ Mode::HELP
43
+ elsif @switches.include?( 'cli' )
44
+ Mode::CLI
45
+ elsif @switches.include?( 'embed' )
46
+ Mode::EMBED
47
+ elsif @files.count.positive?
48
+ Mode::SCRIPT
49
+ else
50
+ Mode.default_mode
51
+ end
52
52
  $log.debug "running in #{mode} mode"
53
-
53
+
54
54
  return mode
55
55
  end
56
56
 
57
-
58
57
  private
59
-
58
+
60
59
  # Process one argument or parameter.
61
- def process_one_arg arg
62
- if arg.start_with? "--"
63
- switches << arg[2..-1]
60
+ def process_one_arg( arg )
61
+ if arg.start_with? '--'
62
+ switches << arg[ 2..-1 ]
64
63
  else
65
64
  files << arg
66
65
  end
67
66
  end
68
-
67
+
69
68
  end
70
69
  end
71
70
  end