osbc 0.1.5 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.env +1 -0
  3. data/CHANGELOG.md +8 -3
  4. data/README.md +24 -10
  5. data/app/controllers/api/v1/application_controller.rb +67 -0
  6. data/app/controllers/api/v1/block_confirmations_controller.rb +19 -38
  7. data/app/controllers/api/v1/ticket_manager_controller.rb +65 -0
  8. data/app/controllers/contracts_controller.rb +0 -5
  9. data/app/controllers/pools_controller.rb +0 -52
  10. data/app/controllers/signatures_controller.rb +0 -5
  11. data/app/controllers/tickets_controller.rb +0 -27
  12. data/app/views/transactions/_transaction.html.slim +1 -2
  13. data/app/views/users/registrations/new.html.erb +1 -1
  14. data/app/workers/create_ticket_worker.rb +1 -0
  15. data/config/initializers/sidekiq.rb +1 -0
  16. data/config/routes/api.rb +1 -1
  17. data/lib/osbc/osbc.rb +1 -1
  18. data/lib/tasks/compose.rake +26 -15
  19. data/lib/tasks/compose_db.rake +27 -17
  20. data/lib/tasks/compose_logs.rake +25 -15
  21. data/lib/tasks/compose_test.rake +19 -9
  22. data/lib/tasks/task_helpers/compose_taskhelper.rb +22 -0
  23. data/lib/tasks/task_helpers/taskhelper.rb +23 -0
  24. data/mining_concept.ipynb +2 -2
  25. metadata +12 -40
  26. data/coverage/.last_run.json +0 -5
  27. data/coverage/.resultset.json +0 -1853
  28. data/coverage/.resultset.json.lock +0 -0
  29. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png +0 -0
  30. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc_disabled.png +0 -0
  31. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png +0 -0
  32. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png +0 -0
  33. data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc_disabled.png +0 -0
  34. data/coverage/assets/0.12.3/application.css +0 -1
  35. data/coverage/assets/0.12.3/application.js +0 -7
  36. data/coverage/assets/0.12.3/colorbox/border.png +0 -0
  37. data/coverage/assets/0.12.3/colorbox/controls.png +0 -0
  38. data/coverage/assets/0.12.3/colorbox/loading.gif +0 -0
  39. data/coverage/assets/0.12.3/colorbox/loading_background.png +0 -0
  40. data/coverage/assets/0.12.3/favicon_green.png +0 -0
  41. data/coverage/assets/0.12.3/favicon_red.png +0 -0
  42. data/coverage/assets/0.12.3/favicon_yellow.png +0 -0
  43. data/coverage/assets/0.12.3/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  44. data/coverage/assets/0.12.3/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  45. data/coverage/assets/0.12.3/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  46. data/coverage/assets/0.12.3/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  47. data/coverage/assets/0.12.3/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  48. data/coverage/assets/0.12.3/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  49. data/coverage/assets/0.12.3/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  50. data/coverage/assets/0.12.3/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  51. data/coverage/assets/0.12.3/images/ui-icons_222222_256x240.png +0 -0
  52. data/coverage/assets/0.12.3/images/ui-icons_2e83ff_256x240.png +0 -0
  53. data/coverage/assets/0.12.3/images/ui-icons_454545_256x240.png +0 -0
  54. data/coverage/assets/0.12.3/images/ui-icons_888888_256x240.png +0 -0
  55. data/coverage/assets/0.12.3/images/ui-icons_cd0a0a_256x240.png +0 -0
  56. data/coverage/assets/0.12.3/loading.gif +0 -0
  57. data/coverage/assets/0.12.3/magnify.png +0 -0
  58. data/coverage/index.html +0 -20731
@@ -1,71 +1,81 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "rake"
4
+ require_relative "task_helpers/compose_taskhelper"
5
+
6
+
7
+ def task_helper
8
+ @task_helper ||= TaskHelpers::ComposeTaskhelper.new
9
+ end
10
+
11
+ def compose_command
12
+ @compose_comand ||= task_helper.compose_command
13
+ end
4
14
 
5
15
  namespace :compose_db do
6
16
  task :drop do
7
17
  puts "Dropping Database..."
8
- system("sudo docker compose run --rm web rake db:drop")
18
+ system "sudo #{compose_command} run --rm web rake db:drop"
9
19
  puts "Dropping Database... Done!"
10
20
  end
11
21
 
12
22
  task :rollback do
13
23
  puts "Rolling Back Database..."
14
- system("sudo docker compose run --rm web rails db:rollback")
24
+ system "sudo #{compose_command} run --rm web rails db:rollback"
15
25
  puts "Rolling Back Database... Done!"
