Move travis-core files from /vendor to /lib.
- Re-factor - Remove code for notifications - Remove addons - Remove travis-core gem. - Ignore logs directory only - Move core tests to spec/lib
This commit is contained in:
parent
cb89cae39f
commit
c6a1eda572
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -4,10 +4,7 @@ config/nginx.conf
|
||||||
config/skylight.yml
|
config/skylight.yml
|
||||||
|
|
||||||
tmp/
|
tmp/
|
||||||
log/
|
|
||||||
logs/
|
logs/
|
||||||
!vendor/travis-core/lib/travis/logs/
|
|
||||||
!vendor/travis-core/lib/travis/model/log/
|
|
||||||
|
|
||||||
.yardoc
|
.yardoc
|
||||||
.coverage
|
.coverage
|
||||||
|
|
1
Gemfile
1
Gemfile
|
@ -3,7 +3,6 @@ gemspec
|
||||||
|
|
||||||
gem 's3', github: 'travis-ci/s3'
|
gem 's3', github: 'travis-ci/s3'
|
||||||
|
|
||||||
gem 'travis-core', path: 'vendor/travis-core'
|
|
||||||
gem 'travis-support', github: 'travis-ci/travis-support'
|
gem 'travis-support', github: 'travis-ci/travis-support'
|
||||||
gem 'travis-amqp', github: 'travis-ci/travis-amqp'
|
gem 'travis-amqp', github: 'travis-ci/travis-amqp'
|
||||||
gem 'travis-config', '~> 0.1.0'
|
gem 'travis-config', '~> 0.1.0'
|
||||||
|
|
27
Gemfile.lock
27
Gemfile.lock
|
@ -101,29 +101,6 @@ PATH
|
||||||
useragent
|
useragent
|
||||||
virtus (~> 1.0.0)
|
virtus (~> 1.0.0)
|
||||||
|
|
||||||
PATH
|
|
||||||
remote: vendor/travis-core
|
|
||||||
specs:
|
|
||||||
travis-core (0.0.1)
|
|
||||||
activerecord (~> 3.2.19)
|
|
||||||
coder (~> 0.4.0)
|
|
||||||
data_migrations (~> 0.0.1)
|
|
||||||
gh
|
|
||||||
google-api-client (~> 0.9.4)
|
|
||||||
hashr
|
|
||||||
metriks (~> 0.9.7)
|
|
||||||
multi_json
|
|
||||||
pusher (~> 0.14.0)
|
|
||||||
railties (~> 3.2.19)
|
|
||||||
rake
|
|
||||||
redis (~> 3.0)
|
|
||||||
rollout (~> 1.1.0)
|
|
||||||
s3 (~> 0.3)
|
|
||||||
simple_states (~> 1.0.0)
|
|
||||||
thor
|
|
||||||
travis-config (~> 0.1.0)
|
|
||||||
virtus (~> 1.0.0)
|
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
|
@ -172,9 +149,6 @@ GEM
|
||||||
customerio (1.0.0)
|
customerio (1.0.0)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
dalli (2.7.6)
|
dalli (2.7.6)
|
||||||
data_migrations (0.0.1)
|
|
||||||
activerecord
|
|
||||||
rake
|
|
||||||
database_cleaner (0.8.0)
|
database_cleaner (0.8.0)
|
||||||
descendants_tracker (0.0.4)
|
descendants_tracker (0.0.4)
|
||||||
thread_safe (~> 0.3, >= 0.3.1)
|
thread_safe (~> 0.3, >= 0.3.1)
|
||||||
|
@ -412,7 +386,6 @@ DEPENDENCIES
|
||||||
travis-amqp!
|
travis-amqp!
|
||||||
travis-api!
|
travis-api!
|
||||||
travis-config (~> 0.1.0)
|
travis-config (~> 0.1.0)
|
||||||
travis-core!
|
|
||||||
travis-migrations!
|
travis-migrations!
|
||||||
travis-settings!
|
travis-settings!
|
||||||
travis-sidekiqs!
|
travis-sidekiqs!
|
||||||
|
|
12
Rakefile
12
Rakefile
|
@ -18,7 +18,7 @@ end
|
||||||
# t.pattern = 'spec_core/**{,/*/**}/*_spec.rb'
|
# t.pattern = 'spec_core/**{,/*/**}/*_spec.rb'
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# task :default => [:spec, :spec_core]
|
# task :default => [:spec]
|
||||||
# rescue LoadError => e
|
# rescue LoadError => e
|
||||||
# puts e.inspect
|
# puts e.inspect
|
||||||
# end
|
# end
|
||||||
|
@ -27,18 +27,8 @@ end
|
||||||
namespace :spec do
|
namespace :spec do
|
||||||
desc 'Run all specs'
|
desc 'Run all specs'
|
||||||
task :all do
|
task :all do
|
||||||
sh 'bundle exec rspec -r spec_helper spec spec_core'
|
|
||||||
end
|
|
||||||
|
|
||||||
desc 'Run api specs'
|
|
||||||
task :api do
|
|
||||||
sh 'bundle exec rspec -r spec_helper spec'
|
sh 'bundle exec rspec -r spec_helper spec'
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'Run core specs'
|
|
||||||
task :core do
|
|
||||||
sh 'bundle exec rspec -r spec_helper spec_core'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
task :default => :'spec:all'
|
task :default => :'spec:all'
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
require 'pusher'
|
require 'pusher'
|
||||||
require 'travis/support'
|
require 'travis/support'
|
||||||
require 'travis/support/database'
|
require 'travis/support/database'
|
||||||
require 'travis/version'
|
|
||||||
require 'travis/redis_pool'
|
require 'travis/redis_pool'
|
||||||
require 'travis/errors'
|
require 'travis/errors'
|
||||||
|
|
||||||
|
@ -19,7 +18,6 @@ module Travis
|
||||||
require 'travis/model'
|
require 'travis/model'
|
||||||
require 'travis/task'
|
require 'travis/task'
|
||||||
require 'travis/event'
|
require 'travis/event'
|
||||||
require 'travis/addons'
|
|
||||||
require 'travis/api/serialize'
|
require 'travis/api/serialize'
|
||||||
require 'travis/config/defaults'
|
require 'travis/config/defaults'
|
||||||
require 'travis/features'
|
require 'travis/features'
|
||||||
|
@ -43,7 +41,6 @@ module Travis
|
||||||
Travis.logger.info('Setting up Travis::Core')
|
Travis.logger.info('Setting up Travis::Core')
|
||||||
|
|
||||||
Github.setup
|
Github.setup
|
||||||
Addons.register
|
|
||||||
Services.register
|
Services.register
|
||||||
Github::Services.register
|
Github::Services.register
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@ module Travis
|
||||||
GH.set(
|
GH.set(
|
||||||
client_id: Travis.config.oauth2.client_id,
|
client_id: Travis.config.oauth2.client_id,
|
||||||
client_secret: Travis.config.oauth2.client_secret,
|
client_secret: Travis.config.oauth2.client_secret,
|
||||||
user_agent: "Travis-CI/#{Travis::VERSION} GH/#{GH::VERSION}",
|
user_agent: "GH/#{GH::VERSION}",
|
||||||
origin: Travis.config.host,
|
origin: Travis.config.host,
|
||||||
api_url: Travis.config.github.api_url,
|
api_url: Travis.config.github.api_url,
|
||||||
ssl: Travis.config.ssl.to_h.merge(Travis.config.github.ssl || {}).to_h.compact
|
ssl: Travis.config.ssl.to_h.merge(Travis.config.github.ssl || {}).to_h.compact
|
|
@ -28,21 +28,21 @@ class Build
|
||||||
event :finish, to: :finished, if: :should_finish?
|
event :finish, to: :finished, if: :should_finish?
|
||||||
event :reset, to: :created
|
event :reset, to: :created
|
||||||
event :cancel, to: :canceled, if: :cancelable?
|
event :cancel, to: :canceled, if: :cancelable?
|
||||||
event :all, after: [:denormalize, :notify]
|
event :all, after: [:denormalize]
|
||||||
end
|
end
|
||||||
|
|
||||||
def should_finish?
|
def should_finish?
|
||||||
matrix_finished? && !finished?
|
matrix_finished? && !finished?
|
||||||
end
|
end
|
||||||
|
#TODO remove?
|
||||||
def receive(data = {})
|
def receive(data = {})
|
||||||
self.received_at = data[:received_at]
|
self.received_at = data[:received_at]
|
||||||
end
|
end
|
||||||
|
#TODO remove?
|
||||||
def start(data = {})
|
def start(data = {})
|
||||||
self.started_at = data[:started_at]
|
self.started_at = data[:started_at]
|
||||||
end
|
end
|
||||||
|
#TODO remove?
|
||||||
def finish(data = {})
|
def finish(data = {})
|
||||||
self.state = matrix_state
|
self.state = matrix_state
|
||||||
self.duration = matrix_duration
|
self.duration = matrix_duration
|
||||||
|
@ -50,7 +50,7 @@ class Build
|
||||||
|
|
||||||
save!
|
save!
|
||||||
end
|
end
|
||||||
|
#TODO remove?
|
||||||
def cancel(options = {})
|
def cancel(options = {})
|
||||||
matrix.each do |job|
|
matrix.each do |job|
|
||||||
job.cancel!
|
job.cancel!
|
|
@ -21,11 +21,10 @@ class Job
|
||||||
event :finish, to: :finished
|
event :finish, to: :finished
|
||||||
event :reset, to: :created, unless: :created?
|
event :reset, to: :created, unless: :created?
|
||||||
event :cancel, to: :canceled, if: :cancelable?
|
event :cancel, to: :canceled, if: :cancelable?
|
||||||
event :all, after: [:propagate, :notify]
|
event :all, after: [:propagate]
|
||||||
|
|
||||||
def enqueue # TODO rename to queue and make it an event, simple_states should support that now
|
def enqueue # TODO rename to queue and make it an event, simple_states should support that now
|
||||||
update_attributes!(state: :queued, queued_at: Time.now.utc)
|
update_attributes!(state: :queued, queued_at: Time.now.utc)
|
||||||
notify(:queue)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def receive(data = {})
|
def receive(data = {})
|
||||||
|
@ -95,13 +94,6 @@ class Job
|
||||||
state == nil
|
state == nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify(event, *args)
|
|
||||||
Metriks.timer("job.notify.#{event}").time do
|
|
||||||
event = :create if event == :reset
|
|
||||||
super
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
delegate :id, :content, :to => :log, :prefix => true, :allow_nil => true
|
delegate :id, :content, :to => :log, :prefix => true, :allow_nil => true
|
||||||
end
|
end
|
||||||
end
|
end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user