gloo 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +139 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +12 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/gloo +4 -0
- data/exe/o +4 -0
- data/gloo.gemspec +38 -0
- data/lib/gloo.rb +19 -0
- data/lib/gloo/app/args.rb +71 -0
- data/lib/gloo/app/engine.rb +158 -0
- data/lib/gloo/app/help.rb +29 -0
- data/lib/gloo/app/info.rb +21 -0
- data/lib/gloo/app/log.rb +58 -0
- data/lib/gloo/app/mode.rb +25 -0
- data/lib/gloo/app/settings.rb +125 -0
- data/lib/gloo/core/baseo.rb +28 -0
- data/lib/gloo/core/dictionary.rb +101 -0
- data/lib/gloo/core/event_manager.rb +46 -0
- data/lib/gloo/core/factory.rb +67 -0
- data/lib/gloo/core/gloo_system.rb +190 -0
- data/lib/gloo/core/heap.rb +42 -0
- data/lib/gloo/core/it.rb +30 -0
- data/lib/gloo/core/literal.rb +25 -0
- data/lib/gloo/core/obj.rb +222 -0
- data/lib/gloo/core/obj_finder.rb +35 -0
- data/lib/gloo/core/op.rb +33 -0
- data/lib/gloo/core/parser.rb +52 -0
- data/lib/gloo/core/pn.rb +134 -0
- data/lib/gloo/core/script.rb +37 -0
- data/lib/gloo/core/tokens.rb +123 -0
- data/lib/gloo/core/verb.rb +63 -0
- data/lib/gloo/expr/expression.rb +103 -0
- data/lib/gloo/expr/l_boolean.rb +29 -0
- data/lib/gloo/expr/l_integer.rb +29 -0
- data/lib/gloo/expr/l_string.rb +53 -0
- data/lib/gloo/expr/op_div.rb +20 -0
- data/lib/gloo/expr/op_minus.rb +20 -0
- data/lib/gloo/expr/op_mult.rb +20 -0
- data/lib/gloo/expr/op_plus.rb +22 -0
- data/lib/gloo/objs/basic/boolean.rb +113 -0
- data/lib/gloo/objs/basic/container.rb +50 -0
- data/lib/gloo/objs/basic/integer.rb +65 -0
- data/lib/gloo/objs/basic/script.rb +101 -0
- data/lib/gloo/objs/basic/string.rb +65 -0
- data/lib/gloo/objs/basic/text.rb +64 -0
- data/lib/gloo/objs/basic/untyped.rb +42 -0
- data/lib/gloo/objs/cli/colorize.rb +73 -0
- data/lib/gloo/objs/cli/confirm.rb +92 -0
- data/lib/gloo/objs/cli/prompt.rb +92 -0
- data/lib/gloo/objs/ctrl/each.rb +212 -0
- data/lib/gloo/objs/dev/git.rb +112 -0
- data/lib/gloo/objs/ror/erb.rb +109 -0
- data/lib/gloo/objs/ror/eval.rb +92 -0
- data/lib/gloo/objs/system/file_handle.rb +86 -0
- data/lib/gloo/objs/system/system.rb +120 -0
- data/lib/gloo/objs/web/http_get.rb +128 -0
- data/lib/gloo/objs/web/http_post.rb +127 -0
- data/lib/gloo/objs/web/slack.rb +126 -0
- data/lib/gloo/objs/web/teams.rb +117 -0
- data/lib/gloo/persist/file_loader.rb +171 -0
- data/lib/gloo/persist/file_saver.rb +43 -0
- data/lib/gloo/persist/file_storage.rb +43 -0
- data/lib/gloo/persist/persist_man.rb +90 -0
- data/lib/gloo/utils/words.rb +19 -0
- data/lib/gloo/verbs/alert.rb +42 -0
- data/lib/gloo/verbs/context.rb +52 -0
- data/lib/gloo/verbs/create.rb +52 -0
- data/lib/gloo/verbs/help.rb +69 -0
- data/lib/gloo/verbs/if.rb +56 -0
- data/lib/gloo/verbs/list.rb +85 -0
- data/lib/gloo/verbs/load.rb +39 -0
- data/lib/gloo/verbs/put.rb +62 -0
- data/lib/gloo/verbs/quit.rb +40 -0
- data/lib/gloo/verbs/run.rb +46 -0
- data/lib/gloo/verbs/save.rb +37 -0
- data/lib/gloo/verbs/show.rb +55 -0
- data/lib/gloo/verbs/tell.rb +47 -0
- data/lib/gloo/verbs/unless.rb +56 -0
- data/lib/gloo/verbs/version.rb +37 -0
- data/lib/run.rb +13 -0
- metadata +254 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: aa0507913bb322d98577252dce4f699185f09d2dc87dc4a8f80ea4fc71859fcc
|
4
|
+
data.tar.gz: 7539b9d58d14baeb60cd98cdea9c92f3330d00da5e1c743fd81aefc7246d03e8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c1df92b449aeb3344d47fd8aa3d68b1b7e0ef9001444efbb66897038d8e189d435439c9844afa54948e19c2c161c31213e31ef5ea0573ea31429e30d2f718c51
|
7
|
+
data.tar.gz: '028f3fe632304b2e947f9955e42d1aa0b768384c9649a112dc47e2d4c2d69e034f586c8b10f0c416dd09f506ec814f8a61f0ca6c7bb2e442e8d0e85846a98d94'
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at eric.crane@mac.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
gloo (0.3.0)
|
5
|
+
activesupport (~> 5.2, >= 5.2.1)
|
6
|
+
chronic (~> 0.10, >= 0.10.2)
|
7
|
+
colorize (~> 0.8, >= 0.8.1)
|
8
|
+
tty (~> 0.8, >= 0.8.1)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
activesupport (5.2.2)
|
14
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
|
+
i18n (>= 0.7, < 2)
|
16
|
+
minitest (~> 5.1)
|
17
|
+
tzinfo (~> 1.1)
|
18
|
+
chronic (0.10.2)
|
19
|
+
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)
|
24
|
+
concurrent-ruby (~> 1.0)
|
25
|
+
kramdown (1.16.2)
|
26
|
+
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)
|
37
|
+
strings-ansi (0.1.0)
|
38
|
+
thor (0.20.3)
|
39
|
+
thread_safe (0.3.6)
|
40
|
+
timers (4.2.0)
|
41
|
+
tty (0.9.1)
|
42
|
+
bundler (~> 1.16, < 2.0)
|
43
|
+
equatable (~> 0.5)
|
44
|
+
pastel (~> 0.7.2)
|
45
|
+
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)
|
64
|
+
tty-which (~> 0.4)
|
65
|
+
tty-box (0.3.0)
|
66
|
+
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
|
+
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-which (~> 0.4)
|
77
|
+
tty-file (0.7.0)
|
78
|
+
diff-lcs (~> 1.3)
|
79
|
+
pastel (~> 0.7.2)
|
80
|
+
tty-prompt (~> 0.18)
|
81
|
+
tty-font (0.2.0)
|
82
|
+
tty-markdown (0.5.0)
|
83
|
+
kramdown (~> 1.16.2)
|
84
|
+
pastel (~> 0.7.2)
|
85
|
+
rouge (~> 3.3)
|
86
|
+
strings (~> 0.1.4)
|
87
|
+
tty-color (~> 0.4)
|
88
|
+
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)
|
98
|
+
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
|
+
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)
|
111
|
+
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)
|
118
|
+
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)
|
124
|
+
thread_safe (~> 0.1)
|
125
|
+
unicode-display_width (1.4.1)
|
126
|
+
unicode_utils (1.4.0)
|
127
|
+
wisper (2.0.0)
|
128
|
+
|
129
|
+
PLATFORMS
|
130
|
+
ruby
|
131
|
+
|
132
|
+
DEPENDENCIES
|
133
|
+
bundler (~> 1.16)
|
134
|
+
gloo!
|
135
|
+
minitest (~> 5.0)
|
136
|
+
rake (~> 10.0)
|
137
|
+
|
138
|
+
BUNDLED WITH
|
139
|
+
1.16.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Eric Crane
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Gloo
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gloo`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'gloo'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install gloo
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gloo. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
Everyone interacting in the OutlineScript project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/gloo/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "gloo"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/gloo
ADDED
data/exe/o
ADDED
data/gloo.gemspec
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "gloo/app/info"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "gloo"
|
8
|
+
spec.version = Gloo::App::Info::VERSION
|
9
|
+
spec.authors = ["Eric Crane"]
|
10
|
+
spec.email = ["eric.crane@mac.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Gloo scripting language. A scripting language built on ruby.}
|
13
|
+
spec.description = %q{A scripting languge to keep it all together.}
|
14
|
+
spec.homepage = "http://github.com/ecrane/gloo"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
|
23
|
+
spec.bindir = "exe"
|
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'
|
38
|
+
end
|
data/lib/gloo.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Start the Engine.
|
5
|
+
#
|
6
|
+
|
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
|
12
|
+
|
13
|
+
def self.run
|
14
|
+
params = []
|
15
|
+
( params << "--cli" ) if ARGV.count == 0
|
16
|
+
Gloo::App::Engine.new( params ).start
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Arguments (parameters) used to specify functionality.
|
5
|
+
# These might have come from the CLI or as parameters
|
6
|
+
# in the constructor.
|
7
|
+
#
|
8
|
+
require 'active_support'
|
9
|
+
require 'colorize'
|
10
|
+
|
11
|
+
module Gloo
|
12
|
+
module App
|
13
|
+
class Args
|
14
|
+
|
15
|
+
attr_reader :switches, :files
|
16
|
+
|
17
|
+
def initialize( params = [] )
|
18
|
+
@switches = []
|
19
|
+
@files = []
|
20
|
+
|
21
|
+
params.each { |o| process_one_arg( o ) }
|
22
|
+
ARGV.each { |o| process_one_arg( o ) }
|
23
|
+
end
|
24
|
+
|
25
|
+
# Was the --quiet arg passed?
|
26
|
+
def quiet?
|
27
|
+
return @switches.include?( "quiet" )
|
28
|
+
end
|
29
|
+
|
30
|
+
#
|
31
|
+
# Detect the mode to be run in.
|
32
|
+
# Start by seeing if a mode is specified.
|
33
|
+
# Then look for the presence of files.
|
34
|
+
# Then finally use the default: embedded mode.
|
35
|
+
#
|
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
|
52
|
+
$log.debug "running in #{mode} mode"
|
53
|
+
|
54
|
+
return mode
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
# Process one argument or parameter.
|
61
|
+
def process_one_arg arg
|
62
|
+
if arg.start_with? "--"
|
63
|
+
switches << arg[2..-1]
|
64
|
+
else
|
65
|
+
files << arg
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|