16
26
  end
17
27
 
18
28
  task :complete_setup do
19
29
  puts "Setting up Database..."
20
- system("sudo docker compose run --rm web rake db:create")
21
- system("sudo docker compose run --rm web rake db:migrate")
22
- system("sudo docker compose run --rm web rake db:seed")
30
+ system "sudo #{compose_command} run --rm web rake db:create"
31
+ system "sudo #{compose_command} run --rm web rake db:migrate"
32
+ system "sudo #{compose_command} run --rm web rake db:seed"
23
33
  puts "Setting up Database... Done!"
24
34
  end
25
35
 
26
36
  task :setup do
27
37
  puts "Setting up and seeding Database..."
28
- system("sudo docker compose run --rm web rake db:setup")
38
+ system "sudo #{compose_command} run --rm web rake db:setup"
29
39
  puts "Setting up and seeding Database... Done!"
30
40
  end
31
41
 
32
42
  task :create do
33
43
  puts "Creating Database..."
34
- system("sudo docker compose run --rm web rake db:create")
44
+ system "sudo #{compose_command} run --rm web rake db:create"
35
45
  puts "Creating Database... Done!"
36
46
  end
37
47
 
38
48
  task :migrate do
39
49
  puts "Running Migration..."
40
- system("sudo docker compose run --rm web rake db:migrate")
50
+ system "sudo #{compose_command} run --rm web rake db:migrate"
41
51
  puts "Running Migration... Done!"
42
52
  end
43
53
 
44
54
  task :seed do
45
55
  puts "Running Seed..."
46
- system("sudo docker compose run --rm web rake db:seed")
56
+ system "sudo #{compose_command} run --rm web rake db:seed"
47
57
  puts "Running Seed... Done!"
48
58
  end
49
59
 
50
60
  task :reset_setup do
51
61
  puts "Resettting Database..."
52
- system("sudo docker compose run --rm web rake db:drop")
53
- system("sudo docker compose run --rm web rake db:setup")
62
+ system "sudo #{compose_command} run --rm web rake db:drop"
63
+ system "sudo #{compose_command} run --rm web rake db:setup"
54
64
  puts "Resetting up Database... Done!"
55
65
  end
56
66
 
57
67
  task :reset do
58
68
  puts "Resetting Database..."
59
- system("sudo docker compose run --rm web rake db:drop")
60
- system("sudo docker compose run --rm web rake db:create")
61
- system("sudo docker compose run --rm web rake db:migrate")
62
- system("sudo docker compose run --rm web rake db:seed")
69
+ system "sudo #{compose_command} run --rm web rake db:drop"
70
+ system "sudo #{compose_command} run --rm web rake db:create"
71
+ system "sudo #{compose_command} run --rm web rake db:migrate"
72
+ system "sudo #{compose_command} run --rm web rake db:seed"
63
73
  puts "Resetting Compose... Done!"
64
74
  end
65
75
 
66
76
  task :force_reset do
67
77
  puts "Running Compose Down"
68
- system("rake compose:down")
69
- system("rake compose_db:reset")
78
+ system "rake compose:down"
79
+ system "rake compose_db:reset"
70
80
  end
71
81
  end
@@ -1,95 +1,105 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "rake"
4
+ require_relative "task_helpers/compose_taskhelper"
5
+
6
+
7
+ def task_helper
8
+ @task_helper ||= TaskHelpers::ComposeTaskhelper.new
9
+ end
10
+
11
+ def compose_command
12
+ @compose_comand ||= task_helper.compose_command
13
+ end
4
14
 
5
15
  namespace :compose_logs do
6
16
  task :web do
7
17
  puts "Showing Web Logs..."
8
- system "sudo docker compose logs web"
18
+ system "sudo #{compose_command} logs web"
9
19
  puts "Showing Web Logs... Done!"
10
20
  end
11
21
 
12
22
  task :db do
13
23
  puts "Showing Database Logs..."
14
- system "sudo docker compose logs db"
24
+ system "sudo #{compose_command} logs db"
15
25
  puts "Showing Database Logs... Done!"
16
26
  end
17
27
 
18
28
  task :redis do
19
29
  puts "Showing Redis Logs..."
20
- system "sudo docker compose logs redis"
30
+ system "sudo #{compose_command} logs redis"
21
31
  puts "Showing Redis Logs... Done!"
22
32
  end
23
33
 
24
34
  task :sidekiq do
25
35
  puts "Showing Sidekiq Logs..."
26
- system "sudo docker compose logs sidekiq"
36
+ system "sudo #{compose_command} logs sidekiq"
27
37
  puts "Showing Sidekiq Logs... Done!"
