Module: Devtools

Extended by:
Platform
Defined in:
lib/devtools.rb,
lib/devtools/site.rb,
lib/devtools/config.rb,
lib/devtools/project.rb,
lib/devtools/platform.rb,
lib/devtools/site/initializer.rb,
lib/devtools/project/initializer.rb,
lib/devtools/project/initializer/rake.rb,
lib/devtools/project/initializer/rspec.rb

Overview

Provides access to metric tools

Defined Under Namespace

Modules: Platform Classes: Config, Project, Site

Constant Summary collapse

ROOT =
Pathname.new(__FILE__).parent.parent.freeze
PROJECT_ROOT =
Pathname.pwd.freeze
SHARED_PATH =
ROOT.join('shared').freeze
SHARED_SPEC_PATH =
SHARED_PATH.join('spec').freeze
DEFAULT_CONFIG_PATH =
ROOT.join('default/config').freeze
RAKE_FILES_GLOB =
ROOT.join('tasks/**/*.rake').to_s.freeze
LIB_DIRECTORY_NAME =
'lib'.freeze
SPEC_DIRECTORY_NAME =
'spec'.freeze
RB_FILE_PATTERN =
'**/*.rb'.freeze
RAKE_FILE_NAME =
'Rakefile'.freeze
REQUIRE =
"require 'devtools'".freeze
INIT_RAKE_TASKS =
'Devtools.init_rake_tasks'.freeze
SHARED_SPEC_PATTERN =
'{shared,support}/**/*.rb'.freeze
UNIT_TEST_PATH_REGEXP =
%r{\bspec/unit/}.freeze
DEFAULT_CONFIG_DIR_NAME =
'config'.freeze
ANNOTATION_WRAPPER =
"\n# Added by devtools\n%s\n".freeze
SITE =

Provides devtools for a project

Site.new(Project.new(PROJECT_ROOT))

Constants included from Platform

Platform::DEFAULT_RVM_NAME

Class Method Summary collapse

Methods included from Platform

jit?, jruby?, rbx?, ruby18?, ruby19?, ruby20?, ruby_engine, rvm, rvm_name

Class Method Details

.ci?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Detect ci

Returns:

  • (Boolean)


119
120
121
# File 'lib/devtools.rb', line 119

def self.ci?
  ENV.key?('CI')
end

.circle_ci?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Detect circle ci

Returns:

  • (Boolean)


129
130
131
# File 'lib/devtools.rb', line 129

def self.circle_ci?
  ENV.key?('CIRCLECI')
end

.initundefined

Initialize devtools using default config

Returns:

  • (undefined)


83
84
85
86
# File 'lib/devtools.rb', line 83

def self.init
  SITE.init
  self
end

.init_rake_tasksself

Initialize project and load tasks

Should only be called from your $application_root/Rakefile

Returns:

  • (self)


61
62
63
64
# File 'lib/devtools.rb', line 61

def self.init_rake_tasks
  Project::Initializer::Rake.call
  self
end

.init_spec_helperself

Initialize project and load shared specs

Expects to be called from $application_root/spec/spec_helper.rb

Returns:

  • (self)


73
74
75
76
# File 'lib/devtools.rb', line 73

def self.init_spec_helper
  SITE.init_spec_helper
  self
end

.notify_metric_violation(msg) ⇒ undefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

React to metric violation

Parameters:

  • msg (String)

Returns:

  • (undefined)


50
51
52
# File 'lib/devtools.rb', line 50

def self.notify_metric_violation(msg)
  abort(msg)
end

.projectProject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return project

Returns:



93
94
95
# File 'lib/devtools.rb', line 93

def self.project
  SITE.project
end

.require_files(dir, pattern) ⇒ self

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Require shared examples

Parameters:

  • dir (Pathname)

    the directory containing the files to require

  • pattern (String)

    the file pattern to match inside directory

Returns:

  • (self)


108
109
110
111
# File 'lib/devtools.rb', line 108

def self.require_files(dir, pattern)
  Dir[dir.join(pattern)].each { |file| require file }
  self
end

.travis?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Detect travis ci

Returns:

  • (Boolean)


139
140
141
# File 'lib/devtools.rb', line 139

def self.travis?
  ENV.key?('TRAVIS')
end