Class: PolishGeeks::DevTools::Commands::Gemfile
- Defined in:
- lib/polish_geeks/dev_tools/commands/gemfile.rb
Overview
Checks if Gemfile contains local gems
Constant Summary collapse
- CHECKED_REGEXP =
Regex which check if Gemfile has local gem ex:
gem 'example_gem', path: '/Users/Projects/gems/example_gem' gem 'example_gem', :path => '/Users/Projects/gems/example_gem'
/^[^#]*((\bpath:)|(:path[ \t]*=>))/
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#error_message ⇒ String
Message with local gems.
-
#execute ⇒ Object
Executes this command.
-
#label ⇒ String
Label with this validator description.
-
#valid? ⇒ Boolean
True if output doesn’t contain any local gems.
Methods inherited from Base
Instance Method Details
#error_message ⇒ String
Returns message with local gems.
28 29 30 |
# File 'lib/polish_geeks/dev_tools/commands/gemfile.rb', line 28 def "Gemfile contains gems from local path: \n#{output.join('')}" end |
#execute ⇒ Object
Executes this command
15 16 17 18 19 20 |
# File 'lib/polish_geeks/dev_tools/commands/gemfile.rb', line 15 def execute @output = [] gemfile = File.join(::PolishGeeks::DevTools.app_root, 'Gemfile') return unless File.exist?(gemfile) @output = IO.readlines(gemfile).select { |l| l.match(CHECKED_REGEXP) } end |
#label ⇒ String
Returns label with this validator description.
23 24 25 |
# File 'lib/polish_geeks/dev_tools/commands/gemfile.rb', line 23 def label 'Gemfile checking' end |
#valid? ⇒ Boolean
Returns true if output doesn’t contain any local gems.
33 34 35 |
# File 'lib/polish_geeks/dev_tools/commands/gemfile.rb', line 33 def valid? @output.empty? end |