28
38
  end
29
39
 
30
40
  task :all do
31
41
  puts "Showing All Logs..."
32
- system "sudo docker compose logs"
42
+ system "sudo #{compose_command} logs"
33
43
  puts "Showing All Logs... Done!"
34
44
  end
35
45
 
36
46
  task :tail_web do
37
47
  puts "Tailing Web Logs..."
38
- system "sudo docker compose logs -f web"
48
+ system "sudo #{compose_command} logs -f web"
39
49
  puts "Tailing Web Logs... Done!"
40
50
  end
41
51
 
42
52
  task :tail_db do
43
53
  puts "Tailing Database Logs..."
44
- system "sudo docker compose logs -f db"
54
+ system "sudo #{compose_command} logs -f db"
45
55
  puts "Tailing Database Logs... Done!"
46
56
  end
47
57
 
48
58
  task :tail_redis do
49
59
  puts "Tailing Redis Logs..."
50
- system "sudo docker compose logs -f redis"
60
+ system "sudo #{compose_command} logs -f redis"
51
61
  puts "Tailing Redis Logs... Done!"
52
62
  end
53
63
 
54
64
  task :tail_sidekiq do
55
65
  puts "Tailing Sidekiq Logs..."
56
- system "sudo docker compose logs -f sidekiq"
66
+ system "sudo #{compose_command} logs -f sidekiq"
57
67
  puts "Tailing Sidekiq Logs... Done!"
58
68
  end
59
69
 
60
70
  task :tail_all do
61
71
  puts "Tailing All Logs..."
62
- system "sudo docker compose logs -f"
72
+ system "sudo #{compose_command} logs -f"
63
73
  puts "Tailing All Logs... Done!"
64
74
  end
65
75
 
66
76
  task :follow_web do
67
77
  puts "Following Web Logs..."
68
- system "sudo docker compose logs -f web"
78
+ system "sudo #{compose_command} logs -f web"
69
79
  puts "Following Web Logs... Done!"
70
80
  end
71
81
 
72
82
  task :follow_db do
73
83
  puts "Following Database Logs..."
74
- system "sudo docker compose logs -f db"
84
+ system "sudo #{compose_command} logs -f db"
75
85
  puts "Following Database Logs... Done!"
76
86
  end
77
87
 
78
88
  task :follow_redis do
79
89
  puts "Following Redis Logs..."
80
- system "sudo docker compose logs -f redis"
90
+ system "sudo #{compose_command} logs -f redis"
81
91
  puts "Following Redis Logs... Done!"
82
92
  end
83
93
 
84
94
  task :follow_sidekiq do
85
95
  puts "Following Sidekiq Logs..."
86
- system "sudo docker compose logs -f sidekiq"
96
+ system "sudo #{compose_command} logs -f sidekiq"
87
97
  puts "Following Sidekiq Logs... Done!"
88
98
  end
89
99
 
90
100
  task :follow_all do
91
101
  puts "Following All Logs..."
92
- system "sudo docker compose logs -f"
102
+ system "sudo #{compose_command} logs -f"
93
103
  puts "Following All Logs... Done!"
94
104
  end
95
105
  end
@@ -1,11 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "rake"
4
+ require_relative "task_helpers/compose_taskhelper"
5
+
6
+
7
+ def task_helper
8
+ @task_helper ||= TaskHelpers::ComposeTaskhelper.new
9
+ end
10
+
11
+ def compose_command
12
+ @compose_comand ||= task_helper.compose_command
13
+ end
4
14
 
5
15
  namespace :compose_test do
6
16
  task :all do
7
17
  puts "Running Test..."
8
- system "sudo docker compose run --rm web bundle exec rspec"
18
+ system "sudo #{compose_command} run --rm web bundle exec rspec"
9
19
  puts "Running Test... Done!"
10
20
  end
11
21
 
@@ -14,49 +24,49 @@ namespace :compose_test do
14
24
  system "rake compose:clean_all"
15
25
  puts "Cleaning Compose Images... Done!"
16
26
  puts "Running Tests ..."
17
- system "sudo docker compose run --rm web bundle exec rspec"
27
+ system "sudo #{compose_command} run --rm web bundle exec rspec"
18
28
  puts "Running Clean Test... Done!"
19
29
  end
20
30
 
21
31
  task :controllers do
22
32
  puts "Running Controllers Test..."
23
- system "sudo docker compose run --rm web bundle exec rspec spec/controllers"
33
+ system "sudo #{compose_command} run --rm web bundle exec rspec spec/controllers"
24
34
  puts "Running Controllers Test... Done!"
