rubypitaya 2.9.0 → 2.9.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a6575a4e72c2225e88a02e48a02265797958d1ba5aba36d017bd576fd071c09
4
- data.tar.gz: b502c84808a5372a6f354f860d5fd673a790851bcff700964b4da24a96c0f50f
3
+ metadata.gz: 6ab54a69fe61d66985ab96ae5ae8352a5513f6d2421ae706baca351e7c52d9c3
4
+ data.tar.gz: 57aedd19e1426c1935224fa2510224856ef1cb3b79754eef9f9c4f237aba9aae
5
5
  SHA512:
6
- metadata.gz: 89b94ffafd69e7216559fcbbd6f55f81a431d4f357771d5ca595ad25a32fcb4e5f0427d5ec21db982ca97f65a19bd3a08b5293ec933e52bd5ac3bcd4c8f26a7e
7
- data.tar.gz: 6701e279dc7173a1dde84870d2b3728554649a748f36eb2583d0f45b6d5d25432f19de88dc742351f85f8cd81c415fdea414170acbfabd245bcf3a6bbb26c727
6
+ metadata.gz: 9bbc810cac4352e074c6286b154c3a5b547783a4e81859a63d03fa08b78b2e15bdbdff4ec7a630f0aa8027fd07fb30002e55e4c82aa006def2b5d7d7674b01e2
7
+ data.tar.gz: caf3e3cc055e0498c219a97a516baa3c83c7f1e9054b68bc057312402fb660053d640d3d0530ed31d9be4617a507e27ff0751bdea64133470e7fe451d8b43fbc
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'rubypitaya'
4
4
 
5
- COMMANDS = ['run', 'create', 'create-migration']
5
+ COMMANDS = ['run', 'create', 'create-migration', 'add-plugin']
6
6
 
7
7
  def main
8
8
  if ARGV.size == 0 || !COMMANDS.include?(ARGV[0])
@@ -23,6 +23,10 @@ def main
23
23
  if command == 'create-migration'
24
24
  command_create_migration(ARGV)
25
25
  end
26
+
27
+ if command == 'add-plugin'
28
+ command_add_plugin(ARGV)
29
+ end
26
30
  end
27
31
 
28
32
  def command_run(argv)
@@ -57,6 +61,19 @@ def command_create_migration(argv)
57
61
  puts "Migration #{migration_file_name} created!"
58
62
  end
59
63
 
64
+ def command_add_plugin(argv)
65
+ if argv.size <= 1
66
+ show_help_add_plugin()
67
+ exit(-1)
68
+ end
69
+
70
+ plugin_git_link = argv[1]
71
+
72
+ plugin_name = RubyPitaya::RubyPitaya.add_plugin(plugin_git_link)
73
+
74
+ puts "Plugin #{plugin_name} added!"
75
+ end
76
+
60
77
  def show_help
61
78
  puts 'Usage: $ rubypitaya [COMMAND]'
62
79
  puts 'COMMAND:'
@@ -76,4 +93,9 @@ def show_help_create_migration
76
93
  puts ''
77
94
  end
78
95
 
96
+ def show_help_add_plugin
97
+ puts 'Usage: $ rubypitaya create-migration [migration_name]'
98
+ puts ''
99
+ end
100
+
79
101
  main
@@ -37,5 +37,19 @@ module RubyPitaya
37
37
 
38
38
  migration_file_name
39
39
  end
40
+
41
+ def self.add_plugin(plugin_git_link)
42
+ Dir.mkdir(Path::PLUGINS_FOLDER_PATH) unless File.exists?(Path::PLUGINS_FOLDER_PATH)
43
+
44
+ plugin_name = plugin_git_link.scan(/.+\/(.+)\.git/).flatten.first
45
+ plugin_folder_path = File.join(Path::PLUGINS_FOLDER_PATH, plugin_name)
46
+ plugin_git_path = File.join(plugin_folder_path, '.git/')
47
+
48
+ FileUtils.rm_rf(plugin_folder_path) if File.exists?(plugin_folder_path)
49
+ `git -C #{Path::PLUGINS_FOLDER_PATH} clone #{plugin_git_link}`
50
+ FileUtils.rm_rf(plugin_git_path)
51
+
52
+ plugin_name
53
+ end
40
54
  end
41
55
  end
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'rubypitaya', '2.9.0'
3
+ gem 'rubypitaya', '2.9.1'
4
4
 
5
5
  group :development do
6
6
  gem 'pry', '0.12.2'
@@ -69,7 +69,7 @@ GEM
69
69
  rspec-support (~> 3.8.0)
70
70
  rspec-support (3.8.3)
71
71
  ruby2_keywords (0.0.2)
72
- rubypitaya (2.9.0)
72
+ rubypitaya (2.9.1)
73
73
  activerecord (= 6.0.2)
74
74
  etcdv3 (= 0.10.2)
75
75
  eventmachine (= 1.2.7)
@@ -106,7 +106,7 @@ DEPENDENCIES
106
106
  listen (= 3.2.1)
107
107
  pry (= 0.12.2)
108
108
  rspec (= 3.8.0)
109
- rubypitaya (= 2.9.0)
109
+ rubypitaya (= 2.9.1)
110
110
 
111
111
  BUNDLED WITH
112
112
  1.17.2
@@ -32,6 +32,10 @@ bash:
32
32
  create-migration:
33
33
  @docker-compose run --service-ports --rm rubypitaya-console bundle exec rubypitaya create-migration $(NAME)
34
34
 
35
+ ## Add or update a plugim. GIT=[plugin-git-link]
36
+ add-plugin:
37
+ @docker-compose run --service-ports --rm rubypitaya-console bundle exec rubypitaya add-plugin $(GIT)
38
+
35
39
  ## Create database
36
40
  db-create:
37
41
  @docker-compose run --service-ports --rm rubypitaya bundle exec rake db:create
@@ -11,6 +11,7 @@ module RubyPitaya
11
11
  APP_CONFIG_FOLDER_PATH = File.join(Dir.pwd, 'app/config/')
12
12
  APP_SETUP_FOLDER_PATH = File.join(Dir.pwd, 'app/setup/')
13
13
  MIGRATIONS_FOLDER_PATH = File.join(Dir.pwd, 'db/migration/')
14
+ PLUGINS_FOLDER_PATH = File.join(Dir.pwd, 'plugins/')
14
15
 
15
16
  ROUTES_FILE_PATH = File.join(Dir.pwd, 'config/routes.rb')
16
17
 
@@ -1,3 +1,3 @@
1
1
  module RubyPitaya
2
- VERSION = '2.9.0'
2
+ VERSION = '2.9.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubypitaya
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.0
4
+ version: 2.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luciano Prestes Cavalcanti