fluid_cli 0.1.9 → 0.2.1

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 (203) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +200 -1
  3. data/exe/fluid +12 -17
  4. data/lib/fluid_cli/version.rb +1 -1
  5. data/lib/fluid_cli.rb +4 -62
  6. metadata +14 -278
  7. data/Rakefile +0 -26
  8. data/dev.yml +0 -5
  9. data/lib/fluid_cli/api.rb +0 -141
  10. data/lib/fluid_cli/assets/post_auth_page/index.html.erb +0 -34
  11. data/lib/fluid_cli/assets/post_auth_page/style.css +0 -58
  12. data/lib/fluid_cli/command.rb +0 -55
  13. data/lib/fluid_cli/commands/help.rb +0 -21
  14. data/lib/fluid_cli/commands/login.rb +0 -30
  15. data/lib/fluid_cli/commands/logout.rb +0 -38
  16. data/lib/fluid_cli/commands/switch.rb +0 -23
  17. data/lib/fluid_cli/commands/theme/common/company_helper.rb +0 -15
  18. data/lib/fluid_cli/commands/theme/common/root_helper.rb +0 -95
  19. data/lib/fluid_cli/commands/theme/dev.rb +0 -62
  20. data/lib/fluid_cli/commands/theme/help.rb +0 -21
  21. data/lib/fluid_cli/commands/theme/init.rb +0 -46
  22. data/lib/fluid_cli/commands/theme/navigate.rb +0 -57
  23. data/lib/fluid_cli/commands/theme/pull.rb +0 -68
  24. data/lib/fluid_cli/commands/theme/push.rb +0 -132
  25. data/lib/fluid_cli/commands/theme.rb +0 -24
  26. data/lib/fluid_cli/commands/whoami.rb +0 -23
  27. data/lib/fluid_cli/commands.rb +0 -19
  28. data/lib/fluid_cli/company_switcher.rb +0 -69
  29. data/lib/fluid_cli/context.rb +0 -691
  30. data/lib/fluid_cli/db.rb +0 -114
  31. data/lib/fluid_cli/entry_point.rb +0 -10
  32. data/lib/fluid_cli/environment.rb +0 -32
  33. data/lib/fluid_cli/file_system_listener.rb +0 -29
  34. data/lib/fluid_cli/form.rb +0 -42
  35. data/lib/fluid_cli/git.rb +0 -319
  36. data/lib/fluid_cli/http_request.rb +0 -60
  37. data/lib/fluid_cli/identity_auth/servlet.rb +0 -39
  38. data/lib/fluid_cli/identity_auth.rb +0 -126
  39. data/lib/fluid_cli/options.rb +0 -38
  40. data/lib/fluid_cli/packager.rb +0 -36
  41. data/lib/fluid_cli/theme/dev_server/certificate_manager.rb +0 -79
  42. data/lib/fluid_cli/theme/dev_server/errors.rb +0 -9
  43. data/lib/fluid_cli/theme/dev_server/header_hash.rb +0 -98
  44. data/lib/fluid_cli/theme/dev_server/hooks/file_change_hook.rb +0 -39
  45. data/lib/fluid_cli/theme/dev_server/hot_reload/resources/hot-reload-no-script.html +0 -27
  46. data/lib/fluid_cli/theme/dev_server/hot_reload/resources/hot_reload.js +0 -28
  47. data/lib/fluid_cli/theme/dev_server/hot_reload/resources/sse_client.js +0 -43
  48. data/lib/fluid_cli/theme/dev_server/hot_reload/resources/theme.js +0 -16
  49. data/lib/fluid_cli/theme/dev_server/hot_reload/script_injector.rb +0 -54
  50. data/lib/fluid_cli/theme/dev_server/hot_reload.rb +0 -75
  51. data/lib/fluid_cli/theme/dev_server/local_assets.rb +0 -92
  52. data/lib/fluid_cli/theme/dev_server/proxy.rb +0 -235
  53. data/lib/fluid_cli/theme/dev_server/proxy_param_builder.rb +0 -82
  54. data/lib/fluid_cli/theme/dev_server/reload_mode.rb +0 -34
  55. data/lib/fluid_cli/theme/dev_server/sse.rb +0 -75
  56. data/lib/fluid_cli/theme/dev_server/watcher.rb +0 -57
  57. data/lib/fluid_cli/theme/dev_server/web_server.rb +0 -140
  58. data/lib/fluid_cli/theme/dev_server.rb +0 -308
  59. data/lib/fluid_cli/theme/development_theme.rb +0 -101
  60. data/lib/fluid_cli/theme/file.rb +0 -130
  61. data/lib/fluid_cli/theme/forms/select.rb +0 -33
  62. data/lib/fluid_cli/theme/mime_type.rb +0 -34
  63. data/lib/fluid_cli/theme/navigation/resource_fetcher.rb +0 -25
  64. data/lib/fluid_cli/theme/navigation/route_navigator.rb +0 -87
  65. data/lib/fluid_cli/theme/presenters/theme_presenter.rb +0 -49
  66. data/lib/fluid_cli/theme/presenters/themes_presenter.rb +0 -31
  67. data/lib/fluid_cli/theme/root.rb +0 -62
  68. data/lib/fluid_cli/theme/schema_validator.rb +0 -274
  69. data/lib/fluid_cli/theme/syncer/checksums.rb +0 -66
  70. data/lib/fluid_cli/theme/syncer/downloader.rb +0 -54
  71. data/lib/fluid_cli/theme/syncer/error_reporter.rb +0 -45
  72. data/lib/fluid_cli/theme/syncer/merger.rb +0 -53
  73. data/lib/fluid_cli/theme/syncer/operation.rb +0 -58
  74. data/lib/fluid_cli/theme/syncer/standard_reporter.rb +0 -32
  75. data/lib/fluid_cli/theme/syncer/unsupported_script_warning.rb +0 -90
  76. data/lib/fluid_cli/theme/syncer/uploader/forms/apply_to_all.rb +0 -41
  77. data/lib/fluid_cli/theme/syncer/uploader/forms/apply_to_all_form.rb +0 -37
  78. data/lib/fluid_cli/theme/syncer/uploader/forms/base_strategy_form.rb +0 -64
  79. data/lib/fluid_cli/theme/syncer/uploader/forms/select_delete_strategy.rb +0 -29
  80. data/lib/fluid_cli/theme/syncer/uploader/forms/select_update_strategy.rb +0 -30
  81. data/lib/fluid_cli/theme/syncer/uploader/json_delete_handler.rb +0 -49
  82. data/lib/fluid_cli/theme/syncer/uploader/json_update_handler.rb +0 -71
  83. data/lib/fluid_cli/theme/syncer/uploader.rb +0 -105
  84. data/lib/fluid_cli/theme/syncer.rb +0 -500
  85. data/lib/fluid_cli/theme/theme.rb +0 -186
  86. data/lib/fluid_cli/theme/ui/sync_progress_bar.rb +0 -22
  87. data/lib/fluid_cli/thread_pool/job.rb +0 -35
  88. data/lib/fluid_cli/thread_pool.rb +0 -49
  89. data/packaging/homebrew/fluid_cli.base.rb +0 -103
  90. data/vendor/deps/base64/.document +0 -5
  91. data/vendor/deps/base64/.gitignore +0 -9
  92. data/vendor/deps/base64/BSDL +0 -22
  93. data/vendor/deps/base64/COPYING +0 -56
  94. data/vendor/deps/base64/Gemfile +0 -9
  95. data/vendor/deps/base64/LEGAL +0 -60
  96. data/vendor/deps/base64/README.md +0 -48
  97. data/vendor/deps/base64/Rakefile +0 -31
  98. data/vendor/deps/base64/base64.gemspec +0 -28
  99. data/vendor/deps/base64/bin/console +0 -14
  100. data/vendor/deps/base64/bin/setup +0 -8
  101. data/vendor/deps/base64/lib/base64.rb +0 -382
  102. data/vendor/deps/base64/sig/base64.rbs +0 -358
  103. data/vendor/deps/base64/test/base64/test_base64.rb +0 -115
  104. data/vendor/deps/base64/test_sig/test_base64.rb +0 -44
  105. data/vendor/deps/cli-kit/REVISION +0 -1
  106. data/vendor/deps/cli-kit/lib/cli/kit/args/definition.rb +0 -286
  107. data/vendor/deps/cli-kit/lib/cli/kit/args/evaluation.rb +0 -215
  108. data/vendor/deps/cli-kit/lib/cli/kit/args/parser/node.rb +0 -128
  109. data/vendor/deps/cli-kit/lib/cli/kit/args/parser.rb +0 -125
  110. data/vendor/deps/cli-kit/lib/cli/kit/args/tokenizer.rb +0 -130
  111. data/vendor/deps/cli-kit/lib/cli/kit/args.rb +0 -16
  112. data/vendor/deps/cli-kit/lib/cli/kit/base_command.rb +0 -30
  113. data/vendor/deps/cli-kit/lib/cli/kit/command_help.rb +0 -268
  114. data/vendor/deps/cli-kit/lib/cli/kit/command_registry.rb +0 -150
  115. data/vendor/deps/cli-kit/lib/cli/kit/config.rb +0 -137
  116. data/vendor/deps/cli-kit/lib/cli/kit/core_ext.rb +0 -28
  117. data/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb +0 -166
  118. data/vendor/deps/cli-kit/lib/cli/kit/executor.rb +0 -92
  119. data/vendor/deps/cli-kit/lib/cli/kit/ini.rb +0 -91
  120. data/vendor/deps/cli-kit/lib/cli/kit/levenshtein.rb +0 -92
  121. data/vendor/deps/cli-kit/lib/cli/kit/logger.rb +0 -94
  122. data/vendor/deps/cli-kit/lib/cli/kit/opts.rb +0 -248
  123. data/vendor/deps/cli-kit/lib/cli/kit/parse_args.rb +0 -55
  124. data/vendor/deps/cli-kit/lib/cli/kit/resolver.rb +0 -66
  125. data/vendor/deps/cli-kit/lib/cli/kit/support/test_helper.rb +0 -260
  126. data/vendor/deps/cli-kit/lib/cli/kit/support.rb +0 -11
  127. data/vendor/deps/cli-kit/lib/cli/kit/system.rb +0 -290
  128. data/vendor/deps/cli-kit/lib/cli/kit/util.rb +0 -118
  129. data/vendor/deps/cli-kit/lib/cli/kit/version.rb +0 -7
  130. data/vendor/deps/cli-kit/lib/cli/kit.rb +0 -139
  131. data/vendor/deps/cli-ui/REVISION +0 -1
  132. data/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +0 -218
  133. data/vendor/deps/cli-ui/lib/cli/ui/color.rb +0 -101
  134. data/vendor/deps/cli-ui/lib/cli/ui/formatter.rb +0 -219
  135. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +0 -67
  136. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb +0 -179
  137. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb +0 -152
  138. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +0 -127
  139. data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +0 -286
  140. data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +0 -92
  141. data/vendor/deps/cli-ui/lib/cli/ui/os.rb +0 -63
  142. data/vendor/deps/cli-ui/lib/cli/ui/printer.rb +0 -64
  143. data/vendor/deps/cli-ui/lib/cli/ui/progress.rb +0 -132
  144. data/vendor/deps/cli-ui/lib/cli/ui/progress_reporter.rb +0 -209
  145. data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +0 -583
  146. data/vendor/deps/cli-ui/lib/cli/ui/prompt/options_handler.rb +0 -36
  147. data/vendor/deps/cli-ui/lib/cli/ui/prompt.rb +0 -381
  148. data/vendor/deps/cli-ui/lib/cli/ui/spinner/async.rb +0 -48
  149. data/vendor/deps/cli-ui/lib/cli/ui/spinner/spin_group.rb +0 -602
  150. data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +0 -79
  151. data/vendor/deps/cli-ui/lib/cli/ui/stdout_router.rb +0 -399
  152. data/vendor/deps/cli-ui/lib/cli/ui/table.rb +0 -83
  153. data/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +0 -55
  154. data/vendor/deps/cli-ui/lib/cli/ui/truncater.rb +0 -106
  155. data/vendor/deps/cli-ui/lib/cli/ui/version.rb +0 -8
  156. data/vendor/deps/cli-ui/lib/cli/ui/widgets/base.rb +0 -46
  157. data/vendor/deps/cli-ui/lib/cli/ui/widgets/status.rb +0 -79
  158. data/vendor/deps/cli-ui/lib/cli/ui/widgets.rb +0 -89
  159. data/vendor/deps/cli-ui/lib/cli/ui/work_queue.rb +0 -142
  160. data/vendor/deps/cli-ui/lib/cli/ui/wrap.rb +0 -61
  161. data/vendor/deps/cli-ui/lib/cli/ui.rb +0 -359
  162. data/vendor/deps/cli-ui/vendor/reentrant_mutex.rb +0 -78
  163. data/vendor/deps/webrick/.gitignore +0 -9
  164. data/vendor/deps/webrick/Gemfile +0 -3
  165. data/vendor/deps/webrick/LICENSE.txt +0 -22
  166. data/vendor/deps/webrick/README.md +0 -61
  167. data/vendor/deps/webrick/Rakefile +0 -10
  168. data/vendor/deps/webrick/lib/webrick/accesslog.rb +0 -157
  169. data/vendor/deps/webrick/lib/webrick/cgi.rb +0 -313
  170. data/vendor/deps/webrick/lib/webrick/compat.rb +0 -36
  171. data/vendor/deps/webrick/lib/webrick/config.rb +0 -158
  172. data/vendor/deps/webrick/lib/webrick/cookie.rb +0 -172
  173. data/vendor/deps/webrick/lib/webrick/htmlutils.rb +0 -30
  174. data/vendor/deps/webrick/lib/webrick/httpauth/authenticator.rb +0 -117
  175. data/vendor/deps/webrick/lib/webrick/httpauth/basicauth.rb +0 -116
  176. data/vendor/deps/webrick/lib/webrick/httpauth/digestauth.rb +0 -395
  177. data/vendor/deps/webrick/lib/webrick/httpauth/htdigest.rb +0 -132
  178. data/vendor/deps/webrick/lib/webrick/httpauth/htgroup.rb +0 -97
  179. data/vendor/deps/webrick/lib/webrick/httpauth/htpasswd.rb +0 -158
  180. data/vendor/deps/webrick/lib/webrick/httpauth/userdb.rb +0 -53
  181. data/vendor/deps/webrick/lib/webrick/httpauth.rb +0 -96
  182. data/vendor/deps/webrick/lib/webrick/httpproxy.rb +0 -354
  183. data/vendor/deps/webrick/lib/webrick/httprequest.rb +0 -636
  184. data/vendor/deps/webrick/lib/webrick/httpresponse.rb +0 -564
  185. data/vendor/deps/webrick/lib/webrick/https.rb +0 -152
  186. data/vendor/deps/webrick/lib/webrick/httpserver.rb +0 -294
  187. data/vendor/deps/webrick/lib/webrick/httpservlet/abstract.rb +0 -152
  188. data/vendor/deps/webrick/lib/webrick/httpservlet/cgi_runner.rb +0 -47
  189. data/vendor/deps/webrick/lib/webrick/httpservlet/cgihandler.rb +0 -126
  190. data/vendor/deps/webrick/lib/webrick/httpservlet/erbhandler.rb +0 -88
  191. data/vendor/deps/webrick/lib/webrick/httpservlet/filehandler.rb +0 -552
  192. data/vendor/deps/webrick/lib/webrick/httpservlet/prochandler.rb +0 -47
  193. data/vendor/deps/webrick/lib/webrick/httpservlet.rb +0 -23
  194. data/vendor/deps/webrick/lib/webrick/httpstatus.rb +0 -194
  195. data/vendor/deps/webrick/lib/webrick/httputils.rb +0 -512
  196. data/vendor/deps/webrick/lib/webrick/httpversion.rb +0 -76
  197. data/vendor/deps/webrick/lib/webrick/log.rb +0 -156
  198. data/vendor/deps/webrick/lib/webrick/server.rb +0 -381
  199. data/vendor/deps/webrick/lib/webrick/ssl.rb +0 -215
  200. data/vendor/deps/webrick/lib/webrick/utils.rb +0 -265
  201. data/vendor/deps/webrick/lib/webrick/version.rb +0 -18
  202. data/vendor/deps/webrick/lib/webrick.rb +0 -232
  203. data/vendor/deps/webrick/webrick.gemspec +0 -74
