osbc 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env +1 -0
- data/app/controllers/api/v1/block_confirmations_controller.rb +12 -12
- data/app/controllers/contracts_controller.rb +0 -5
- data/app/controllers/pools_controller.rb +0 -52
- data/app/controllers/signatures_controller.rb +0 -5
- data/app/controllers/tickets_controller.rb +0 -27
- data/app/views/transactions/_transaction.html.slim +1 -2
- data/app/views/users/registrations/new.html.erb +1 -1
- data/config/routes/api.rb +1 -1
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +963 -1070
- data/coverage/index.html +4841 -5106
- data/lib/osbc/osbc.rb +1 -1
- data/lib/tasks/compose.rake +26 -15
- data/lib/tasks/compose_db.rake +27 -17
- data/lib/tasks/compose_logs.rake +25 -15
- data/lib/tasks/compose_test.rake +19 -9
- data/lib/tasks/task_helpers/compose_taskhelper.rb +22 -0
- data/lib/tasks/task_helpers/taskhelper.rb +23 -0
- metadata +8 -6
data/lib/osbc/osbc.rb
CHANGED
data/lib/tasks/compose.rake
CHANGED
@@ -1,19 +1,29 @@
|
|
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_command ||= task_helper.compose_command
|
13
|
+
end
|
4
14
|
|
5
15
|
namespace :compose do
|
6
16
|
task :install do
|
7
17
|
puts "Installing Blockchain and Database Containers"
|
8
|
-
system "sudo
|
18
|
+
system "sudo #{compose_command} build"
|
9
19
|
puts "Creating Database"
|
10
|
-
system "sudo
|
20
|
+
system "sudo #{compose_command} run --rm web rails db:create"
|
11
21
|
puts "Migrating Database"
|
12
|
-
system "sudo
|
22
|
+
system "sudo #{compose_command} run --rm web rails db:migrate"
|
13
23
|
puts "Seeding Database"
|
14
|
-
system "sudo
|
24
|
+
system "sudo #{compose_command} run --rm web rails db:seed"
|
15
25
|
puts "Stopping Containers"
|
16
|
-
system "sudo
|
26
|
+
system "sudo #{compose_command} down"
|
17
27
|
puts "Installing Blockchain and Database Containers... Done!"
|
18
28
|
puts "This already setup your database with some initial values"
|
19
29
|
puts "Start the containers with command: rake compose:up"
|
@@ -32,57 +42,58 @@ namespace :compose do
|
|
32
42
|
|
33
43
|
task :build do
|
34
44
|
puts "Building Compose..."
|
35
|
-
system "sudo
|
45
|
+
system "sudo #{compose_command} build"
|
36
46
|
puts "Building Compose... Done!"
|
37
47
|
end
|
38
48
|
|
39
49
|
task :up do
|
50
|
+
puts compose_command
|
40
51
|
puts "Running Compose..."
|
41
|
-
system "sudo
|
52
|
+
system "sudo #{compose_command} up -d --remove-orphans"
|
42
53
|
puts "Running Compose... Done!"
|
43
54
|
end
|
44
55
|
|
45
56
|
task :down do
|
46
57
|
puts "Stopping Compose..."
|
47
|
-
system "sudo
|
58
|
+
system "sudo #{compose_command} down"
|
48
59
|
puts "Stopping Compose... Done!"
|
49
60
|
end
|
50
61
|
|
51
62
|
task :db_detach do
|
52
63
|
puts "Running Database Detached..."
|
53
|
-
system "sudo
|
64
|
+
system "sudo #{compose_command} up -d db"
|
54
65
|
puts "Running Database Detached... Done!"
|
55
66
|
end
|
56
67
|
|
57
68
|
task :redis_detach do
|
58
69
|
puts "Running Redis Detached..."
|
59
|
-
system "sudo
|
70
|
+
system "sudo #{compose_command} up -d redis"
|
60
71
|
puts "Running Redis Detached... Done!"
|
61
72
|
end
|
62
73
|
|
63
74
|
task :back_detach do
|
64
75
|
puts "Running Backend Detached..."
|
65
|
-
system "sudo
|
76
|
+
system "sudo #{compose_command} up -d --remove-orphans db redis sidekiq"
|
66
77
|
puts "Running Backend Detached... Done!"
|
67
78
|
end
|
68
79
|
|
69
80
|
task :restart do
|
70
81
|
puts "Restarting Compose..."
|
71
82
|
puts "Stopping Compose..."
|
72
|
-
system "sudo
|
83
|
+
system "sudo #{compose_command} down"
|
73
84
|
puts "Stopping Compose... Done!"
|
74
85
|
puts "Running Compose..."
|
75
|
-
system "sudo
|
86
|
+
system "sudo #{compose_command} up -d --remove-orphans"
|
76
87
|
puts "Restarting Compose... Done!"
|
77
88
|
end
|
78
89
|
|
79
90
|
task :clean_all do
|
80
91
|
puts "Cleaning Images..."
|
81
92
|
puts "Stopping Compose..."
|
82
|
-
system "sudo
|
93
|
+
system "sudo #{compose_command} down"
|
83
94
|
puts "Stopping Compose... Done!"
|
84
95
|
puts "Removing Compose..."
|
85
|
-
system "sudo
|
96
|
+
system "sudo #{compose_command} rm -v"
|
86
97
|
puts "Removing Compose... Done!"
|
87
98
|
puts "Removing Containers..."
|
88
99
|
system "sudo docker rm -f $(sudo docker ps -a -q)"
|
data/lib/tasks/compose_db.rake
CHANGED
@@ -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
|
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
|
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
|
21
|
-
system
|
22
|
-
system
|
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
|
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
|
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
|
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
|
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
|
53
|
-
system
|
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
|
60
|
-
system
|
61
|
-
system
|
62
|
-
system
|
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
|
69
|
-
system
|
78
|
+
system "rake compose:down"
|
79
|
+
system "rake compose_db:reset"
|
70
80
|
end
|
71
81
|
end
|
data/lib/tasks/compose_logs.rake
CHANGED
@@ -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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
102
|
+
system "sudo #{compose_command} logs -f"
|
93
103
|
puts "Following All Logs... Done!"
|
94
104
|
end
|
95
105
|
end
|
data/lib/tasks/compose_test.rake
CHANGED
@@ -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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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.
|
4
|
+
version: 0.1.6
|
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-
|
11
|
+
date: 2022-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -597,6 +597,8 @@ files:
|
|
597
597
|
- lib/tasks/compose_db.rake
|
598
598
|
- lib/tasks/compose_logs.rake
|
599
599
|
- lib/tasks/compose_test.rake
|
600
|
+
- lib/tasks/task_helpers/compose_taskhelper.rb
|
601
|
+
- lib/tasks/task_helpers/taskhelper.rb
|
600
602
|
- log/.keep
|
601
603
|
- mining_concept.ipynb
|
602
604
|
- outerspace-blockchain.gemspec
|
@@ -619,9 +621,9 @@ licenses:
|
|
619
621
|
metadata:
|
620
622
|
allowed_push_host: https://rubygems.org
|
621
623
|
homepage_uri: https://outerspace-blockchain.herokuapp.com/
|
622
|
-
source_code_uri: https://github.com/
|
624
|
+
source_code_uri: https://github.com/JesusGautamah/outerspace-blockchain
|
623
625
|
changelog_uri: https://github.com/outerspace-coding/outerspace-blockchain/blob/main/CHANGELOG.md
|
624
|
-
post_install_message:
|
626
|
+
post_install_message:
|
625
627
|
rdoc_options: []
|
626
628
|
require_paths:
|
627
629
|
- lib
|
@@ -637,7 +639,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
637
639
|
version: '0'
|
638
640
|
requirements: []
|
639
641
|
rubygems_version: 3.2.32
|
640
|
-
signing_key:
|
642
|
+
signing_key:
|
641
643
|
specification_version: 4
|
642
644
|
summary: Blockchain implementation in Ruby
|
643
645
|
test_files: []
|