25
35
  end
26
36
 
27
37
  task :models do
28
38
  puts "Running Models Test..."
29
- system "sudo docker compose run --rm web bundle exec rspec spec/models"
39
+ system "sudo #{compose_command} run --rm web bundle exec rspec spec/models"
30
40
  puts "Running Models Test... Done!"
31
41
  end
32
42
 
33
43
  task :requests do
34
44
  puts "Running Requests Test..."
35
- system "sudo docker compose run --rm web bundle exec rspec spec/requests"
45
+ system "sudo #{compose_command} run --rm web bundle exec rspec spec/requests"
36
46
  puts "Running Requests Test... Done!"
37
47
  end
38
48
 
39
49
  task :helpers do
40
50
  puts "Running Helpers Test..."
41
- system "sudo docker compose run --rm web bundle exec rspec spec/helpers"
51
+ system "sudo #{compose_command} run --rm web bundle exec rspec spec/helpers"
42
52
  puts "Running Helpers Test... Done!"
43
53
  end
44
54
 
45
55
  task :mailers do
46
56
  puts "Running Mailers Test..."
47
- system "sudo docker compose run --rm web bundle exec rspec spec/mailers"
57
+ system "sudo #{compose_command} run --rm web bundle exec rspec spec/mailers"
48
58
  puts "Running Mailers Test... Done!"
49
59
  end
50
60
 
51
61
  task :routing do
52
62
  puts "Running Routing Test..."
53
- system "sudo docker compose run --rm web bundle exec rspec spec/routing"
63
+ system "sudo #{compose_command} run --rm web bundle exec rspec spec/routing"
54
64
  puts "Running Routing Test... Done!"
55
65
  end
56
66
 
57
67
  task :views do
58
68
  puts "Running Views Test..."
59
- system "sudo docker compose run --rm web bundle exec rspec spec/views"
69
+ system "sudo #{compose_command} run --rm web bundle exec rspec spec/views"
60
70
  puts "Running Views Test... Done!"
61
71
  end
62
72
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "taskhelper"
4
+
5
+
6
+ class TaskHelpers::ComposeTaskhelper < TaskHelpers::Taskhelper
7
+ def compose_command
8
+ @compose_comand ||= compose_command_finder
9
+ end
10
+
11
+ private
12
+ def compose_command_finder
13
+ @command = ["docker compose", "docker-compose"]
14
+ command_return = ""
15
+ @command.each do |command|
16
+ system "#{command} --version > /dev/null 2>&1"
17
+ command_return = command if $?.success?
18
+ end
19
+ raise ComposeError if command_return.empty?
20
+ command_return
21
+ end
22
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TaskHelpers
4
+ class Taskhelper
5
+ class ComposeError < StandardError
6
+ def initialize(message = "Docker Compose is not installed")
7
+ super
8
+ end
9
+ end
10
+
11
+ private
12
+ def dev_error(e)
13
+ if env_acceptable?
14
+ puts "#{e.class}: #{e.message}"
15
+ puts e.backtrace
16
+ end
17
+ end
18
+
19
+ def env_acceptable?
20
+ Rails.env.development? || Rails.env.test?
21
+ end
22
+ end
23
+ end
data/mining_concept.ipynb CHANGED
@@ -93,8 +93,8 @@
93
93
  "secret = 'a239c12ecc42911ecbc3b23a9539976caaa60f7d40028dea17cb67cc538c21bd'\n",
94
94
  "\n",
95
95
  "headers = {\n",
96
- " 'X-Api-Key': key,\n",
97
- " 'X-Api-Secret': secret,\n",
96
+ " 'X-API-KEY': key,\n",
97
+ " 'X-API-SECRET': secret,\n",
98
98
  "}\n",
99
99
  "\n",
100
100
  "\n",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: osbc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - jesus_gautamah
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-21 00:00:00.000000000 Z
11
+ date: 2022-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -340,7 +340,9 @@ files:
340
340
  - app/assets/stylesheets/home.css
341
341
  - app/channels/application_cable/channel.rb
342
342
  - app/channels/application_cable/connection.rb
343
+ - app/controllers/api/v1/application_controller.rb
343
344
  - app/controllers/api/v1/block_confirmations_controller.rb
345
+ - app/controllers/api/v1/ticket_manager_controller.rb
344
346
  - app/controllers/application_controller.rb
345
347
  - app/controllers/blocks_controller.rb
346
348
  - app/controllers/chains_controller.rb
@@ -520,6 +522,7 @@ files:
520
522
  - config/initializers/filter_parameter_logging.rb
