Module: Develry

Extended by:
Platform
Defined in:
lib/develry.rb,
lib/develry/site.rb,
lib/develry/config.rb,
lib/develry/project.rb,
lib/develry/platform.rb,
lib/develry/site/initializer.rb,
lib/develry/project/initializer.rb,
lib/develry/project/initializer/rake.rb,
lib/develry/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
SHARED_GEMFILE_PATH =
SHARED_PATH.join('Gemfile').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
DEFAULT_GEMFILE_NAME =
'Gemfile'.freeze
GEMFILE_NAME =
'Gemfile.develry'.freeze
EVAL_GEMFILE =
"eval_gemfile '#{GEMFILE_NAME}'".freeze
BUNDLE_UPDATE =
'bundle update'.freeze
REQUIRE =
"require 'develry'".freeze
INIT_RAKE_TASKS =
'Develry.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 develry\n%s".freeze
SITE =

Provides develry for a project

Site.new(Project.new(PROJECT_ROOT))
MASTER_BRANCH =
'master'.freeze

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

.fail_on_branchArray[String]

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 the branches the build should fail on because of metrics

Returns:

  • (Array[String])


150
151
152
# File 'lib/develry.rb', line 150

def self.fail_on_branch
  project.develry.fail_on_branch
end

.fail_on_current_branch?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.

Test if the build should fail because of metrics on this branch

Returns:

  • (Boolean)


141
142
143
# File 'lib/develry.rb', line 141

def self.fail_on_current_branch?
  fail_on_branch.include?(current_branch)
end

.initundefined

Initialize develry using default config

Returns:

  • (undefined)


77
78
79
80
# File 'lib/develry.rb', line 77

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)


55
56
57
58
# File 'lib/develry.rb', line 55

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)


67
68
69
70
# File 'lib/develry.rb', line 67

def self.init_spec_helper
  SITE.init_spec_helper
  self
end

.notify(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.

Notify or abort depending on the branch

Parameters:

  • msg (String)

Returns:

  • (undefined)


132
133
134
# File 'lib/develry.rb', line 132

def self.notify(msg)
  fail_on_current_branch? ? abort(msg) : puts(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:



105
106
107
# File 'lib/develry.rb', line 105

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)


120
121
122
123
# File 'lib/develry.rb', line 120

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

.syncundefined

Sync Gemfile.develry

Returns:

  • (undefined)


87
88
89
# File 'lib/develry.rb', line 87

def self.sync
  SITE.sync
end

.updateundefined

Sync Gemfile.develry and run bundle update

Returns:

  • (undefined)


96
97
98
# File 'lib/develry.rb', line 96

def self.update
  SITE.update
end