Module: PigCI
- Extended by:
- PigCI
- Included in:
- PigCI
- Defined in:
- lib/pig_ci.rb,
lib/pig_ci/version.rb
Defined Under Namespace
Classes: Api, Decorator, Metric, Profiler, ProfilerEngine, Report, Summary
Constant Summary
collapse
- VERSION =
'0.1.5'.freeze
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#api_base_uri ⇒ Object
91
92
93
|
# File 'lib/pig_ci.rb', line 91
def api_base_uri
@api_base_uri || 'https://api.pigci.com/api'
end
|
#api_key ⇒ Object
Returns the value of attribute api_key
100
101
102
|
# File 'lib/pig_ci.rb', line 100
def api_key
@api_key
end
|
#api_verify_ssl ⇒ Object
Returns the value of attribute api_verify_ssl
95
96
97
|
# File 'lib/pig_ci.rb', line 95
def api_verify_ssl
@api_verify_ssl
end
|
#commit_sha1 ⇒ Object
106
107
108
|
# File 'lib/pig_ci.rb', line 106
def commit_sha1
@commit_sha1 || ENV['CI_COMMIT_ID'] || ENV['CIRCLE_SHA1'] || ENV['TRAVIS_COMMIT'] || `git rev-parse HEAD`.strip
end
|
#during_setup_eager_load_application=(value) ⇒ Object
Sets the attribute during_setup_eager_load_application
49
50
51
|
# File 'lib/pig_ci.rb', line 49
def during_setup_eager_load_application=(value)
@during_setup_eager_load_application = value
end
|
#during_setup_make_blank_application_request=(value) ⇒ Object
Sets the attribute during_setup_make_blank_application_request
54
55
56
|
# File 'lib/pig_ci.rb', line 54
def during_setup_make_blank_application_request=(value)
@during_setup_make_blank_application_request = value
end
|
#during_setup_precompile_assets=(value) ⇒ Object
Sets the attribute during_setup_precompile_assets
59
60
61
|
# File 'lib/pig_ci.rb', line 59
def during_setup_precompile_assets=(value)
@during_setup_precompile_assets = value
end
|
#generate_html_summary ⇒ Object
Returns the value of attribute generate_html_summary
34
35
36
|
# File 'lib/pig_ci.rb', line 34
def generate_html_summary
@generate_html_summary
end
|
#generate_terminal_summary ⇒ Object
Returns the value of attribute generate_terminal_summary
29
30
31
|
# File 'lib/pig_ci.rb', line 29
def generate_terminal_summary
@generate_terminal_summary
end
|
#head_branch ⇒ Object
111
112
113
|
# File 'lib/pig_ci.rb', line 111
def head_branch
@head_branch || ENV['CI_BRANCH'] || ENV['CIRCLE_BRANCH'] || ENV['TRAVIS_BRANCH'] || `git rev-parse --abbrev-ref HEAD`.strip
end
|
#historical_data_run_limit ⇒ Object
76
77
78
|
# File 'lib/pig_ci.rb', line 76
def historical_data_run_limit
@historical_data_run_limit ||= 10
end
|
#locale ⇒ Object
116
117
118
|
# File 'lib/pig_ci.rb', line 116
def locale
@locale || :en
end
|
#max_change_percentage_precision ⇒ Object
40
41
42
|
# File 'lib/pig_ci.rb', line 40
def max_change_percentage_precision
@max_change_percentage_precision || 1
end
|
#output_directory ⇒ Object
25
26
27
|
# File 'lib/pig_ci.rb', line 25
def output_directory
@output_directory || Pathname.new(Dir.getwd).join('pig-ci')
end
|
#pid ⇒ Object
Returns the value of attribute pid
17
18
19
|
# File 'lib/pig_ci.rb', line 17
def pid
@pid
end
|
#profiler_engine ⇒ Object
#report_memory_precision ⇒ Object
45
46
47
|
# File 'lib/pig_ci.rb', line 45
def report_memory_precision
@report_memory_precision || 2
end
|
#report_row_sort_by(data) ⇒ Object
71
72
73
|
# File 'lib/pig_ci.rb', line 71
def report_row_sort_by(data)
(@report_row_sort_by || proc { |d| d[:max].to_i * -1 }).call(data)
end
|
#run_timestamp ⇒ Object
81
82
83
|
# File 'lib/pig_ci.rb', line 81
def run_timestamp
@run_timestamp ||= Time.now.to_i.to_s
end
|
#terminal_report_row_limit ⇒ Object
65
66
67
|
# File 'lib/pig_ci.rb', line 65
def terminal_report_row_limit
@terminal_report_row_limit || -1
end
|
#tmp_directory ⇒ Object
20
21
22
|
# File 'lib/pig_ci.rb', line 20
def tmp_directory
@tmp_directory || Pathname.new(Dir.getwd).join('tmp', 'pig-ci')
end
|
Class Method Details
.load_i18ns! ⇒ Object
138
139
140
141
|
# File 'lib/pig_ci.rb', line 138
def load_i18ns!
I18n.available_locales << PigCI.locale
I18n.load_path += Dir["#{File.expand_path('../config/locales/pig_ci', __dir__)}/*.{rb,yml}"]
end
|
.run_exit_tasks! ⇒ Object
.start(&block) ⇒ Object
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
# File 'lib/pig_ci.rb', line 122
def start(&block)
self.pid = Process.pid
block.call(self) if block_given?
load_i18ns!
Dir.mkdir(tmp_directory) unless File.exist?(tmp_directory)
Dir.mkdir(output_directory) unless File.exist?(output_directory)
profiler_engine.setup!
end
|
Instance Method Details
#api_key? ⇒ Boolean
101
102
103
|
# File 'lib/pig_ci.rb', line 101
def api_key?
!@api_key.nil? && @api_key != ''
end
|
#api_verify_ssl? ⇒ Boolean
96
97
98
|
# File 'lib/pig_ci.rb', line 96
def api_verify_ssl?
!@api_verify_ssl.nil? ? @api_verify_ssl : true
end
|
#during_setup_eager_load_application? ⇒ Boolean
50
51
52
|
# File 'lib/pig_ci.rb', line 50
def during_setup_eager_load_application?
@during_setup_eager_load_application.nil? || @during_setup_eager_load_application
end
|
#during_setup_make_blank_application_request? ⇒ Boolean
55
56
57
|
# File 'lib/pig_ci.rb', line 55
def during_setup_make_blank_application_request?
@during_setup_make_blank_application_request.nil? || @during_setup_make_blank_application_request
end
|
#during_setup_precompile_assets? ⇒ Boolean
60
61
62
|
# File 'lib/pig_ci.rb', line 60
def during_setup_precompile_assets?
@during_setup_precompile_assets.nil? || @during_setup_precompile_assets
end
|
#generate_html_summary? ⇒ Boolean
35
36
37
|
# File 'lib/pig_ci.rb', line 35
def generate_html_summary?
@generate_html_summary.nil? || @generate_html_summary
end
|
#generate_terminal_summary? ⇒ Boolean
30
31
32
|
# File 'lib/pig_ci.rb', line 30
def generate_terminal_summary?
@generate_terminal_summary.nil? || @generate_terminal_summary
end
|