terminalwire 0.2.5 → 0.3.0.alpha2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +67 -5
  3. data/exe/terminalwire +1 -1
  4. data/exe/terminalwire-exec +1 -1
  5. metadata +9 -171
  6. data/.rspec +0 -3
  7. data/CHANGELOG.md +0 -5
  8. data/CODE_OF_CONDUCT.md +0 -132
  9. data/LICENSE.txt +0 -9
  10. data/README.md +0 -45
  11. data/examples/exec/localrails +0 -2
  12. data/lib/generators/terminalwire/install/USAGE +0 -9
  13. data/lib/generators/terminalwire/install/install_generator.rb +0 -38
  14. data/lib/generators/terminalwire/install/templates/application_terminal.rb.tt +0 -21
  15. data/lib/generators/terminalwire/install/templates/bin/terminalwire +0 -2
  16. data/lib/generators/terminalwire/install/templates/main_terminal.rb +0 -40
  17. data/lib/terminalwire/adapter.rb +0 -53
  18. data/lib/terminalwire/cache.rb +0 -114
  19. data/lib/terminalwire/client/entitlement/environment_variables.rb +0 -26
  20. data/lib/terminalwire/client/entitlement/paths.rb +0 -97
  21. data/lib/terminalwire/client/entitlement/policy.rb +0 -117
  22. data/lib/terminalwire/client/entitlement/schemes.rb +0 -26
  23. data/lib/terminalwire/client/entitlement.rb +0 -9
  24. data/lib/terminalwire/client/exec.rb +0 -44
  25. data/lib/terminalwire/client/handler.rb +0 -67
  26. data/lib/terminalwire/client/resource.rb +0 -204
  27. data/lib/terminalwire/client/server_license_verification.rb +0 -74
  28. data/lib/terminalwire/client.rb +0 -30
  29. data/lib/terminalwire/logging.rb +0 -8
  30. data/lib/terminalwire/rails.rb +0 -69
  31. data/lib/terminalwire/server/context.rb +0 -80
  32. data/lib/terminalwire/server/resource.rb +0 -120
  33. data/lib/terminalwire/server.rb +0 -63
  34. data/lib/terminalwire/thor.rb +0 -67
  35. data/lib/terminalwire/transport.rb +0 -58
  36. data/lib/terminalwire/version.rb +0 -5
  37. data/lib/terminalwire.rb +0 -56
  38. data/sig/terminalwire.rbs +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 309645ee703cb95d71b6157e1e315c050617f88559ddfd4c8085fed535996b87
4
- data.tar.gz: db83793b2917d729086286e3aed97fd254d7b0191f7fc2359bf1f4674e09cb0e
3
+ metadata.gz: 62b9296fa5007675a2ef390fe027e147d641f4a986919f45e3eb0e2f5315248b
4
+ data.tar.gz: 01cc42157f5ad67ed74810e568ed6920f9b10fc73667cd3e082876da2f9d38bc
5
5
  SHA512:
6
- metadata.gz: 4bf0d6aff7c74689343d33f91ef8cbbd3f65277b0882c821159aab58979c5bfad22400c4159179e8b659851b276abda353943d853a289a720bb8c92a901bbc52
7
- data.tar.gz: caac5ae325c02b144da767aacf7d54d6e112dfee712664e6bffff5822c3e02f536e589cd7113d273ec3be7c6ddfe5fcde5688e0b9875ed48de51b4447dd51bd1
6
+ metadata.gz: 8d533aee964375685b0730f98d2c333f4e68dd4ada66d190f1731a200f72ca95ecd3ca6477685eed3d9aa1af1da25987df1fef85d8d50f11f4080da361793152
7
+ data.tar.gz: '0720835165666367b1a0498465c3a2f134bc23e3e315e3feb9f187efc0fa1f0f04eaf6c7b0ae38cde067a1a839ee0d7edc28428834353d14bf6fbb51026caa3b'
data/Rakefile CHANGED
@@ -1,8 +1,70 @@
1
- # frozen_string_literal: true
1
+ require 'pathname'
2
2
 
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
3
+ task :default do
4
+ ruby_version = "3.3.6"
5
+ os = "osx"
6
+ platform = "arm64"
7
+ url = "https://github.com/YOU54F/traveling-ruby/releases/download/rel-20241122/traveling-ruby-20241122-#{ruby_version}-#{os}-#{platform}-full.tar.gz"
8
+ path = Pathname.new("package/#{os}-#{platform}")
9
+ gem = Gem::Specification.load("terminalwire.gemspec")
5
10
 
