class Commitment::InstallGenerator

Public Instance Methods

build_default_rake_task() click to toggle source
# File lib/commitment/generators/install_generator.rb, line 26
    def build_default_rake_task
      append_file('Rakefile') do %(
# BEGIN `commitment:install` generator
# This was added via commitment:install generator. You are free to change this.
Rake::Task["default"].clear
task(
  default: [
    'commitment:rubocop',
    'commitment:jshint',
    'commitment:fasterer',
    'commitment:scss_lint',
    'commitment:configure_test_for_code_coverage',
    '#{test_framework}',
    'commitment:code_coverage',
    'commitment:brakeman'
  ]
)
# END `commitment:install` generator
)
      end
    end
create_coverage_helper() click to toggle source
# File lib/commitment/generators/install_generator.rb, line 21
def create_coverage_helper
  # Putting this file in the root directory of the project
  template('coverage_helper.rb', "#{test_framework}/coverage_helper.rb")
end
create_fasterer() click to toggle source
# File lib/commitment/generators/install_generator.rb, line 17
def create_fasterer
  template('.fasterer.yml', '.fasterer.yml')
end
create_hound_options() click to toggle source
# File lib/commitment/generators/install_generator.rb, line 9
def create_hound_options
  template('.hound.yml', '.hound.yml')
end
create_jshint_options() click to toggle source
# File lib/commitment/generators/install_generator.rb, line 5
def create_jshint_options
  template('.jshintrc', '.jshintrc')
end
create_scss_lint() click to toggle source
# File lib/commitment/generators/install_generator.rb, line 13
def create_scss_lint
  template('.scss_lint.yml', '.scss_lint.yml')
end
inject_spec_helper() click to toggle source
# File lib/commitment/generators/install_generator.rb, line 48
def inject_spec_helper
  prepend_file("#{test_framework}/#{test_framework}_helper.rb", "require 'coverage_helper'\n")
end

Private Instance Methods

test_framework() click to toggle source
# File lib/commitment/generators/install_generator.rb, line 54
def test_framework
  return 'spec' if Rails.configuration.generators.options.fetch(:rails).fetch(:test_framework) == :rspec
  'test'
rescue NoMethodError, KeyError
  'test'
end