bubbles 0.0.5 → 0.1.0
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.
- checksums.yaml +5 -5
- data/LICENSE.txt +21 -0
- data/README.md +524 -80
- data/bubbles.gemspec +29 -21
- data/lib/bubbles/cursor.rb +169 -0
- data/lib/bubbles/file_picker.rb +397 -0
- data/lib/bubbles/help.rb +170 -0
- data/lib/bubbles/key.rb +96 -0
- data/lib/bubbles/list.rb +365 -0
- data/lib/bubbles/paginator.rb +158 -0
- data/lib/bubbles/progress.rb +276 -0
- data/lib/bubbles/spinner/spinners.rb +77 -0
- data/lib/bubbles/spinner.rb +122 -0
- data/lib/bubbles/stopwatch.rb +189 -0
- data/lib/bubbles/table.rb +248 -0
- data/lib/bubbles/text_area.rb +503 -0
- data/lib/bubbles/text_input.rb +543 -0
- data/lib/bubbles/timer.rb +196 -0
- data/lib/bubbles/version.rb +4 -1
- data/lib/bubbles/viewport.rb +296 -0
- data/lib/bubbles.rb +18 -35
- data/sig/bubbles/cursor.rbs +87 -0
- data/sig/bubbles/file_picker.rbs +138 -0
- data/sig/bubbles/help.rbs +88 -0
- data/sig/bubbles/key.rbs +63 -0
- data/sig/bubbles/list.rbs +138 -0
- data/sig/bubbles/paginator.rbs +90 -0
- data/sig/bubbles/progress.rbs +123 -0
- data/sig/bubbles/spinner/spinners.rbs +32 -0
- data/sig/bubbles/spinner.rbs +74 -0
- data/sig/bubbles/stopwatch.rbs +97 -0
- data/sig/bubbles/table.rbs +119 -0
- data/sig/bubbles/text_area.rbs +161 -0
- data/sig/bubbles/text_input.rbs +183 -0
- data/sig/bubbles/timer.rbs +107 -0
- data/sig/bubbles/version.rbs +5 -0
- data/sig/bubbles/viewport.rbs +125 -0
- data/sig/bubbles.rbs +4 -0
- metadata +66 -67
- data/.gitignore +0 -14
- data/.rspec +0 -2
- data/.travis.yml +0 -10
- data/Gemfile +0 -4
- data/LICENSE +0 -20
- data/Rakefile +0 -6
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/exe/bubbles +0 -5
- data/lib/bubbles/bubblicious_file.rb +0 -42
- data/lib/bubbles/command_queue.rb +0 -43
- data/lib/bubbles/common_uploader_interface.rb +0 -13
- data/lib/bubbles/config.rb +0 -149
- data/lib/bubbles/dir_watcher.rb +0 -53
- data/lib/bubbles/uploaders/local_dir.rb +0 -39
- data/lib/bubbles/uploaders/s3.rb +0 -36
- data/lib/bubbles/uploaders/s3_ensure_connection.rb +0 -26
- data/tmp/dummy_local_dir_uploader_dir/.gitkeep +0 -0
- data/tmp/dummy_processing_dir/.gitkeep +0 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Generated from lib/bubbles/timer.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Bubbles
|
|
4
|
+
# Timer is a countdown timer component.
|
|
5
|
+
#
|
|
6
|
+
# Example:
|
|
7
|
+
# timer = Bubbles::Timer.new(60.0) # 60 second countdown
|
|
8
|
+
#
|
|
9
|
+
# # In your model's init:
|
|
10
|
+
# def init
|
|
11
|
+
# [self, @timer.init]
|
|
12
|
+
# end
|
|
13
|
+
#
|
|
14
|
+
# # In your model's update:
|
|
15
|
+
# def update(message)
|
|
16
|
+
# case message
|
|
17
|
+
# when Bubbles::Timer::TickMessage, Bubbles::Timer::StartStopMessage
|
|
18
|
+
# @timer, command = @timer.update(message)
|
|
19
|
+
# [self, command]
|
|
20
|
+
# when Bubbles::Timer::TimeoutMessage
|
|
21
|
+
# # Timer finished!
|
|
22
|
+
# [self, nil]
|
|
23
|
+
# end
|
|
24
|
+
# end
|
|
25
|
+
class Timer
|
|
26
|
+
class TickMessage < Bubbletea::Message
|
|
27
|
+
attr_reader id: Integer
|
|
28
|
+
|
|
29
|
+
attr_reader tag: Integer
|
|
30
|
+
|
|
31
|
+
attr_reader timeout: bool
|
|
32
|
+
|
|
33
|
+
# : (id: Integer, tag: Integer, ?timeout: bool) -> void
|
|
34
|
+
def initialize: (id: Integer, tag: Integer, ?timeout: bool) -> void
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
class TimeoutMessage < Bubbletea::Message
|
|
38
|
+
attr_reader id: Integer
|
|
39
|
+
|
|
40
|
+
# : (id: Integer) -> void
|
|
41
|
+
def initialize: (id: Integer) -> void
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class StartStopMessage < Bubbletea::Message
|
|
45
|
+
attr_reader id: Integer
|
|
46
|
+
|
|
47
|
+
attr_reader running: bool
|
|
48
|
+
|
|
49
|
+
# : (id: Integer, running: bool) -> void
|
|
50
|
+
def initialize: (id: Integer, running: bool) -> void
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
self.@id_mutex: Mutex
|
|
54
|
+
|
|
55
|
+
self.@next_id: Integer
|
|
56
|
+
|
|
57
|
+
# : () -> Integer
|
|
58
|
+
def self.next_id: () -> Integer
|
|
59
|
+
|
|
60
|
+
attr_reader timeout: Float
|
|
61
|
+
|
|
62
|
+
attr_reader interval: Float
|
|
63
|
+
|
|
64
|
+
attr_reader id: Integer
|
|
65
|
+
|
|
66
|
+
# : (Float, ?interval: Float) -> void
|
|
67
|
+
def initialize: (Float, ?interval: Float) -> void
|
|
68
|
+
|
|
69
|
+
# : () -> Bubbletea::Command?
|
|
70
|
+
def init: () -> Bubbletea::Command?
|
|
71
|
+
|
|
72
|
+
# : () -> bool
|
|
73
|
+
def running?: () -> bool
|
|
74
|
+
|
|
75
|
+
# : () -> bool
|
|
76
|
+
def timed_out?: () -> bool
|
|
77
|
+
|
|
78
|
+
# : (Bubbletea::Message) -> [Timer, Bubbletea::Command?]
|
|
79
|
+
def update: (Bubbletea::Message) -> [ Timer, Bubbletea::Command? ]
|
|
80
|
+
|
|
81
|
+
# : () -> String
|
|
82
|
+
def view: () -> String
|
|
83
|
+
|
|
84
|
+
# : () -> Bubbletea::Command
|
|
85
|
+
def start: () -> Bubbletea::Command
|
|
86
|
+
|
|
87
|
+
# : () -> Bubbletea::Command
|
|
88
|
+
def stop: () -> Bubbletea::Command
|
|
89
|
+
|
|
90
|
+
# : () -> Bubbletea::Command
|
|
91
|
+
def toggle: () -> Bubbletea::Command
|
|
92
|
+
|
|
93
|
+
private
|
|
94
|
+
|
|
95
|
+
# : (bool) -> Bubbletea::Command
|
|
96
|
+
def start_stop: (bool) -> Bubbletea::Command
|
|
97
|
+
|
|
98
|
+
# : () -> Bubbletea::Command?
|
|
99
|
+
def tick: () -> Bubbletea::Command?
|
|
100
|
+
|
|
101
|
+
# : () -> Bubbletea::Command?
|
|
102
|
+
def timeout_command: () -> Bubbletea::Command?
|
|
103
|
+
|
|
104
|
+
# : (Float) -> String
|
|
105
|
+
def format_duration: (Float) -> String
|
|
106
|
+
end
|
|
107
|
+
end
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Generated from lib/bubbles/viewport.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Bubbles
|
|
4
|
+
# Viewport is a scrollable content pane.
|
|
5
|
+
#
|
|
6
|
+
# Example:
|
|
7
|
+
# viewport = Bubbles::Viewport.new(width: 80, height: 24)
|
|
8
|
+
# viewport.content = "Long text content..."
|
|
9
|
+
#
|
|
10
|
+
# # In update:
|
|
11
|
+
# viewport, command = viewport.update(message)
|
|
12
|
+
#
|
|
13
|
+
# # In view:
|
|
14
|
+
# viewport.view
|
|
15
|
+
class Viewport
|
|
16
|
+
attr_accessor width: Integer
|
|
17
|
+
|
|
18
|
+
attr_accessor height: Integer
|
|
19
|
+
|
|
20
|
+
attr_accessor style: Lipgloss::Style?
|
|
21
|
+
|
|
22
|
+
attr_accessor mouse_wheel_enabled: bool
|
|
23
|
+
|
|
24
|
+
attr_accessor mouse_wheel_delta: Integer
|
|
25
|
+
|
|
26
|
+
attr_reader y_offset: Integer
|
|
27
|
+
|
|
28
|
+
attr_reader x_offset: Integer
|
|
29
|
+
|
|
30
|
+
# : (?width: Integer, ?height: Integer) -> void
|
|
31
|
+
def initialize: (?width: Integer, ?height: Integer) -> void
|
|
32
|
+
|
|
33
|
+
# : () -> nil
|
|
34
|
+
def init: () -> nil
|
|
35
|
+
|
|
36
|
+
# : () -> bool
|
|
37
|
+
def at_top?: () -> bool
|
|
38
|
+
|
|
39
|
+
# : () -> bool
|
|
40
|
+
def at_bottom?: () -> bool
|
|
41
|
+
|
|
42
|
+
# : () -> bool
|
|
43
|
+
def past_bottom?: () -> bool
|
|
44
|
+
|
|
45
|
+
# : () -> Float -- scroll percentage (0.0 to 1.0)
|
|
46
|
+
def scroll_percent: () -> Float
|
|
47
|
+
|
|
48
|
+
# : (String) -> void
|
|
49
|
+
def content=: (String) -> void
|
|
50
|
+
|
|
51
|
+
# : () -> String
|
|
52
|
+
def content: () -> String
|
|
53
|
+
|
|
54
|
+
# : (Integer) -> Integer
|
|
55
|
+
def y_offset=: (Integer) -> Integer
|
|
56
|
+
|
|
57
|
+
# : (Integer) -> Integer
|
|
58
|
+
def x_offset=: (Integer) -> Integer
|
|
59
|
+
|
|
60
|
+
# : (Integer) -> Integer
|
|
61
|
+
def horizontal_step=: (Integer) -> Integer
|
|
62
|
+
|
|
63
|
+
# : (Integer) -> Array[String]
|
|
64
|
+
def scroll_down: (Integer) -> Array[String]
|
|
65
|
+
|
|
66
|
+
# : (Integer) -> Array[String]
|
|
67
|
+
def scroll_up: (Integer) -> Array[String]
|
|
68
|
+
|
|
69
|
+
# : (Integer) -> void
|
|
70
|
+
def scroll_left: (Integer) -> void
|
|
71
|
+
|
|
72
|
+
# : (Integer) -> void
|
|
73
|
+
def scroll_right: (Integer) -> void
|
|
74
|
+
|
|
75
|
+
# : () -> Array[String]
|
|
76
|
+
def page_down: () -> Array[String]
|
|
77
|
+
|
|
78
|
+
# : () -> Array[String]
|
|
79
|
+
def page_up: () -> Array[String]
|
|
80
|
+
|
|
81
|
+
# : () -> Array[String]
|
|
82
|
+
def half_page_down: () -> Array[String]
|
|
83
|
+
|
|
84
|
+
# : () -> Array[String]
|
|
85
|
+
def half_page_up: () -> Array[String]
|
|
86
|
+
|
|
87
|
+
# : () -> Array[String]
|
|
88
|
+
def goto_top: () -> Array[String]
|
|
89
|
+
|
|
90
|
+
# : () -> Array[String]
|
|
91
|
+
def goto_bottom: () -> Array[String]
|
|
92
|
+
|
|
93
|
+
# : () -> Integer
|
|
94
|
+
def total_line_count: () -> Integer
|
|
95
|
+
|
|
96
|
+
# : () -> Integer
|
|
97
|
+
def visible_line_count: () -> Integer
|
|
98
|
+
|
|
99
|
+
# : (Bubbletea::Message) -> [Viewport, Bubbletea::Command?]
|
|
100
|
+
def update: (Bubbletea::Message) -> [ Viewport, Bubbletea::Command? ]
|
|
101
|
+
|
|
102
|
+
# : () -> String
|
|
103
|
+
def view: () -> String
|
|
104
|
+
|
|
105
|
+
private
|
|
106
|
+
|
|
107
|
+
# : (Bubbletea::KeyMessage) -> void
|
|
108
|
+
def handle_key: (Bubbletea::KeyMessage) -> void
|
|
109
|
+
|
|
110
|
+
# : (Bubbletea::MouseMessage) -> void
|
|
111
|
+
def handle_mouse: (Bubbletea::MouseMessage) -> void
|
|
112
|
+
|
|
113
|
+
# : () -> Integer
|
|
114
|
+
def max_y_offset: () -> Integer
|
|
115
|
+
|
|
116
|
+
# : () -> Array[String]
|
|
117
|
+
def visible_lines: () -> Array[String]
|
|
118
|
+
|
|
119
|
+
# : (String, Integer, Integer) -> String
|
|
120
|
+
def cut_string: (String, Integer, Integer) -> String
|
|
121
|
+
|
|
122
|
+
# : (String) -> String
|
|
123
|
+
def strip_ansi: (String) -> String
|
|
124
|
+
end
|
|
125
|
+
end
|
data/sig/bubbles.rbs
ADDED
metadata
CHANGED
|
@@ -1,108 +1,109 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bubbles
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
8
|
-
autorequire:
|
|
7
|
+
- Marco Roth
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
13
|
+
name: bubbletea
|
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
|
16
15
|
requirements:
|
|
17
|
-
- - "
|
|
16
|
+
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
18
|
+
version: '0'
|
|
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: '
|
|
25
|
+
version: '0'
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
27
|
+
name: harmonica
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
30
29
|
requirements:
|
|
31
|
-
- - "
|
|
30
|
+
- - ">="
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
34
|
-
type: :
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - "~>"
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '1.14'
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: rake
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - "~>"
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '10.0'
|
|
48
|
-
type: :development
|
|
32
|
+
version: '0'
|
|
33
|
+
type: :runtime
|
|
49
34
|
prerelease: false
|
|
50
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
36
|
requirements:
|
|
52
|
-
- - "
|
|
37
|
+
- - ">="
|
|
53
38
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
39
|
+
version: '0'
|
|
55
40
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
41
|
+
name: lipgloss
|
|
57
42
|
requirement: !ruby/object:Gem::Requirement
|
|
58
43
|
requirements:
|
|
59
|
-
- - "
|
|
44
|
+
- - ">="
|
|
60
45
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
62
|
-
type: :
|
|
46
|
+
version: '0'
|
|
47
|
+
type: :runtime
|
|
63
48
|
prerelease: false
|
|
64
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
50
|
requirements:
|
|
66
|
-
- - "
|
|
51
|
+
- - ">="
|
|
67
52
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
69
|
-
description:
|
|
70
|
-
|
|
53
|
+
version: '0'
|
|
54
|
+
description: Ruby port of Charm's Bubbles. Common UI components for building terminal
|
|
55
|
+
applications with Bubble Tea.
|
|
71
56
|
email:
|
|
72
|
-
-
|
|
73
|
-
executables:
|
|
74
|
-
- bubbles
|
|
57
|
+
- marco.roth@intergga.ch
|
|
58
|
+
executables: []
|
|
75
59
|
extensions: []
|
|
76
60
|
extra_rdoc_files: []
|
|
77
61
|
files:
|
|
78
|
-
-
|
|
79
|
-
- ".rspec"
|
|
80
|
-
- ".travis.yml"
|
|
81
|
-
- Gemfile
|
|
82
|
-
- LICENSE
|
|
62
|
+
- LICENSE.txt
|
|
83
63
|
- README.md
|
|
84
|
-
- Rakefile
|
|
85
|
-
- bin/console
|
|
86
|
-
- bin/setup
|
|
87
64
|
- bubbles.gemspec
|
|
88
|
-
- exe/bubbles
|
|
89
65
|
- lib/bubbles.rb
|
|
90
|
-
- lib/bubbles/
|
|
91
|
-
- lib/bubbles/
|
|
92
|
-
- lib/bubbles/
|
|
93
|
-
- lib/bubbles/
|
|
94
|
-
- lib/bubbles/
|
|
95
|
-
- lib/bubbles/
|
|
96
|
-
- lib/bubbles/
|
|
97
|
-
- lib/bubbles/
|
|
66
|
+
- lib/bubbles/cursor.rb
|
|
67
|
+
- lib/bubbles/file_picker.rb
|
|
68
|
+
- lib/bubbles/help.rb
|
|
69
|
+
- lib/bubbles/key.rb
|
|
70
|
+
- lib/bubbles/list.rb
|
|
71
|
+
- lib/bubbles/paginator.rb
|
|
72
|
+
- lib/bubbles/progress.rb
|
|
73
|
+
- lib/bubbles/spinner.rb
|
|
74
|
+
- lib/bubbles/spinner/spinners.rb
|
|
75
|
+
- lib/bubbles/stopwatch.rb
|
|
76
|
+
- lib/bubbles/table.rb
|
|
77
|
+
- lib/bubbles/text_area.rb
|
|
78
|
+
- lib/bubbles/text_input.rb
|
|
79
|
+
- lib/bubbles/timer.rb
|
|
98
80
|
- lib/bubbles/version.rb
|
|
99
|
-
-
|
|
100
|
-
-
|
|
101
|
-
|
|
81
|
+
- lib/bubbles/viewport.rb
|
|
82
|
+
- sig/bubbles.rbs
|
|
83
|
+
- sig/bubbles/cursor.rbs
|
|
84
|
+
- sig/bubbles/file_picker.rbs
|
|
85
|
+
- sig/bubbles/help.rbs
|
|
86
|
+
- sig/bubbles/key.rbs
|
|
87
|
+
- sig/bubbles/list.rbs
|
|
88
|
+
- sig/bubbles/paginator.rbs
|
|
89
|
+
- sig/bubbles/progress.rbs
|
|
90
|
+
- sig/bubbles/spinner.rbs
|
|
91
|
+
- sig/bubbles/spinner/spinners.rbs
|
|
92
|
+
- sig/bubbles/stopwatch.rbs
|
|
93
|
+
- sig/bubbles/table.rbs
|
|
94
|
+
- sig/bubbles/text_area.rbs
|
|
95
|
+
- sig/bubbles/text_input.rbs
|
|
96
|
+
- sig/bubbles/timer.rbs
|
|
97
|
+
- sig/bubbles/version.rbs
|
|
98
|
+
- sig/bubbles/viewport.rbs
|
|
99
|
+
homepage: https://github.com/marcoroth/bubbles-ruby
|
|
102
100
|
licenses:
|
|
103
101
|
- MIT
|
|
104
|
-
metadata:
|
|
105
|
-
|
|
102
|
+
metadata:
|
|
103
|
+
homepage_uri: https://github.com/marcoroth/bubbles-ruby
|
|
104
|
+
source_code_uri: https://github.com/marcoroth/bubbles-ruby
|
|
105
|
+
changelog_uri: https://github.com/marcoroth/bubbles-ruby/releases
|
|
106
|
+
rubygems_mfa_required: 'true'
|
|
106
107
|
rdoc_options: []
|
|
107
108
|
require_paths:
|
|
108
109
|
- lib
|
|
@@ -110,16 +111,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
110
111
|
requirements:
|
|
111
112
|
- - ">="
|
|
112
113
|
- !ruby/object:Gem::Version
|
|
113
|
-
version:
|
|
114
|
+
version: 3.2.0
|
|
114
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
116
|
requirements:
|
|
116
117
|
- - ">="
|
|
117
118
|
- !ruby/object:Gem::Version
|
|
118
119
|
version: '0'
|
|
119
120
|
requirements: []
|
|
120
|
-
|
|
121
|
-
rubygems_version: 2.5.1
|
|
122
|
-
signing_key:
|
|
121
|
+
rubygems_version: 4.0.3
|
|
123
122
|
specification_version: 4
|
|
124
|
-
summary:
|
|
123
|
+
summary: TUI components for Bubble Tea.
|
|
125
124
|
test_files: []
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/LICENSE
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2017 Equivalent (Tomas Valent)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
-
the Software without restriction, including without limitation the rights to
|
|
8
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
-
subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
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, FITNESS
|
|
17
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
DELETED
data/bin/console
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require "bundler/setup"
|
|
4
|
-
require "bubbles"
|
|
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
DELETED
data/exe/bubbles
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
module Bubbles
|
|
2
|
-
class BubbliciousFile
|
|
3
|
-
extend Forwardable
|
|
4
|
-
|
|
5
|
-
def initialize(file:, config:)
|
|
6
|
-
@file = file
|
|
7
|
-
@config = config
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def copy_to_processing_dir
|
|
11
|
-
config.logger.debug("BubbliciousFile: copy file #{file} to #{uid_file}")
|
|
12
|
-
FileUtils.cp(file, uid_file)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def remove_file
|
|
16
|
-
config.logger.debug("BubbliciousFile: removing file #{uid_file}")
|
|
17
|
-
FileUtils.rm(uid_file)
|
|
18
|
-
config.logger.debug("BubbliciousFile: removing file #{file}")
|
|
19
|
-
FileUtils.rm(file)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def metadata
|
|
23
|
-
{ original_name: file.basename.to_s }
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def uid_file
|
|
27
|
-
Pathname.new(processing_dir).join(uid_file_name)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def uid_file_name
|
|
31
|
-
@uid_file_name ||= "#{uniq_filename_randomizer.call}#{file.extname}"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
private
|
|
35
|
-
attr_reader :config
|
|
36
|
-
def_delegators :config, :uniq_filename_randomizer, :processing_dir
|
|
37
|
-
|
|
38
|
-
def file
|
|
39
|
-
Pathname.new(@file)
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
module Bubbles
|
|
2
|
-
class CommandQueue
|
|
3
|
-
extend Forwardable
|
|
4
|
-
|
|
5
|
-
def_delegators :queue, :size
|
|
6
|
-
|
|
7
|
-
def initialize(config:)
|
|
8
|
-
@config = config
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def queue
|
|
12
|
-
@queue ||= []
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def <<(command_object)
|
|
16
|
-
queue << command_object
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def call_next
|
|
20
|
-
if command = queue.shift
|
|
21
|
-
log command
|
|
22
|
-
command.call
|
|
23
|
-
else
|
|
24
|
-
log "Nothing in the command queue"
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def reschedule(command_object)
|
|
29
|
-
queue.unshift(command_object)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def inspect
|
|
33
|
-
"<##{self.class.name} queue:#{queue.inspect} >"
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
private
|
|
37
|
-
attr_reader :config
|
|
38
|
-
|
|
39
|
-
def log(command)
|
|
40
|
-
config.logger.debug("Processing: #{command.inspect}")
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
module Bubbles
|
|
2
|
-
module CommonUploaderInterface
|
|
3
|
-
def self.included(base)
|
|
4
|
-
base.send(:attr_reader, :config, :command_queue, :bfile)
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
def initialize(bfile:, command_queue:, config:)
|
|
8
|
-
@bfile = bfile
|
|
9
|
-
@config = config
|
|
10
|
-
@command_queue = command_queue
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|