ruby_raider 1.0.1 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52074e06fb0010ea9fdc1ffe0729598ced95349c4775b389b353ca80e234de1b
|
4
|
+
data.tar.gz: bc95a37d449f89cf0cdf3fa7d7a393aaeb66dc931cf5cdb924ed3b7245b885d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3190c657ef13871b11658bd01a7744b8f95ba226c418bc913e1bba41d8a4a30a8c64468cee679342be641ac8d444ecb59c27d519f0f3c8d47b5241d9d3f5bb98
|
7
|
+
data.tar.gz: ab2b8c573a2c04a104c45c0e90c805389727fb368f8ec73325b2f2b45076cc460bd1536f630c45e25ae70086f964a68a6793e44910af96e830b0c8cfdcfed64e
|
data/lib/plugin/plugin.rb
CHANGED
@@ -7,6 +7,7 @@ module RubyRaider
|
|
7
7
|
module Plugin
|
8
8
|
class << self
|
9
9
|
def add_plugin(plugin_name)
|
10
|
+
return gemfile_guard unless File.exist?('Gemfile')
|
10
11
|
return pp 'The plugin was not found' unless available?(plugin_name)
|
11
12
|
return pp 'The plugin is already installed' if installed?(plugin_name)
|
12
13
|
|
@@ -28,6 +29,8 @@ module RubyRaider
|
|
28
29
|
end
|
29
30
|
|
30
31
|
def installed_plugins
|
32
|
+
return gemfile_guard unless File.exist?('Gemfile')
|
33
|
+
|
31
34
|
parsed_gemfile = File.readlines('Gemfile').map { |line| line.sub('gem ', '').strip.delete("'") }
|
32
35
|
parsed_gemfile.select { |line| plugins.include?(line) }
|
33
36
|
end
|
@@ -51,6 +54,8 @@ module RubyRaider
|
|
51
54
|
private
|
52
55
|
|
53
56
|
def add_plugin_to_gemfile(plugin_name)
|
57
|
+
return gemfile_guard unless File.exist?('Gemfile')
|
58
|
+
|
54
59
|
File.open('Gemfile', 'a') do |file|
|
55
60
|
file.puts "\n# Ruby Raider Plugins\n" unless comment_present?
|
56
61
|
file.puts "gem '#{plugin_name}'" unless plugin_present?(plugin_name)
|
@@ -67,6 +72,8 @@ module RubyRaider
|
|
67
72
|
end
|
68
73
|
|
69
74
|
def read_gemfile
|
75
|
+
return gemfile_guard unless File.exist?('Gemfile')
|
76
|
+
|
70
77
|
File.readlines('Gemfile')
|
71
78
|
end
|
72
79
|
|
@@ -86,10 +93,16 @@ module RubyRaider
|
|
86
93
|
|
87
94
|
# :reek:NestedIterators { enabled: false }
|
88
95
|
def update_gemfile(output_lines)
|
96
|
+
return gemfile_guard unless File.exist?('Gemfile')
|
97
|
+
|
89
98
|
File.open('Gemfile', 'w') do |file|
|
90
99
|
output_lines.each { |line| file.puts line }
|
91
100
|
end
|
92
101
|
end
|
102
|
+
|
103
|
+
def gemfile_guard
|
104
|
+
pp 'There is no Gemfile, please create one to install plugins'
|
105
|
+
end
|
93
106
|
end
|
94
107
|
end
|
95
108
|
end
|
data/lib/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.3
|