@@ -1,186 +0,0 @@
1
- # frozen_string_literal: true
2
- require_relative "file"
3
- require_relative "root"
4
-
5
- require "pathname"
6
- require "time"
7
-
8
- module FluidCLI
9
- module Theme
10
- class InvalidThemeStatus < StandardError; end
11
-
12
- class Theme < Root
13
- attr_reader :root, :id
14
-
15
- def initialize(ctx, root: nil, id: nil, name: nil, status: "development")
16
- super(ctx, root: root)
17
- @id = id
18
- @name = name
19
- @status = status
20
- end
21
-
22
- def theme_files
23
- (glob(["*.css", "*.json", "**/*.liquid", "**/*.json", "**/*.css"]) - glob(["styleguide/*.liquid", "styleguide/*.css"]) + static_asset_files).uniq
24
- end
25
-
26
- def theme_file?(file)
27
- theme_files.include?(self[file])
28
- end
29
-
30
- def company
31
- api_client.get_company_or_abort
32
- end
33
-
34
- def editor_url
35
- "https://admin.fluid.app/themes/#{id}/editor"
36
- end
37
-
38
- def name
39
- @name
40
- end
41
-
42
- def status
43
- @status
44
- end
45
-
46
- def live?
47
- status == "active"
48
- end
49
-
50
- def development?
51
- status == "development"
52
- end
53
-
54
- def preview_url
55
- "https://#{company}.fluid.app?preview_theme_id=#{id}"
56
- end
57
-
58
- def create
59
-
60
-
61
- raise InvalidThemeStatus, "Can't create live theme. Use publish." if live?
62
-
63
- _status, body = api_client.post(
64
- path: "application_themes",
65
- body: JSON.generate({
66
- application_theme: {
67
- name: name,
68
- status: status,
69
- },
70
- }),
71
- )
72
- @id = body["application_theme"]["id"]
73
- @created_at_runtime = true
74
- end
75
-
76
- def delete
77
- delete_theme
78
- end
79
-
80
- def publish
81
- return if live?
82
- api_client.put(
83
- path: "themes/#{id}.json",
84
- body: JSON.generate(theme: {
85
- status: "active",
86
- })
87
- )
88
- @status = "live"
89
- end
90
-
91
- def current_development?
92
- development? && id == FluidCLI::DB.get(:development_theme_id)
93
- end
94
-
95
- def foreign_development?
96
- development? && id != FluidCLI::DB.get(:development_theme_id)
97
- end
98
-
99
- def created_at_runtime?
100
- @created_at_runtime ||= false
101
- end
102
-
103
- def to_h
104
- {
105
- id: id,
106
- name: name,
107
- status: status,
108
- editor_url: editor_url,
109
- preview_url: preview_url,
110
- }
111
- end
112
-
113
- class << self
114
- def create_unpublished(ctx, root: nil, name: nil)
115
- name ||= random_name
116
- theme = new(ctx, root: root, name: name, status: "draft")
117
- theme.create
118
- theme
119
- end
120
-
121
- def all(ctx, root: nil)
122
- _status, body = fetch_themes(ctx)
123
- body['application_themes']
124
- .sort_by { |theme_attrs| Time.parse(theme_attrs["updated_at"]) }
125
- .reverse
126
- .map { |theme_attrs| new(ctx, root: root, **allowed_attrs(theme_attrs)) }
127
- end
128
-
129
- def live(ctx, root: nil)
130
- find(ctx, root) { |attrs| attrs["status"] == "active" }
131
- end
132
-
133
- # Finds a Theme by its identifier
134
- #
135
- # #### Parameters
136
- # * `ctx` - current running context of your command
137
- # * `root` - theme root
138
- # * `identifier` - theme ID or theme name
139
- def find_by_identifier(ctx, root: nil, identifier:)
140
- find(ctx, root) do |attrs|
141
- attrs.slice("name", "id").values.map(&:to_s).include?(identifier)
142
- end
143
- end
144
-
145
- private
146
-
147
- def random_name
148
- FluidCLI::Helpers::Haikunator.haikunate(9999)
149
- end
150
-
151
- def find(ctx, root, &block)
152
- _status, body = fetch_themes(ctx)
153
-
154
- body["application_themes"]
155
- .find(&block)
156
- .tap do |attrs|
157
- break new(ctx, root: root, **allowed_attrs(attrs)) if attrs
158
- end
159
- end
160
-
161
- def allowed_attrs(attrs)
162
- attrs.slice("id", "name", "status").transform_keys(&:to_sym)
163
- end
164
-
165
- def fetch_themes(ctx)
166
- FluidCLI::API.new(ctx).get(
167
- path: "application_themes",
168
- query: URI.encode_www_form({ include_development: true, per_page: 50 })
169
- )
170
- end
171
- end
172
-
173
- private
174
-
175
- def api_client
176
- @api_client ||= FluidCLI::API.new(@ctx)
177
- end
178
-
179
- def delete_theme
180
- api_client.delete(
181
- path: "application_themes/#{id}"
182
- )
183
- end
184
- end
185
- end
186
- end
@@ -1,22 +0,0 @@
1
- module FluidCLI
2
- module Theme
3
- module UI
4
- class SyncProgressBar
5
- def initialize(syncer)
6
- @syncer = syncer
7
- end
8
-
9
- def progress(method, **args)
10
- @syncer.lock_io!
11
- CLI::UI::Progress.progress do |bar|
12
- @syncer.public_send(method, **args) do |left, total|
13
- bar.tick(set_percent: 1 - left.to_f / total)
14
- end
15
- bar.tick(set_percent: 1)
16
- end
17
- @syncer.unlock_io!
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module FluidCLI
4
- class ThreadPool
5
- class Job
6
- attr_reader :error, :interval
7
-
8
- def initialize(interval = 0)
9
- @interval = interval
10
- end
11
-
12
- def perform!
13
- raise "`#{self.class.name}#perform!' must be defined"
14
- end
15
-
16
- def call
17
- perform!
18
- rescue StandardError => error
19
- @error = error
20
- end
21
-
22
- def success?
23
- !@error
24
- end
25
-
26
- def error?
27
- !!@error
28
- end
29
-
30
- def recurring?
31
- !interval.zero?
32
- end
33
- end
34
- end
35
- end
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module FluidCLI
4
- class ThreadPool
5
- attr_reader :errors
6
-
7
- def initialize(pool_size: 10)
8
- @jobs = Queue.new
9
- @pool = Array.new(pool_size) { spawn_thread }
10
- end
11
-
12
- def schedule(job)
13
- @jobs << job
14
- end
15
-
16
- def shutdown
17
- @pool.size.times do
18
- schedule(-> { throw(:stop_thread) })
19
- end
20
- @pool.map(&:join)
21
- ensure
22
- @jobs.close
23
- end
24
-
25
- private
26
-
27
- def spawn_thread
28
- Thread.new do
29
- catch(:stop_thread) do
30
- loop { perform(@jobs.pop) }
31
- end
32
- end
33
- end
34
-
35
- def perform(job)
36
- job.call
37
- reschedule(job) if job.recurring?
38
- end
39
-
40
- def reschedule(job)
41
- wait(job.interval)
42
- schedule(job)
43
- end
44
-
45
- def wait(seconds)
46
- sleep(seconds)
47
- end
48
- end
49
- end
@@ -1,103 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- # formula generated from gem 'fluid_cli'
5
- class FluidCli < Formula
6
- # Module to get Ruby binary path from Homebrew Ruby formula
7
- module RubyBin
8
- def ruby_bin
9
- Formula["ruby"].opt_bin
10
- end
11
- end
12
-
13
- # Custom download strategy to fetch gem from RubyGems
14
- class RubyGemsDownloadStrategy < AbstractDownloadStrategy
15
- include RubyBin
16
-
17
- def fetch(_timeout: nil, **_options)
18
- ohai("Fetching fluid-cli from gem source")
19
- cache.cd do
20
- ENV["GEM_SPEC_CACHE"] = "#{cache}/gem_spec_cache"
21
-
22
- _, err, status = Open3.capture3("gem", "fetch", "fluid_cli", "--version", gem_version)
23
- odie err unless status.success?
24
- end
25
- end
26
-
27
- def cached_location
28
- Pathname.new("#{cache}/fluid_cli-#{gem_version}.gem")
29
- end
30
-
31
- def cache
32
- @cache ||= HOMEBREW_CACHE
33
- end
34
-
35
- def gem_version
36
- @version ||= @resource&.version if defined?(@resource)
37
- raise "Unable to determine version; did Homebrew change?" unless @version
38
-
39
- @version
40
- end
41
-
42
- def clear_cache
43
- cached_location.unlink if cached_location.exist?
44
- end
45
- end
46
-
47
- include RubyBin
48
-
49
- desc "Fluid CLI tool"
50
- homepage "https://fluid.app"
51
- url "fluid_cli", using: RubyGemsDownloadStrategy
52
- version "FLUID_CLI_VERSION"
53
- sha256 "FLUID_CLI_GEM_CHECKSUM"
54
- depends_on "ruby"
55
-
56
- def install
57
- # set GEM_HOME and GEM_PATH to make sure we package all the dependent gems
58
- # together without accidently picking up other gems on the gem path since
59
- # they might not be there if, say, we change to a different rvm gemset
60
- ENV["GEM_HOME"] = prefix.to_s
61
- ENV["GEM_PATH"] = prefix.to_s
62
-
63
- # Use /usr/local/bin at the front of the path instead of Homebrew shims,
64
- # which mess with Ruby's own compiler config when building native extensions
65
- ENV["PATH"] = ENV["PATH"].sub(HOMEBREW_SHIMS_PATH.to_s, "/usr/local/bin") if defined?(HOMEBREW_SHIMS_PATH)
66
-
67
- system(
68
- "gem",
69
- "install",
70
- cached_download,
71
- "--no-document",
72
- "--no-wrapper",
73
- "--no-user-install",
74
- "--install-dir", prefix,
75
- "--bindir", bin,
76
- "--",
77
- "--skip-cli-build"
78
- )
79
-
80
- raise "gem install 'fluid_cli' failed with status #{$CHILD_STATUS.exitstatus}" unless $CHILD_STATUS.success?
81
-
82
- rm_r(bin) if bin.exist?
83
- bin.mkpath
84
-
85
- brew_gem_prefix = "#{prefix}/gems/fluid_cli-#{version}"
86
-
87
- ruby_libs = Dir.glob("#{prefix}/gems/*/lib")
88
- exe = "fluid"
89
- file = Pathname.new("#{brew_gem_prefix}/exe/#{exe}")
90
- (bin + file.basename.to_s).open("w") do |f|
91
- f << <<~RUBY
92
- #!#{ruby_bin}/ruby -rjson --disable-gems
93
- ENV['ORIGINAL_ENV']=ENV.to_h.to_json
94
- ENV['GEM_HOME']="#{prefix}"
95
- ENV['GEM_PATH']="#{prefix}"
96
- ENV['RUBY_BINDIR']="#{ruby_bin}/"
97
- require 'rubygems'
98
- $:.unshift(#{ruby_libs.map(&:inspect).join(",")})
99
- load "#{file}"
100
- RUBY
101
- end
102
- end
103
- end
@@ -1,5 +0,0 @@
1
- BSDL
2
- COPYING
3
- LEGAL
4
- lib/base64.rb
5
- README.md
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- Gemfile.lock
@@ -1,22 +0,0 @@
1
- Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved.
2
-
3
- Redistribution and use in source and binary forms, with or without
4
- modification, are permitted provided that the following conditions
5
- are met:
6
- 1. Redistributions of source code must retain the above copyright
7
- notice, this list of conditions and the following disclaimer.
8
- 2. Redistributions in binary form must reproduce the above copyright
9
- notice, this list of conditions and the following disclaimer in the
10
- documentation and/or other materials provided with the distribution.
11
-
12
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
16
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22
- SUCH DAMAGE.
@@ -1,56 +0,0 @@
1
- Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
2
- You can redistribute it and/or modify it under either the terms of the
3
- 2-clause BSDL (see the file BSDL), or the conditions below:
4
-
5
- 1. You may make and give away verbatim copies of the source form of the
6
- software without restriction, provided that you duplicate all of the
7
- original copyright notices and associated disclaimers.
8
-
9
- 2. You may modify your copy of the software in any way, provided that
10
- you do at least ONE of the following:
11
-
12
- a. place your modifications in the Public Domain or otherwise
13
- make them Freely Available, such as by posting said
14
- modifications to Usenet or an equivalent medium, or by allowing
15
- the author to include your modifications in the software.
16
-
17
- b. use the modified software only within your corporation or
18
- organization.
19
-
20
- c. give non-standard binaries non-standard names, with
21
- instructions on where to get the original software distribution.
22
-
23
- d. make other distribution arrangements with the author.
24
-
25
- 3. You may distribute the software in object code or binary form,
26
- provided that you do at least ONE of the following:
27
-
28
- a. distribute the binaries and library files of the software,
29
- together with instructions (in the manual page or equivalent)
30
- on where to get the original distribution.
31
-
32
- b. accompany the distribution with the machine-readable source of
33
- the software.
34
-
35
- c. give non-standard binaries non-standard names, with
36
- instructions on where to get the original software distribution.
37
-
38
- d. make other distribution arrangements with the author.
39
-
40
- 4. You may modify and include the part of the software into any other
41
- software (possibly commercial). But some files in the distribution
42
- are not written by the author, so that they are not under these terms.
43
-
44
- For the list of those files and their copying conditions, see the
45
- file LEGAL.
46
-
47
- 5. The scripts and library files supplied as input to or produced as
48
- output from the software do not automatically fall under the
49
- copyright of the software, but belong to whomever generated them,
50
- and may be sold commercially, and may be aggregated with this
51
- software.
52
-
53
- 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
- PURPOSE.
@@ -1,9 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "rake"
4
- gem "test-unit"
5
-
6
- group :sig do
7
- gem "rbs"
8
- gem "rdoc", "<= 6.11"
9
- end
@@ -1,60 +0,0 @@
1
- # -*- rdoc -*-
2
-
3
- = LEGAL NOTICE INFORMATION
4
- --------------------------
5
-
6
- All the files in this distribution are covered under either the Ruby's
7
- license (see the file COPYING) or public-domain except some files
8
- mentioned below.
9
-
10
- == MIT License
11
- >>>
12
- Permission is hereby granted, free of charge, to any person obtaining
13
- a copy of this software and associated documentation files (the
14
- "Software"), to deal in the Software without restriction, including
15
- without limitation the rights to use, copy, modify, merge, publish,
16
- distribute, sublicense, and/or sell copies of the Software, and to
17
- permit persons to whom the Software is furnished to do so, subject to
18
- the following conditions:
19
-
20
- The above copyright notice and this permission notice shall be
21
- included in all copies or substantial portions of the Software.
22
-
23
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
-
31
- == Old-style BSD license
32
- >>>
33
- Redistribution and use in source and binary forms, with or without
34
- modification, are permitted provided that the following conditions
35
- are met:
36
- 1. Redistributions of source code must retain the above copyright
37
- notice, this list of conditions and the following disclaimer.
38
- 2. Redistributions in binary form must reproduce the above copyright
39
- notice, this list of conditions and the following disclaimer in the
40
- documentation and/or other materials provided with the distribution.
41
- 3. Neither the name of the University nor the names of its contributors
42
- may be used to endorse or promote products derived from this software
43
- without specific prior written permission.
44
-
45
- THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
46
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48
- ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
49
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55
- SUCH DAMAGE.
56
-
57
- IMPORTANT NOTE::
58
-
59
- From ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
60
- paragraph 3 above is now null and void.
@@ -1,48 +0,0 @@
1
- # Base64
2
-
3
- The Base64 module provides for the encoding (`#encode64`, `#strict_encode64`,
4
- `#urlsafe_encode64`) and decoding (`#decode64`, `#strict_decode64`,
5
- `#urlsafe_decode64`) of binary data using a Base64 representation.
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'base64'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle install
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install base64
22
-
23
- ## Usage
24
-
25
- A simple encoding and decoding.
26
-
27
- ```ruby
28
- require "base64"
29
-
30
- enc = Base64.encode64('Send reinforcements')
31
- # -> "U2VuZCByZWluZm9yY2VtZW50cw==\n"
32
- plain = Base64.decode64(enc)
33
- # -> "Send reinforcements"
34
- ```
35
-
36
- The purpose of using base64 to encode data is that it translates any
37
- binary data into purely printable characters.
38
-
39
- ## Development
40
-
41
- 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.
42
-
43
- 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).
44
-
45
- ## Contributing
46
-
47
- Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/base64.
48
-
@@ -1,31 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/test_*.rb"]
8
- end
9
-
10
- namespace :rbs do
11
- task :test do
12
- sh "ruby -I lib test_sig/test_base64.rb"
13
- end
14
-
15
- task :annotate do
16
- require "tmpdir"
17
- require "pathname"
18
-
19
- Dir.mktmpdir do |tmpdir|
20
- system("rdoc --ri --output #{tmpdir}/doc --root=. lib")
21
- system("rbs annotate --no-system --no-gems --no-site --no-home -d #{tmpdir}/doc sig")
22
- end
23
- end
24
-
25
- task :confirm do
26
- puts "Testing if RBS docs are updated with respect to RDoc"
27
- sh "git diff --exit-code sig/"
28
- end
29
- end
30
-
31
- task :default => :test
@@ -1,28 +0,0 @@
1
- name = File.basename(__FILE__, ".gemspec")
2
- version = ["lib", Array.new(name.count("-")+1).join("/")].find do |dir|
3
- break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
4
- /^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
5
- end rescue nil
6
- end
7
-
8
- Gem::Specification.new do |spec|
9
- spec.name = name
10
- spec.version = version
11
- spec.authors = ["Yusuke Endoh"]
12
- spec.email = ["mame@ruby-lang.org"]
13
-
14
- spec.summary = %q{Support for encoding and decoding binary data using a Base64 representation.}
15
- spec.description = %q{Support for encoding and decoding binary data using a Base64 representation.}
16
- spec.homepage = "https://github.com/ruby/base64"
17
- spec.required_ruby_version = Gem::Requirement.new(">= 2.4")
18
- spec.licenses = ["Ruby", "BSD-2-Clause"]
19
-
20
- spec.metadata["homepage_uri"] = spec.homepage
21
- spec.metadata["source_code_uri"] = spec.homepage
22
- spec.metadata["changelog_uri"] = spec.homepage + "/releases"
23
-
24
- spec.files = ["README.md", "BSDL", "COPYING", "LEGAL", "lib/base64.rb", "sig/base64.rbs"]
25
- spec.bindir = "exe"
26
- spec.executables = []
27
- spec.require_paths = ["lib"]
28
- end
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "base64"
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__)