cryptum 0.0.354 → 0.0.356

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. metadata +13 -116
  3. data/.github/workflows/main.yml +0 -16
  4. data/.gitignore +0 -30
  5. data/.rspec +0 -3
  6. data/.rspec_status +0 -0
  7. data/.rubocop.yml +0 -31
  8. data/.rubocop_todo.yml +0 -32
  9. data/.ruby-gemset +0 -1
  10. data/.ruby-version +0 -1
  11. data/CODE_OF_CONDUCT.md +0 -84
  12. data/Gemfile +0 -38
  13. data/LICENSE +0 -674
  14. data/README.md +0 -75
  15. data/Rakefile +0 -19
  16. data/bin/cryptum +0 -73
  17. data/bin/cryptum-forecast +0 -200
  18. data/bin/cryptum-repl +0 -73
  19. data/bin/cryptum_autoinc_version +0 -38
  20. data/build_cryptum_gem.sh +0 -58
  21. data/cryptum.gemspec +0 -52
  22. data/cryptum_container.sh +0 -1
  23. data/docker/cryptum.json +0 -60
  24. data/docker/cryptum_container.sh +0 -59
  25. data/docker/packer_secrets.json.EXAMPLE +0 -7
  26. data/docker/provisioners/cryptum.sh +0 -11
  27. data/docker/provisioners/docker_bashrc.sh +0 -2
  28. data/docker/provisioners/docker_rvm.sh +0 -22
  29. data/docker/provisioners/init_image.sh +0 -28
  30. data/docker/provisioners/post_install.sh +0 -6
  31. data/docker/provisioners/ruby.sh +0 -16
  32. data/docker/provisioners/upload_globals.sh +0 -49
  33. data/etc/bot_confs/.gitkeep +0 -0
  34. data/etc/bot_confs/BOT_CONF.TEMPLATE +0 -10
  35. data/etc/coinbase_pro.yaml.EXAMPLE +0 -8
  36. data/etc/open_ai.yaml.EXAMPLE +0 -1
  37. data/git_commit.sh +0 -22
  38. data/lib/cryptum/api.rb +0 -688
  39. data/lib/cryptum/bot_conf.rb +0 -197
  40. data/lib/cryptum/event/bot_conf.rb +0 -34
  41. data/lib/cryptum/event/buy.rb +0 -145
  42. data/lib/cryptum/event/cancel.rb +0 -35
  43. data/lib/cryptum/event/exit.rb +0 -35
  44. data/lib/cryptum/event/gtfo.rb +0 -36
  45. data/lib/cryptum/event/history.rb +0 -105
  46. data/lib/cryptum/event/key_press.rb +0 -64
  47. data/lib/cryptum/event/order_book.rb +0 -34
  48. data/lib/cryptum/event/pane.rb +0 -65
  49. data/lib/cryptum/event/parse.rb +0 -181
  50. data/lib/cryptum/event/scroll.rb +0 -200
  51. data/lib/cryptum/event/sell.rb +0 -124
  52. data/lib/cryptum/event.rb +0 -27
  53. data/lib/cryptum/log.rb +0 -34
  54. data/lib/cryptum/matrix.rb +0 -181
  55. data/lib/cryptum/open_ai.rb +0 -156
  56. data/lib/cryptum/option/choice.rb +0 -28
  57. data/lib/cryptum/option.rb +0 -206
  58. data/lib/cryptum/order_book/generate.rb +0 -114
  59. data/lib/cryptum/order_book/indicator.rb +0 -15
  60. data/lib/cryptum/order_book/market_trend.rb +0 -137
  61. data/lib/cryptum/order_book/profit_margin.rb +0 -55
  62. data/lib/cryptum/order_book.rb +0 -19
  63. data/lib/cryptum/portfolio/balance.rb +0 -123
  64. data/lib/cryptum/portfolio.rb +0 -15
  65. data/lib/cryptum/ui/command.rb +0 -314
  66. data/lib/cryptum/ui/key_press_event.rb +0 -33
  67. data/lib/cryptum/ui/market_trend.rb +0 -74
  68. data/lib/cryptum/ui/order_execute_details.rb +0 -297
  69. data/lib/cryptum/ui/order_execution.rb +0 -573
  70. data/lib/cryptum/ui/order_plan.rb +0 -503
  71. data/lib/cryptum/ui/order_plan_details.rb +0 -240
  72. data/lib/cryptum/ui/order_timer.rb +0 -121
  73. data/lib/cryptum/ui/portfolio.rb +0 -221
  74. data/lib/cryptum/ui/signal_engine.rb +0 -109
  75. data/lib/cryptum/ui/terminal_window.rb +0 -111
  76. data/lib/cryptum/ui/ticker.rb +0 -319
  77. data/lib/cryptum/ui.rb +0 -343
  78. data/lib/cryptum/version.rb +0 -5
  79. data/lib/cryptum/web_sock/coinbase.rb +0 -102
  80. data/lib/cryptum/web_sock/event_machine.rb +0 -274
  81. data/lib/cryptum/web_sock.rb +0 -16
  82. data/lib/cryptum.rb +0 -120
  83. data/order_books/.gitkeep +0 -0
  84. data/reinstall_cryptum_gemset.sh +0 -29
  85. data/spec/lib/cryptum/api_spec.rb +0 -10
  86. data/spec/lib/cryptum/event_spec.rb +0 -10
  87. data/spec/lib/cryptum/log_spec.rb +0 -10
  88. data/spec/lib/cryptum/option_spec.rb +0 -10
  89. data/spec/lib/cryptum/order_book/generate_spec.rb +0 -10
  90. data/spec/lib/cryptum/order_book/market_trend_spec.rb +0 -10
  91. data/spec/lib/cryptum/order_book_spec.rb +0 -10
  92. data/spec/lib/cryptum/ui/command_spec.rb +0 -10
  93. data/spec/lib/cryptum/ui/ticker_spec.rb +0 -10
  94. data/spec/lib/cryptum/ui_spec.rb +0 -10
  95. data/spec/lib/cryptum/web_sock_spec.rb +0 -10
  96. data/spec/lib/cryptum_spec.rb +0 -10
  97. data/spec/spec_helper.rb +0 -3
  98. data/upgrade_Gemfile_gems.sh +0 -20
  99. data/upgrade_cryptum.sh +0 -13
  100. data/upgrade_gem.sh +0 -4
  101. data/upgrade_ruby.sh +0 -45