6
- RSpec::Core::RakeTask.new(:spec)
11
+ sh "mkdir -p #{path}"
7
12
 
8
- task default: :spec
13
+ # Don't bother downloading if we already have the file
14
+ unless File.exist? path.join("lib/ruby/info/RUBY_COMPAT_VERSION")
15
+ sh "mkdir -p #{path.join("lib/ruby")}"
16
+ sh "curl -L #{url} | tar -xzf - -C #{path.join("lib/ruby")}"
17
+ end
18
+
19
+ # Install the base gem and all of its dependencies in the vendor directory.
20
+ sh "gem install #{gem.name} --version '#{gem.version}' --install-dir #{path.join("lib/vendor")} --no-document --verbose"
21
+
22
+ # Remove caches to make package smaller
23
+ sh "rm -rf #{path.join("lib/vendor/cache")}"
24
+ sh "rm -rf #{path.join("lib/vendor/bin")}"
25
+ sh "rm -rf #{path.join("lib/vendor/doc")}"
26
+ sh "rm -rf #{path.join("lib/vendor/plugins")}"
27
+
28
+ File.write path.join("lib/boot.rb"), <<~RUBY
29
+ # Resolve the base directory
30
+ base_dir = File.expand_path("../..", __FILE__)
31
+
32
+ # Add all gem paths under lib/vendor to the load path
33
+ Dir.glob(File.join(base_dir, "lib/vendor/gems/*/lib")).each do |gem_path|
34
+ $LOAD_PATH.unshift gem_path
35
+ end
36
+ RUBY
37
+
38
+ gems = path.glob("lib/vendor/specifications/*.gemspec").each_with_object({}) do |spec_path, hash|
39
+ spec = Gem::Specification.load(spec_path.to_s)
40
+ hash[spec.name] = spec
41
+ end
42
+
43
+ terminalwire_gem = gems.fetch("terminalwire")
44
+
45
+ gem_path = Pathname.new(terminalwire_gem.full_gem_path).relative_path_from path.expand_path
46
+ exe_path = gem_path.join(terminalwire_gem.bindir, "terminalwire-exec")
47
+
48
+ # Let's write the executable path into the thing...'
49
+ File.write path.join("terminalwire-exec"), <<~RUBY
50
+ #!/bin/bash
51
+ # Resolve the directory of the current script
52
+ SELFDIR="$(cd "$(dirname "$0")" && pwd)"
53
+
54
+ # Path to the embedded Ruby executable
55
+ RUBY_EXEC="$SELFDIR/lib/ruby/bin/ruby"
56
+ BOOT_SCRIPT="$SELFDIR/lib/boot.rb"
57
+ PROGRAM="$SELFDIR/#{exe_path}"
58
+
59
+ # Pass the boot script and the main Ruby script to Ruby
60
+ exec "$RUBY_EXEC" -r"$BOOT_SCRIPT" "$PROGRAM" "$@"
61
+ RUBY
62
+
63
+ File.chmod 0755, path.join("terminalwire-exec")
64
+
65
+ # TODO: download and install each gem extension for its platform.
66
+ native_gems = gems.values.select{ _1.extensions.any? }
67
+ native_gems.each do |native_gem|
68
+ p native_gem
69
+ end
70
+ end
data/exe/terminalwire CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- require_relative "../lib/terminalwire.rb"
2
+ require "terminalwire/client"
3
3
 
4
4
  begin
5
5
  Terminalwire::Client.websocket(url: "wss://terminalwire.com/terminal")
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- require_relative "../lib/terminalwire.rb"
2
+ require "terminalwire/client"
3
3
 