521
523
  - config/initializers/inflections.rb
522
524
  - config/initializers/permissions_policy.rb
525
+ - config/initializers/sidekiq.rb
523
526
  - config/locales/devise.en.yml
524
527
  - config/locales/en.yml
525
528
  - config/puma.rb
@@ -528,39 +531,6 @@ files:
528
531
  - config/sidekiq.yml
529
532
  - config/storage.yml
530
533
  - config/tailwind.config.js
531
- - coverage/.last_run.json
532
- - coverage/.resultset.json
533
- - coverage/.resultset.json.lock
534
- - coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png
535
- - coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc_disabled.png
536
- - coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png
537
- - coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png
538
- - coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc_disabled.png
539
- - coverage/assets/0.12.3/application.css
540
- - coverage/assets/0.12.3/application.js
541
- - coverage/assets/0.12.3/colorbox/border.png
542
- - coverage/assets/0.12.3/colorbox/controls.png
543
- - coverage/assets/0.12.3/colorbox/loading.gif
544
- - coverage/assets/0.12.3/colorbox/loading_background.png
545
- - coverage/assets/0.12.3/favicon_green.png
546
- - coverage/assets/0.12.3/favicon_red.png
547
- - coverage/assets/0.12.3/favicon_yellow.png
548
- - coverage/assets/0.12.3/images/ui-bg_flat_0_aaaaaa_40x100.png
549
- - coverage/assets/0.12.3/images/ui-bg_flat_75_ffffff_40x100.png
550
- - coverage/assets/0.12.3/images/ui-bg_glass_55_fbf9ee_1x400.png
551
- - coverage/assets/0.12.3/images/ui-bg_glass_65_ffffff_1x400.png
552
- - coverage/assets/0.12.3/images/ui-bg_glass_75_dadada_1x400.png
553
- - coverage/assets/0.12.3/images/ui-bg_glass_75_e6e6e6_1x400.png
554
- - coverage/assets/0.12.3/images/ui-bg_glass_95_fef1ec_1x400.png
555
- - coverage/assets/0.12.3/images/ui-bg_highlight-soft_75_cccccc_1x100.png
556
- - coverage/assets/0.12.3/images/ui-icons_222222_256x240.png
557
- - coverage/assets/0.12.3/images/ui-icons_2e83ff_256x240.png
558
- - coverage/assets/0.12.3/images/ui-icons_454545_256x240.png
559
- - coverage/assets/0.12.3/images/ui-icons_888888_256x240.png
560
- - coverage/assets/0.12.3/images/ui-icons_cd0a0a_256x240.png
561
- - coverage/assets/0.12.3/loading.gif
562
- - coverage/assets/0.12.3/magnify.png
563
- - coverage/index.html
564
534
  - db/migrate/20221018053949_devise_create_users.rb
565
535
  - db/migrate/20221019002956_create_chains.rb
566
536
  - db/migrate/20221020112137_create_blocks.rb
@@ -597,6 +567,8 @@ files:
597
567
  - lib/tasks/compose_db.rake
598
568
  - lib/tasks/compose_logs.rake
599
569
  - lib/tasks/compose_test.rake
570
+ - lib/tasks/task_helpers/compose_taskhelper.rb
571
+ - lib/tasks/task_helpers/taskhelper.rb
600
572
  - log/.keep
601
573
  - mining_concept.ipynb
602
574
  - outerspace-blockchain.gemspec
@@ -619,9 +591,9 @@ licenses:
619
591
  metadata:
620
592
  allowed_push_host: https://rubygems.org
621
593
  homepage_uri: https://outerspace-blockchain.herokuapp.com/
622
- source_code_uri: https://github.com/outerspace-coding/outerspace-blockchain
623
- changelog_uri: https://github.com/outerspace-coding/outerspace-blockchain/blob/main/CHANGELOG.md
624
- post_install_message:
594
+ source_code_uri: https://github.com/JesusGautamah/outerspace-blockchain
595
+ changelog_uri: https://github.com/JesusGautamah/outerspace-blockchain/blob/main/CHANGELOG.md
596
+ post_install_message:
625
597
  rdoc_options: []
626
598
  require_paths:
627
599
  - lib
@@ -637,7 +609,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
637
609
  version: '0'
638
610
  requirements: []
639
611
  rubygems_version: 3.2.32
640
- signing_key:
612
+ signing_key:
641
613
  specification_version: 4
642
614
  summary: Blockchain implementation in Ruby
643
615
  test_files: []
@@ -1,5 +0,0 @@
1
- {
2
- "result": {
3
- "line": 70.1
4
- }
5
- }