@@ -1,274 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eventmachine'
4
- require 'json'
5
-
6
- module Cryptum
7
- # This plugin is used to Establish a Web
8
- # Socket Connection with Coinbase
9
- module WebSock
10
- module EventMachine
11
- # Supported Method Parameters::
12
- # Cryptum::WS.run(
13
- # )
14
- public_class_method def self.run(opts = {})
15
- env = opts[:env]
16
- option_choice = opts[:option_choice]
17
- terminal_win = opts[:terminal_win]
18
- event_history = opts[:event_history]
19
- indicator_status = opts[:indicator_status]
20
- bot_conf = opts[:bot_conf]
21
-
22
- max_conn_attempts = 30
23
- conn_attempt = 0
24
-
25
- begin
26
- conn_attempt += 1
27
- event_history.reconnected = true if conn_attempt > 1
28
-
29
- EM.run do
30
- # Iterate as fast as possible
31
- # This ensures candle timing is accurate
32
- # and everything is fast as possible
33
- # Defaults to 100ms, 5ms is the lowest possible
34
- delay_ms = 5
35
- delay_ms_cast_as_decimal = delay_ms * 0.001
36
- EM.set_quantum(delay_ms)
37
-
38
- ws = Cryptum::WebSock::Coinbase.connect(
39
- option_choice: option_choice,
40
- env: env
41
- )
42
-
43
- ws.on :open do |_event|
44
- ws.send(
45
- Cryptum::WebSock::Coinbase.subscribe_message(
46
- option_choice: option_choice,
47
- env: env
48
- )
49
- )
50
- end
51
-
52
- ws.on :message do |event|
53
- # TODO: The Speed of the UI is dictated by the
54
- # Frequency of WebSocket Messages Coming Through.
55
- # Explore another way to decouple required events
56
- # (such as keypresses) from only being triggered
57
- # when messages come through.
58
-
59
- event_history.event = JSON.parse(
60
- event.data,
61
- symbolize_names: true
62
- )
63
- event_history.event_type = event_history.event[:type].to_s.to_sym
64
-
65
- event_history = Cryptum::Event::Parse.websocket_msg(
66
- env: env,
67
- terminal_win: terminal_win,
68
- option_choice: option_choice,
69
- event_history: event_history,
70
- indicator_status: indicator_status,
71
- bot_conf: bot_conf
72
- )
73
-
74
- # Detect Key Press Events
75
- Cryptum::Event::KeyPress.detect(terminal_win: terminal_win)
76
-
77
- # Cancel ALL Open Orders when
78
- # C is pressed
79
- if terminal_win.key_press_event.key_c
80
- Cryptum::Event::Cancel.open_orders(
81
- terminal_win: terminal_win,
82
- option_choice: option_choice,
83
- env: env
84
- )
85
- end
86
-
87
- # Get the F* Out (GTFO) when
88
- # G is pressed
89
- if terminal_win.key_press_event.key_g
90
- event_history = Cryptum::Event::GTFO.now(
91
- terminal_win: terminal_win,
92
- option_choice: option_choice,
93
- env: env,
94
- event_history: event_history,
95
- bot_conf: bot_conf
96
- )
97
- end
98
-
99
- # Reload Bot Conf when r is Pressed
100
- if terminal_win.key_press_event.key_r
101
- bot_conf = Cryptum::Event::BotConf.reload(
102
- terminal_win: terminal_win,
103
- event_history: event_history,
104
- option_choice: option_choice
105
- )
106
- end
107
-
108
- # Only Write Order Book to File when
109
- # W is Pressed
110
- if terminal_win.key_press_event.key_w
111
- Cryptum::Event::OrderBook.write(
112
- terminal_win: terminal_win,
113
- event_history: event_history
114
- )
115
- end
116
-
117
- # Exit if x is Pressed
118
- if terminal_win.key_press_event.key_x
119
- Cryptum::Event::Exit.gracefully(
120
- terminal_win: terminal_win,
121
- event_history: event_history,
122
- option_choice: option_choice,
123
- env: env
124
- )
125
- end
126
-
127
- # TAB through Order Plan / Order Execution Window Panes
128
- if terminal_win.key_press_event.key_tab
129
- Cryptum::Event::Pane.switch(
130
- terminal_win: terminal_win,
131
- event_history: event_history
132
- )
133
- end
134
-
135
- # Scroll Up Order Plan / Order Execution Window Panes
136
- if terminal_win.key_press_event.key_up_arrow
137
- Cryptum::Event::Scroll.up(
138
- terminal_win: terminal_win,
139
- event_history: event_history
140
- )
141
- end
142
-
143
- # Scroll Down Order Plan / Order Execution Window Panes
144
- if terminal_win.key_press_event.key_down_arrow
145
- Cryptum::Event::Scroll.down(
146
- terminal_win: terminal_win,
147
- event_history: event_history
148
- )
149
- end
150
-
151
- # Scroll Up Order Plan / Order Execution Window Panes Faster
152
- if terminal_win.key_press_event.key_page_up
153
- Cryptum::Event::Scroll.page_up(
154
- terminal_win: terminal_win,
155
- event_history: event_history
156
- )
157
- end
158
-
159
- # Scroll Down Order Plan / Order Execution Window Panes Faster
160
- if terminal_win.key_press_event.key_page_down
161
- Cryptum::Event::Scroll.page_down(
162
- terminal_win: terminal_win,
163
- event_history: event_history
164
- )
165
- end
166
-
167
- # Scroll to Top of Order Plan / Order Execution Window Panes
168
- if terminal_win.key_press_event.key_home
169
- Cryptum::Event::Scroll.top(
170
- terminal_win: terminal_win,
171
- event_history: event_history
172
- )
173
- end
174
-
175
- # Scroll to Bottom of Order Plan / Order Execution Window Panes
176
- if terminal_win.key_press_event.key_end
177
- Cryptum::Event::Scroll.bottom(
178
- terminal_win: terminal_win,
179
- event_history: event_history
180
- )
181
- end
182
-
183
- # Open / Close Order Plan / Order Execution Details Window
184
- if terminal_win.key_press_event.key_enter
185
- Cryptum::Event::Pane.toggle_details(
186
- terminal_win: terminal_win,
187
- event_history: event_history
188
- )
189
- end
190
- end
191
-
192
- ws.on :close do
193
- raise Errno::ECONNRESET
194
- end
195
-
196
- EM.add_periodic_timer(delay_ms_cast_as_decimal) do
197
- order_countdown = Cryptum::UI::OrderTimer.refresh(
198
- option_choice: option_choice,
199
- event_history: event_history,
200
- order_timer_win: terminal_win.order_timer_section,
201
- indicator_status: indicator_status,
202
- key_press_event: terminal_win.key_press_event
203
- )
204
-
205
- if (order_countdown.zero? || order_countdown.negative?) &&
206
- !event_history.red_pill
207
-
208
- # Ready to Submit a BUY order
209
- event_history.order_ready = true
210
-
211
- # Reload Bot Conf (i.e. Risk Allocation),
212
- # Recalculate Order Plan, and Write to File
213
- terminal_win.key_press_event.key_r = true
214
- end
215
- end
216
-
217
- EM.add_periodic_timer(option_choice.market_trend_reset) do
218
- # NOTE: To ensure the integrity of event_history is maintained,
219
- # changes to its contenta _MUST_ stay in thos block.
220
- event_history.order_book[:market_trend][:buy] = 0
221
- event_history.order_book[:market_trend][:sell] = 0
222
- event_history.order_book[:last_trend_reset] = Time.now.strftime(
223
- '%Y-%m-%d %H:%M:%S.%N%z'
224
- )
225
-
226
- # Reload Bot Conf (i.e. Risk Allocation)
227
- # Recalculate Order Plan, and Write to File
228
- terminal_win.key_press_event.key_r = true
229
- # IMPORTANT:
230
- # Wait for Order Plan recalculation to occur
231
- # once Cryptum::UI::OrderPlan is refreshed
232
- # in Cryptum::Event _BEFORE_ writing the order
233
- # book to file.
234
- end
235
- end
236
- rescue Faye::WebSocket::API::ErrorEvent,
237
- Errno::ECONNREFUSED,
238
- Errno::ECONNRESET,
239
- LoadError => e
240
-
241
- File.open('/tmp/cryptum-errors.txt', 'a') do |f|
242
- f.puts Time.now.strftime('%Y-%m-%d %H:%M:%S.%N %z')
243
- f.puts "Module: #{self}"
244
- f.puts "#{e}\n\n\n"
245
- end
246
-
247
- raise e if conn_attempt > max_conn_attempts
248
-
249
- sleep 1
250
- retry
251
- ensure
252
- $stdout.flush
253
- end
254
- rescue Interrupt
255
- # Exit Gracefully if CTRL+C is Pressed During Session
256
- Cryptum.exit_gracefully(
257
- which_self: self,
258
- event_history: event_history,
259
- option_choice: option_choice,
260
- env: env
261
- )
262
- rescue StandardError => e
263
- raise e
264
- end
265
-
266
- # Display Usage for this Module
267
- public_class_method def self.help
268
- puts "USAGE:
269
- logger = #{self}.create()
270
- "
271
- end
272
- end
273
- end
274
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Cryptum
4
- # This plugin is used to Establish a Web
5
- # Socket Connection with Coinbase
6
- module WebSock
7
- require 'cryptum/web_sock/coinbase'
8
- require 'cryptum/web_sock/event_machine'
9
-
10
- # Display Usage for this Module
11
-
12
- public_class_method def self.help
13
- constants.sort
14
- end
15
- end
16
- end
data/lib/cryptum.rb DELETED
@@ -1,120 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rbtrace'
4
- require 'yaml'
5
- require 'json'
6
- require 'fileutils'
7
- require 'tty-spinner'
8
- # Root-Level Namespace for cryptum
9
- module Cryptum
10
- $stdout.sync = true
11
- $stdout.flush
12
-
13
- require 'cryptum/api'
14
- require 'cryptum/bot_conf'
15
- require 'cryptum/event'
16
- require 'cryptum/log'
17
- require 'cryptum/matrix'
18
- require 'cryptum/open_ai'
19
- require 'cryptum/option'
20
- require 'cryptum/order_book'
21
- require 'cryptum/portfolio'
22
- require 'cryptum/ui'
23
- require 'cryptum/version'
24
- require 'cryptum/web_sock'
25
-
26
- public_class_method def self.bin
27
- File.join root, 'bin'
28
- end
29
-
30
- public_class_method def self.etc
31
- File.join root, 'etc'
32
- end
33
-
34
- public_class_method def self.lib
35
- File.join root, 'lib'
36
- end
37
-
38
- public_class_method def self.order_book
39
- File.join root, 'order_book'
40
- end
41
-
42
- public_class_method def self.root
43
- File.dirname __dir__
44
- end
45
-
46
- public_class_method def self.open_symbol
47
- "\u00f8"
48
- end
49
-
50
- public_class_method def self.up_arrow
51
- "\u2191"
52
- end
53
-
54
- public_class_method def self.down_arrow
55
- "\u2193"
56
- end
57
-
58
- public_class_method def self.flat_arrow
59
- '_'
60
- end
61
-
62
- # Add Commas to Large Numbers to Make it Easier to Read
63
- public_class_method def self.beautify_large_number(opts = {})
64
- value = opts[:value].to_s
65
-
66
- split_str_num = value.split('.')
67
- whole_num = split_str_num.first
68
- fraction = 0
69
- fraction = split_str_num.last if split_str_num.length > 1
70
-
71
- is_negative = false
72
- is_negative = true if whole_num.chars.first == '-'
73
- whole_num = whole_num[1..] if is_negative
74
- beautify_whole = whole_num.reverse.scan(/.{1,3}/).join(',').reverse
75
- beautify_num = "#{beautify_whole}.#{fraction}" unless is_negative
76
- beautify_num = "-#{beautify_whole}.#{fraction}" if is_negative
77
-
78
- beautify_num
79
- rescue Interrupt
80
- # Exit Gracefully if CTRL+C is Pressed During Session
81
- Cryptum.exit_gracefully(which_self: self)
82
- rescue StandardError => e
83
- # Produce a Stacktrace for anything else
84
- Curses.close_screen
85
- raise e
86
- end
87
-
88
- public_class_method def self.exit_gracefully(opts = {})
89
- which_self = opts[:which_self]
90
- event_history = opts[:event_history]
91
- # option_choice = opts[:option_choice]
92
- # env = opts[:env]
93
-
94
- # Clear out candle data to ensure
95
- # Cryptum Statistics Only Apply to
96
- # Live Sessions
97
- if event_history
98
- File.write(
99
- order_book_file,
100
- JSON.pretty_generate(event_history.order_book)
101
- )
102
- end
103
-
104
- Curses.close_screen
105
- puts "Interrupt detected in #{which_self}...goodbye."
106
-
107
- exit 0
108
- rescue NameError
109
- puts "\nInterrupt detected in #{which_self}...goodbye."
110
-
111
- exit 0
112
- rescue StandardError => e
113
- # Produce a Stacktrace for anything else
114
- raise e
115
- end
116
-
117
- public_class_method def self.help
118
- constants.sort
119
- end
120
- end
data/order_books/.gitkeep DELETED
File without changes
@@ -1,29 +0,0 @@
1
- #!/bin/bash --login
2
- # USE THIS SCRIPT WHEN UPGRADING VERSIONS IN Gemfile
3
- if [[ $CRYPTUM_ROOT == '' ]]; then
4
- if [[ ! -d '/opt/cryptum' ]]; then
5
- cryptum_root=$(pwd)
6
- else
7
- cryptum_root='/opt/cryptum'
8
- fi
9
- else
10
- cryptum_root="${CRYPTUM_ROOT}"
11
- fi
12
-
13
- if [[ -f '/etc/profile.d/rvm.sh' ]]; then
14
- source /etc/profile.d/rvm.sh
15
- fi
16
-
17
- ruby_version=`cat ${cryptum_root}/.ruby-version`
18
- ruby_gemset=`cat ${cryptum_root}/.ruby-gemset`
19
- rvm use ruby-$ruby_version@global
20
- rvm gemset --force delete $ruby_gemset
21
- if [[ -f "${cryptum_root}/Gemfile.lock" ]]; then
22
- rvmsudo rm $cryptum_root/Gemfile.lock
23
- fi
24
-
25
- rvm use ruby-$ruby_version@$ruby_gemset --create
26
- export rvmsudo_secure_path=1
27
- rvmsudo gem install bundler
28
- rvmsudo bundle install
29
- rvm --default ruby-$ruby_version@$ruby_gemset
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Cryptum::API do
6
- it 'should display information for existing help method' do
7
- help_response = Cryptum::API
8
- expect(help_response).to respond_to :help
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Cryptum::Event do
6
- it 'should display information for existing help method' do
7
- help_response = Cryptum::Event
8
- expect(help_response).to respond_to :help
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Cryptum::Log do
6
- it 'should display information for existing help method' do
7
- help_response = Cryptum::Log
8
- expect(help_response).to respond_to :help
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Cryptum::Option do
6
- it 'should return data for help method' do
7
- help_response = Cryptum::Option.help
8
- expect(help_response).not_to be_nil
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Cryptum::OrderBook::Generate do
6
- it 'should display information for existing help method' do
7
- help_response = Cryptum::OrderBook::Generate
8
- expect(help_response).to respond_to :help
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Cryptum::OrderBook::MarketTrend do
6
- it 'should display information for existing help method' do
7
- help_response = Cryptum::OrderBook::MarketTrend
8
- expect(help_response).to respond_to :help
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Cryptum::OrderBook do
6
- it 'should display information for existing help method' do
7
- help_response = Cryptum::OrderBook
8
- expect(help_response).to respond_to :help
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Cryptum::UI::Command do
6
- it 'should display information for existing help method' do
7
- help_response = Cryptum::UI::Command
8
- expect(help_response).to respond_to :help
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Cryptum::UI::Ticker do
6
- it 'should display information for existing help method' do
7
- help_response = Cryptum::UI::Ticker
8
- expect(help_response).to respond_to :help
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Cryptum::UI do
6
- it 'should return data for help method' do
7
- help_response = Cryptum::UI.help
8
- expect(help_response).not_to be_nil
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Cryptum::WebSock do
6
- it 'should display information for existing help method' do
7
- help_response = Cryptum::WebSock
8
- expect(help_response).to respond_to :help
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Cryptum do
6
- it 'should return data for help method' do
7
- help_response = Cryptum.help
8
- expect(help_response).not_to be_nil
9
- end
10
- end
data/spec/spec_helper.rb DELETED
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'cryptum'
@@ -1,20 +0,0 @@
1
- #!/bin/bash --login
2
- cat Gemfile | awk '{print $2}' | grep -E "^'.+$" | grep -v -e rubygems.org | while read gem; do
3
- this_gem=`echo $gem | sed "s/'//g" | sed 's/\,//g'`
4
- latest_version=`gem search -r $this_gem | grep -E "^${this_gem}\s.+$" | awk '{print $2}' | sed 's/(//g' | sed 's/)//g' | sed 's/,//g'`
5
- echo "${this_gem} => $latest_version"
6
- os=`uname -s`
7
- if [[ $os == 'Linux' ]]; then
8
- if [[ $this_gem == 'bundler' ]]; then
9
- sed -i "s/^gem '${this_gem}'.*$/gem '${this_gem}', '>=${latest_version}'/g" Gemfile
10
- else
11
- sed -i "s/^gem '${this_gem}'.*$/gem '${this_gem}', '${latest_version}'/g" Gemfile
12
- fi
13
- elif [[ $os == 'Darwin' ]]; then
14
- if [[ $this_gem == 'bundler' ]]; then
15
- sed -i '' "s/^gem '${this_gem}'.*$/gem '${this_gem}', '>=${latest_version}'/g" Gemfile
16
- else
17
- sed -i '' "s/^gem '${this_gem}'.*$/gem '${this_gem}', '${latest_version}'/g" Gemfile
18
- fi
19
- fi
20
- done
data/upgrade_cryptum.sh DELETED
@@ -1,13 +0,0 @@
1
- #!/bin/bash --login
2
- if [[ $CRYPTUM_ROOT == '' ]]; then
3
- if [[ ! -d '/opt/cryptum' ]]; then
4
- cryptum_root=$(pwd)
5
- else
6
- cryptum_root='/opt/cryptum'
7
- fi
8
- else
9
- cryptum_root="${CRYPTUM_ROOT}"
10
- fi
11
-
12
- export rvmsudo_secure_path=1
13
- rvmsudo /bin/bash --login -c "cd ${cryptum_root} && ./build_cryptum_gem.sh"
data/upgrade_gem.sh DELETED
@@ -1,4 +0,0 @@
1
- #!/bin/bash --login
2
- printf "Updating RubyGems (i.e. gem command)..."
3
- gem update --system
4
- echo "complete."
data/upgrade_ruby.sh DELETED
@@ -1,45 +0,0 @@
1
- #!/bin/bash --login
2
- # USE THIS SCRIPT WHEN UPGRADING RUBY
3
- if [[ $CRYPTUM_ROOT == '' ]]; then
4
- if [[ ! -d '/opt/cryptum' ]]; then
5
- cryptum_root=$(pwd)
6
- else
7
- cryptum_root='/opt/cryptum'
8
- fi
9
- else
10
- cryptum_root="${CRYPTUM_ROOT}"
11
- fi
12
-
13
- function usage() {
14
- echo $"Usage: $0 <new ruby version e.g. 2.4.4> <optional bool running from build_cryptum_gem.sh>"
15
- exit 1
16
- }
17
-
18
- if [[ -f '/etc/profile.d/rvm.sh' ]]; then
19
- source /etc/profile.d/rvm.sh
20
- fi
21
-
22
- new_ruby_version=$1
23
- if [[ $2 != '' ]]; then
24
- old_ruby_version=$2
25
- else
26
- old_ruby_version=`cat ${cryptum_root}/.ruby-version`
27
- fi
28
-
29
- ruby_gemset=`cat ${cryptum_root}/.ruby-gemset`
30
-
31
- if [[ $# < 1 ]]; then
32
- usage
33
- fi
34
-
35
- # Upgrade RVM
36
- export rvmsudo_secure_path=1
37
- rvmsudo rvm get head
38
- rvm reload
39
-
40
- # Install New Version of RubyGems & Ruby
41
- cd $cryptum_root && ./upgrade_gem.sh
42
- rvmsudo rvm install ruby-$new_ruby_version
43
- echo $new_ruby_version > $cryptum_root/.ruby-version
44
-
45
- cd $cryptum_root && rvm use $new_ruby_version@$ruby_gemset && ./build_cryptum_gem.sh