4
4
  begin
5
5
  Terminalwire::Client::Exec.start
metadata CHANGED
@@ -1,155 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminalwire
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.3.0.alpha2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-11-13 00:00:00.000000000 Z
10
+ date: 2025-01-16 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: async-websocket
13
+ name: terminalwire-client
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - "~>"
16
+ - - '='
18
17
  - !ruby/object:Gem::Version
19
- version: '0.30'
18
+ version: 0.3.0.alpha2
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
- - - "~>"
23
+ - - '='
25
24
  - !ruby/object:Gem::Version
26
- version: '0.30'
27
- - !ruby/object:Gem::Dependency
28
- name: zeitwerk
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '2.0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '2.0'
41
- - !ruby/object:Gem::Dependency
42
- name: thor
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '1.3'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '1.3'
55
- - !ruby/object:Gem::Dependency
56
- name: msgpack
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '1.7'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1.7'
69
- - !ruby/object:Gem::Dependency
70
- name: launchy
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '3.0'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '3.0'
83
- - !ruby/object:Gem::Dependency
84
- name: jwt
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '2.0'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '2.0'
97
- - !ruby/object:Gem::Dependency
98
- name: uri-builder
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: 0.1.9
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: 0.1.9
111
- - !ruby/object:Gem::Dependency
112
- name: rake
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '13.0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '13.0'
125
- - !ruby/object:Gem::Dependency
126
- name: rspec
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '3.0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '3.0'
139
- - !ruby/object:Gem::Dependency
140
- name: rails
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '7.2'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '7.2'
25
+ version: 0.3.0.alpha2
153
26
  description: Stream command-line apps from your server without a web API
154
27
  email:
155
28
  - brad@terminalwire.com
@@ -159,52 +32,18 @@ executables:
159
32
  extensions: []
160
33
  extra_rdoc_files: []
161
34
  files:
162
- - ".rspec"
163
- - CHANGELOG.md
164
- - CODE_OF_CONDUCT.md
165
- - LICENSE.txt
166
- - README.md
167
35
  - Rakefile
168
- - examples/exec/localrails
169
36
  - exe/terminalwire
170
37
  - exe/terminalwire-exec
171
- - lib/generators/terminalwire/install/USAGE
172
- - lib/generators/terminalwire/install/install_generator.rb
173
- - lib/generators/terminalwire/install/templates/application_terminal.rb.tt
174
- - lib/generators/terminalwire/install/templates/bin/terminalwire
175
- - lib/generators/terminalwire/install/templates/main_terminal.rb
176
- - lib/terminalwire.rb
177
- - lib/terminalwire/adapter.rb
178
- - lib/terminalwire/cache.rb
179
- - lib/terminalwire/client.rb
180
- - lib/terminalwire/client/entitlement.rb
181
- - lib/terminalwire/client/entitlement/environment_variables.rb
182
- - lib/terminalwire/client/entitlement/paths.rb
183
- - lib/terminalwire/client/entitlement/policy.rb
184
- - lib/terminalwire/client/entitlement/schemes.rb
185
- - lib/terminalwire/client/exec.rb
186
- - lib/terminalwire/client/handler.rb
187
- - lib/terminalwire/client/resource.rb
188
- - lib/terminalwire/client/server_license_verification.rb
189
- - lib/terminalwire/logging.rb
190
- - lib/terminalwire/rails.rb
191
- - lib/terminalwire/server.rb
192
- - lib/terminalwire/server/context.rb
193
- - lib/terminalwire/server/resource.rb
194
- - lib/terminalwire/thor.rb
195
- - lib/terminalwire/transport.rb
196
- - lib/terminalwire/version.rb
197
- - sig/terminalwire.rbs
198
38
  homepage: https://terminalwire.com/ruby
199
39
  licenses:
200
40
  - Proprietary (https://terminalwire.com/license)
201
41
  metadata:
202
42
  allowed_push_host: https://rubygems.org/
203
43
  homepage_uri: https://terminalwire.com/ruby
204
- source_code_uri: https://github.com/terminalwire/ruby
44
+ source_code_uri: https://github.com/terminalwire/ruby/tree/main/terminalwire
205
45
  changelog_uri: https://github.com/terminalwire/ruby/tags
206
46
  funding_uri: https://terminalwire.com/funding
207
- post_install_message:
208
47
  rdoc_options: []
209
48
  require_paths:
210
49
  - lib
@@ -219,8 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
58
  - !ruby/object:Gem::Version
220
59
  version: '0'
221
60
  requirements: []
222
- rubygems_version: 3.5.16
223
- signing_key:
61
+ rubygems_version: 3.6.2
224
62
  specification_version: 4
225
63
  summary: Ship a CLI for your web app. No API required.
226
64
  test_files: []
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/CHANGELOG.md DELETED
@@ -1,5 +0,0 @@
1
- ## [Unreleased]
2
-
3
- ## [0.1.0] - 2024-08-29
4
-
5
- - Initial release
data/CODE_OF_CONDUCT.md DELETED
@@ -1,132 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- We as members, contributors, and leaders pledge to make participation in our
6
- community a harassment-free experience for everyone, regardless of age, body
7
- size, visible or invisible disability, ethnicity, sex characteristics, gender
8
- identity and expression, level of experience, education, socio-economic status,
9
- nationality, personal appearance, race, caste, color, religion, or sexual
10
- identity and orientation.
11
-
12
- We pledge to act and interact in ways that contribute to an open, welcoming,
13
- diverse, inclusive, and healthy community.
14
-
15
- ## Our Standards
16
-
17
- Examples of behavior that contributes to a positive environment for our
18
- community include:
19
-
20
- * Demonstrating empathy and kindness toward other people
21
- * Being respectful of differing opinions, viewpoints, and experiences
22
- * Giving and gracefully accepting constructive feedback
23
- * Accepting responsibility and apologizing to those affected by our mistakes,
24
- and learning from the experience
25
- * Focusing on what is best not just for us as individuals, but for the overall
26
- community
27
-
28
- Examples of unacceptable behavior include:
29
-
30
- * The use of sexualized language or imagery, and sexual attention or advances of
31
- any kind
32
- * Trolling, insulting or derogatory comments, and personal or political attacks
33
- * Public or private harassment
34
- * Publishing others' private information, such as a physical or email address,
35
- without their explicit permission
36
- * Other conduct which could reasonably be considered inappropriate in a
37
- professional setting
38
-
39
- ## Enforcement Responsibilities
40
-
41
- Community leaders are responsible for clarifying and enforcing our standards of
42
- acceptable behavior and will take appropriate and fair corrective action in
43
- response to any behavior that they deem inappropriate, threatening, offensive,
44
- or harmful.
45
-
46
- Community leaders have the right and responsibility to remove, edit, or reject
47
- comments, commits, code, wiki edits, issues, and other contributions that are
48
- not aligned to this Code of Conduct, and will communicate reasons for moderation
49
- decisions when appropriate.
50
-
51
- ## Scope
52
-
53
- This Code of Conduct applies within all community spaces, and also applies when
54
- an individual is officially representing the community in public spaces.
55
- Examples of representing our community include using an official email address,
56
- posting via an official social media account, or acting as an appointed
57
- representative at an online or offline event.
58
-
59
- ## Enforcement
60
-
61
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
- reported to the community leaders responsible for enforcement at
63
- [INSERT CONTACT METHOD].
64
- All complaints will be reviewed and investigated promptly and fairly.
65
-
66
- All community leaders are obligated to respect the privacy and security of the
67
- reporter of any incident.
68
-
69
- ## Enforcement Guidelines
70
-
71
- Community leaders will follow these Community Impact Guidelines in determining
72
- the consequences for any action they deem in violation of this Code of Conduct:
73
-
74
- ### 1. Correction
75
-
76
- **Community Impact**: Use of inappropriate language or other behavior deemed
77
- unprofessional or unwelcome in the community.
78
-
79
- **Consequence**: A private, written warning from community leaders, providing
80
- clarity around the nature of the violation and an explanation of why the
81
- behavior was inappropriate. A public apology may be requested.
82
-
83
- ### 2. Warning
84
-
85
- **Community Impact**: A violation through a single incident or series of
86
- actions.
87
-
88
- **Consequence**: A warning with consequences for continued behavior. No
89
- interaction with the people involved, including unsolicited interaction with
90
- those enforcing the Code of Conduct, for a specified period of time. This
91
- includes avoiding interactions in community spaces as well as external channels
92
- like social media. Violating these terms may lead to a temporary or permanent
93
- ban.
94
-
95
- ### 3. Temporary Ban
96
-
97
- **Community Impact**: A serious violation of community standards, including
98
- sustained inappropriate behavior.
99
-
100
- **Consequence**: A temporary ban from any sort of interaction or public
101
- communication with the community for a specified period of time. No public or
102
- private interaction with the people involved, including unsolicited interaction
103
- with those enforcing the Code of Conduct, is allowed during this period.
104
- Violating these terms may lead to a permanent ban.
105
-
106
- ### 4. Permanent Ban
107
-
108
- **Community Impact**: Demonstrating a pattern of violation of community
109
- standards, including sustained inappropriate behavior, harassment of an
110
- individual, or aggression toward or disparagement of classes of individuals.
111
-
112
- **Consequence**: A permanent ban from any sort of public interaction within the
113
- community.
114
-
115
- ## Attribution
116
-
117
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
- version 2.1, available at
119
- [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
-
121
- Community Impact Guidelines were inspired by
122
- [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
-
124
- For answers to common questions about this code of conduct, see the FAQ at
125
- [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
- [https://www.contributor-covenant.org/translations][translations].
127
-
128
- [homepage]: https://www.contributor-covenant.org
129
- [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
- [Mozilla CoC]: https://github.com/mozilla/diversity
131
- [FAQ]: https://www.contributor-covenant.org/faq
132
- [translations]: https://www.contributor-covenant.org/translations
data/LICENSE.txt DELETED
@@ -1,9 +0,0 @@
1
- Copyright (c) 2024 Brad Gessler.
2
-
3
- License is propietary. Here's the deal:
4
-
5
- * You need to pay for Terminalwire if your organization has more than $1m in assets or makes more than $100k/year in revenue.
6
- * Terminalwire is free for personal use, hobbyists, or businesses that are just starting out, but server licenses still need to be registered at https://terminalwire.com/developers/licenses.
7
- * You can only use the Terminalwire client with licensed Terminalwire servers.
8
-
9
- This list is not exhaustive, please read the full license text at https://terminalwire.com/license.
data/README.md DELETED
@@ -1,45 +0,0 @@
1
- # Terminalwire
2
-
3
- Unlike most command-line tools for web services that require an API, Terminalwire streams terminal I/O between a web server and client over WebSockets. This means you can use your preferred command-line parser within your favorite web server framework to deliver a delightful CLI experience to your users.
4
-
5
- ## Installation
6
-
7
- Install the gem and add to the application's Gemfile by executing:
8
-
9
- $ bundle add terminalwire
10
-
11
- If bundler is not being used to manage dependencies, install the gem by executing:
12
-
13
- $ gem install terminalwire
14
-
15
- ## Rails
16
-
17
- Run the intallation command:
18
-
19
- $ rails g terminalwire:install my-app
20
-
21
- This generates the `./bin/my-app` file. Run it to verify that it connects to the server.
22
-
23
- $ bin/my-app
24
- Commands:
25
- my-app help [COMMAND] # Describe available commands or one specific command
26
-
27
- To edit the command-line, open `./app/cli/main_cli.rb` and make changes to the `MainCLI` class.
28
-
29
- ## Development
30
-
31
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
32
-
33
- 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
-
35
- ## Contributing
36
-
37
- Bug reports and pull requests are welcome on GitHub at https://github.com/terminalwire/ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/terminalwire/ruby/blob/main/CODE_OF_CONDUCT.md).
38
-
39
- ## License
40
-
41
- The gem is available as a propietary license. Email brad@terminalwire.com to discuss licensing.
42
-
43
- ## Code of Conduct
44
-
45
- Everyone interacting in the Terminalwire project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/terminalwire/ruby/blob/main/CODE_OF_CONDUCT.md).
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env terminalwire-exec
2
- url: "ws://localhost:3000/terminal"
@@ -1,9 +0,0 @@
1
- Description:
2
- Installs Terminalwire
3
-
4
- Example:
5
- bin/rails generate terminalwire:install
6
-
7
- This will create:
8
- app/terminal/application_terminal.rb
9
- bin/<your-app>
@@ -1,38 +0,0 @@
1
- require "bundler"
2
-
3
- class Terminalwire::InstallGenerator < Rails::Generators::Base
4
- source_root File.expand_path("templates", __dir__)
5
-
6
- argument :binary_name, type: :string, required: true, banner: "binary_name"
7
-
8
- def create_terminal_files
9
- template "application_terminal.rb.tt", Rails.root.join("app/terminal/application_terminal.rb")
10
- template "main_terminal.rb", Rails.root.join("app/terminal/main_terminal.rb")
11
- end
12
-
13
- def create_binary_files
14
- copy_file "bin/terminalwire", binary_path
15
- chmod binary_path, 0755, verbose: false
16
- end
17
-
18
- def add_route
19
- route <<~ROUTE
20
- match "/terminal",
21
- to: Terminalwire::Server::Thor.new(MainTerminal),
22
- via: [:get, :connect]
23
- ROUTE
24
- end
25
-
26
- def print_post_install_message
27
- say ""
28
- say "Terminalwire has been successfully installed!", :green
29
- say "Run `#{binary_path.relative_path_from(Rails.root)}` to verify everything is in working order. For support visit https://terminalwire.com."
30
- say ""
31
- end
32
-
33
- private
34
-
35
- def binary_path
36
- Rails.root.join("bin", binary_name)
37
- end
38
- end
@@ -1,21 +0,0 @@
1
- # Learn how to use Thor at http://whatisthor.com.
2
- class ApplicationTerminal < Thor
3
- # Enables IO Streaming.
4
- include Terminalwire::Thor
5
-
6
- # The name of your binary. Thor uses this for its help output.
7
- def self.basename = "<%= binary_name %>"
8
-
9
- private
10
-
11
- def current_user=(user)
12
- # The Session object is a hash-like object that encrypts and signs a hash that's
13
- # stored on the client's file sytem. Conceptually, it's similar to Rails signed
14
- # and encrypted client-side cookies.
15
- session["user_id"] = user.id
16
- end
17
-
18
- def current_user
19
- @current_user ||= User.find(session["user_id"])
20
- end
21
- end
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env terminalwire-exec
2
- url: "ws://localhost:3000/terminal"
@@ -1,40 +0,0 @@
1
- class MainTerminal < ApplicationTerminal
2
- desc "hello NAME", "say hello to NAME"
3
- def hello(name)
4
- puts "Hello #{name}"
5
- end
6
-
7
- desc "login", "Login to your account"
8
- def login
9
- print "Email: "
10
- email = gets.chomp
11
-
12
- print "Password: "
13
- password = getpass
14
-
15
- # Replace this with your own authentication logic; this is an example
16
- # of how you might do this with Devise.
17
- user = User.find_for_authentication(email: email)
18
- if user && user.valid_password?(password)
19
- self.current_user = user
20
- puts "Successfully logged in as #{current_user.email}."
21
- else
22
- fail "Could not find a user with that email and password."
23
- end
24
- end
25
-
26
- desc "whoami", "Displays current user information."
27
- def whoami
28
- if self.current_user
29
- puts "Logged in as #{current_user.email}."
30
- else
31
- fail "Not logged in. Run `#{self.class.basename} login` to login."
32
- end
33
- end
34
-
35
- desc "logout", "Logout of your account"
36
- def logout
37
- session.reset
38
- puts "Successfully logged out."
39
- end
40
- end