2014-01-07 19:40:26 +00:00
|
|
|
JAMKAZAM_TESTING_BUCKET = 'jamkazam-testing' # cuz i'm not comfortable using aws_bucket accessor directly
|
2013-12-17 19:44:21 +00:00
|
|
|
|
|
|
|
|
def app_config
|
|
|
|
|
klass = Class.new do
|
2014-04-09 21:11:13 +00:00
|
|
|
|
2015-04-23 15:34:17 +00:00
|
|
|
def admin_root_url
|
|
|
|
|
'http://localhost:3333'
|
|
|
|
|
end
|
|
|
|
|
|
2021-01-09 22:15:56 +00:00
|
|
|
def elasticsearch_host
|
|
|
|
|
"http://support.jamkazam.com:9200"
|
|
|
|
|
end
|
2016-04-26 03:01:15 +00:00
|
|
|
def email_partners_alias
|
|
|
|
|
'partners@jamkazam.com'
|
|
|
|
|
end
|
|
|
|
|
|
2015-10-08 02:12:26 +00:00
|
|
|
def email_social_alias
|
|
|
|
|
'social@jamkazam.com'
|
|
|
|
|
end
|
|
|
|
|
|
2015-04-10 20:19:08 +00:00
|
|
|
def email_alerts_alias
|
|
|
|
|
'alerts@jamkazam.com'
|
|
|
|
|
end
|
|
|
|
|
|
2018-03-18 21:41:40 +00:00
|
|
|
def email_support_alias
|
|
|
|
|
'support@jamkazam.com'
|
|
|
|
|
end
|
|
|
|
|
|
2020-05-27 04:19:50 +00:00
|
|
|
def bugs_alias
|
|
|
|
|
'bugs@jamkazam.com'
|
|
|
|
|
end
|
2017-07-10 02:21:29 +00:00
|
|
|
def email_jamclass_alerts_alias
|
|
|
|
|
'jamclass-alerts@jamkazam.com'
|
|
|
|
|
end
|
|
|
|
|
|
2020-05-27 04:19:50 +00:00
|
|
|
|
2016-01-04 04:13:01 +00:00
|
|
|
def email_crashes_alias
|
|
|
|
|
'clientcrash@jamkazam.com'
|
2018-03-18 21:41:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def email_support_alias
|
|
|
|
|
'support-dev@jamkazam.com'
|
2016-01-04 04:13:01 +00:00
|
|
|
end
|
|
|
|
|
|
2015-04-22 20:43:36 +00:00
|
|
|
def email_recurly_notice
|
|
|
|
|
'recurly-alerts@jamkazam.com'
|
|
|
|
|
end
|
|
|
|
|
|
2015-04-10 20:19:08 +00:00
|
|
|
def email_generic_from
|
|
|
|
|
'nobody@jamkazam.com'
|
|
|
|
|
end
|
|
|
|
|
|
2013-12-17 19:44:21 +00:00
|
|
|
def aws_bucket
|
2014-04-09 21:11:13 +00:00
|
|
|
JAMKAZAM_TESTING_BUCKET
|
2013-12-17 19:44:21 +00:00
|
|
|
end
|
|
|
|
|
|
2015-03-09 14:44:12 +00:00
|
|
|
def aws_bucket_jamtracks
|
|
|
|
|
'jamkazam-jamtracks-test'
|
|
|
|
|
end
|
|
|
|
|
|
2013-12-17 19:44:21 +00:00
|
|
|
def aws_access_key_id
|
|
|
|
|
'AKIAJESQY24TOT542UHQ'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def aws_secret_access_key
|
|
|
|
|
'h0V0ffr3JOp/UtgaGrRfAk25KHNiO9gm8Pj9m6v3'
|
|
|
|
|
end
|
2014-01-08 22:55:44 +00:00
|
|
|
|
2014-04-09 21:11:13 +00:00
|
|
|
def aws_region
|
|
|
|
|
'us-east-1'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def aws_bucket_public
|
|
|
|
|
'jamkazam-testing-public'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def aws_cache
|
|
|
|
|
'315576000'
|
|
|
|
|
end
|
|
|
|
|
|
2016-01-04 19:42:11 +00:00
|
|
|
def verify_email_enabled
|
|
|
|
|
false
|
|
|
|
|
end
|
|
|
|
|
|
2014-01-08 22:55:44 +00:00
|
|
|
def audiomixer_path
|
|
|
|
|
# you can specify full path to audiomixer with AUDIOMIXER_PATH env variable...
|
|
|
|
|
# or we check for audiomixer path in the user's workspace
|
|
|
|
|
# and finally the debian install path
|
|
|
|
|
ENV['AUDIOMIXER_PATH'] || audiomixer_workspace_path || "/var/lib/audiomixer/audiomixer/audiomixerapp"
|
|
|
|
|
end
|
|
|
|
|
|
2014-02-04 20:28:00 +00:00
|
|
|
def ffmpeg_path
|
|
|
|
|
ENV['FFMPEG_PATH'] || '/usr/local/bin/ffmpeg'
|
|
|
|
|
end
|
|
|
|
|
|
2014-10-29 16:28:13 +00:00
|
|
|
def normalize_ogg_path
|
|
|
|
|
ENV['NORMALIZE_OGG_PATH'] || '/usr/local/bin/normalize-ogg'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def normalize_mp3_path
|
|
|
|
|
ENV['NORMALIZE_MP3_PATH'] || '/usr/local/bin/normalize-mp3'
|
|
|
|
|
end
|
|
|
|
|
|
2014-01-19 02:20:44 +00:00
|
|
|
def icecast_reload_cmd
|
|
|
|
|
'true' # as in, /bin/true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def icecast_config_file
|
|
|
|
|
Dir::Tmpname.make_tmpname(["#{Dir.tmpdir}/icecast", 'xml'], nil)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def icecast_server_id
|
|
|
|
|
'test'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def icecast_max_missing_check
|
|
|
|
|
2 * 60 # 2 minutes
|
|
|
|
|
end
|
|
|
|
|
|
2014-01-21 14:51:03 +00:00
|
|
|
def icecast_max_sourced_changed
|
|
|
|
|
15 # 15 seconds
|
|
|
|
|
end
|
|
|
|
|
|
2014-01-25 22:48:24 +00:00
|
|
|
def icecast_hardcoded_source_password
|
|
|
|
|
nil # generate a new password everytime
|
|
|
|
|
end
|
|
|
|
|
|
2014-02-01 15:59:43 +00:00
|
|
|
def icecast_wait_after_reload
|
|
|
|
|
0 # 0 seconds
|
|
|
|
|
end
|
|
|
|
|
|
2014-12-29 21:05:19 +00:00
|
|
|
def jamtracks_dir
|
2015-01-03 04:06:03 +00:00
|
|
|
ENV['JAMTRACKS_DIR'] || File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "..", "jamtracks"))
|
2014-12-29 21:05:19 +00:00
|
|
|
end
|
|
|
|
|
|
2014-01-16 02:21:28 +00:00
|
|
|
def rabbitmq_host
|
|
|
|
|
"localhost"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def rabbitmq_port
|
|
|
|
|
5672
|
|
|
|
|
end
|
|
|
|
|
|
2014-02-07 21:28:47 +00:00
|
|
|
def external_hostname
|
|
|
|
|
'localhost'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def external_protocol
|
|
|
|
|
'http://'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def external_port
|
|
|
|
|
3000
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def external_root_url
|
|
|
|
|
"#{external_protocol}#{external_hostname}#{(external_port == 80 || external_port == 443) ? '' : ':' + external_port.to_s}"
|
|
|
|
|
end
|
|
|
|
|
|
2014-02-24 16:55:56 +00:00
|
|
|
def max_audio_downloads
|
|
|
|
|
100
|
|
|
|
|
end
|
|
|
|
|
|
2014-02-25 19:22:32 +00:00
|
|
|
def send_join_session_email_notifications
|
|
|
|
|
true
|
|
|
|
|
end
|
|
|
|
|
|
2014-07-14 20:53:04 +00:00
|
|
|
def max_mind_working_dir
|
|
|
|
|
'tmp'
|
|
|
|
|
end
|
2014-07-20 02:11:16 +00:00
|
|
|
|
|
|
|
|
def max_track_upload_failures
|
|
|
|
|
10
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def max_track_part_upload_failures
|
|
|
|
|
3
|
|
|
|
|
end
|
2014-08-01 01:16:38 +00:00
|
|
|
|
|
|
|
|
def max_good_full_score
|
2014-08-20 01:58:24 +00:00
|
|
|
40
|
2014-08-01 01:16:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def max_yellow_full_score
|
2014-08-20 01:58:24 +00:00
|
|
|
70
|
2014-08-01 01:16:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def max_red_full_score
|
2014-08-20 01:58:24 +00:00
|
|
|
100
|
2014-08-01 01:16:38 +00:00
|
|
|
end
|
|
|
|
|
|
2014-09-13 03:30:51 +00:00
|
|
|
def scoring_timeout_minutes
|
|
|
|
|
30
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def scoring_timeout_threshold
|
|
|
|
|
2 # don't put to 1; it'll break tests
|
|
|
|
|
end
|
|
|
|
|
|
2014-11-06 17:26:13 +00:00
|
|
|
def recordings_stale_time
|
|
|
|
|
7
|
|
|
|
|
end
|
|
|
|
|
|
2014-12-18 21:13:55 +00:00
|
|
|
def source_changes_missing_secs
|
|
|
|
|
1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def lock_connections
|
|
|
|
|
false
|
|
|
|
|
end
|
|
|
|
|
|
2015-04-16 19:45:29 +00:00
|
|
|
def signing_step_max_time
|
|
|
|
|
40 # 40 seconds
|
2015-01-09 17:23:20 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def signing_job_queue_max_time
|
2015-09-22 01:01:39 +00:00
|
|
|
600 # 20 seconds
|
2015-01-09 17:23:20 +00:00
|
|
|
end
|
|
|
|
|
|
2015-03-20 13:48:00 +00:00
|
|
|
def one_free_jamtrack_per_user
|
|
|
|
|
true
|
|
|
|
|
end
|
|
|
|
|
|
2015-04-12 06:18:31 +00:00
|
|
|
def secret_token
|
|
|
|
|
'foobar'
|
|
|
|
|
end
|
|
|
|
|
|
2015-04-14 19:12:24 +00:00
|
|
|
def unsubscribe_token
|
|
|
|
|
'blah'
|
|
|
|
|
end
|
2015-03-09 14:44:12 +00:00
|
|
|
|
2015-05-18 15:33:58 +00:00
|
|
|
def error_on_fraud
|
|
|
|
|
true
|
|
|
|
|
end
|
|
|
|
|
|
2015-05-20 14:24:17 +00:00
|
|
|
def expire_fingerprint_days
|
|
|
|
|
14
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def found_conflict_count
|
|
|
|
|
1
|
|
|
|
|
end
|
|
|
|
|
|
2015-07-15 15:04:45 +00:00
|
|
|
def google_public_server_key
|
|
|
|
|
"AIzaSyCPTPq5PEcl4XWcm7NZ2IGClZlbsiE8JNo"
|
|
|
|
|
end
|
|
|
|
|
|
2015-09-22 01:01:39 +00:00
|
|
|
def estimated_jam_track_time
|
|
|
|
|
40
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def estimated_fast_mixdown_time
|
|
|
|
|
30
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def estimated_slow_mixdown_time
|
|
|
|
|
80
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def num_packaging_nodes
|
|
|
|
|
2
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def signing_job_signing_max_time
|
|
|
|
|
300
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def mixdown_job_queue_max_time
|
|
|
|
|
600
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def mixdown_step_max_time
|
|
|
|
|
300
|
|
|
|
|
end
|
|
|
|
|
|
2015-10-23 19:42:51 +00:00
|
|
|
def download_tracker_day_range
|
|
|
|
|
30
|
|
|
|
|
end
|
|
|
|
|
|
2015-10-26 21:03:43 +00:00
|
|
|
def guard_against_browser_fraud
|
|
|
|
|
true
|
|
|
|
|
end
|
|
|
|
|
|
2016-04-06 02:23:15 +00:00
|
|
|
def minimum_lesson_booking_hrs
|
|
|
|
|
24
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def lesson_stay_time
|
|
|
|
|
10
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def wait_time_window_threshold
|
|
|
|
|
5
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def lesson_together_threshold_minutes
|
|
|
|
|
5
|
|
|
|
|
end
|
|
|
|
|
def lesson_join_time_window_minutes
|
|
|
|
|
5
|
|
|
|
|
end
|
|
|
|
|
def lesson_wait_time_window_minutes
|
|
|
|
|
10
|
|
|
|
|
end
|
|
|
|
|
def wait_time_window_pct
|
|
|
|
|
0.8
|
|
|
|
|
end
|
|
|
|
|
def end_of_wait_window_forgiveness_minutes
|
|
|
|
|
1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def test_drive_wait_period_year
|
|
|
|
|
1
|
|
|
|
|
end
|
|
|
|
|
|
2018-07-29 16:09:03 +00:00
|
|
|
def rating_dialog_min_num
|
|
|
|
|
1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def rating_dialog_min_time
|
|
|
|
|
false
|
|
|
|
|
end
|
|
|
|
|
|
2016-08-31 09:19:16 +00:00
|
|
|
def jam_class_card_wait_period_year
|
|
|
|
|
1
|
|
|
|
|
end
|
|
|
|
|
|
2020-05-12 01:45:32 +00:00
|
|
|
def max_invites_ever_per_sender
|
|
|
|
|
4
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def max_invites_per_day_per_sender
|
|
|
|
|
3
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def max_invites_to_receiver_per_day
|
|
|
|
|
1
|
|
|
|
|
end
|
|
|
|
|
|
2016-04-06 12:06:52 +00:00
|
|
|
def check_bounced_emails
|
|
|
|
|
false
|
|
|
|
|
end
|
2016-04-06 02:23:15 +00:00
|
|
|
def stripe
|
|
|
|
|
{
|
|
|
|
|
:publishable_key => 'pk_test_HLTvioRAxN3hr5fNfrztZeoX',
|
|
|
|
|
:secret_key => 'sk_test_OkjoIF7FmdjunyNsdVqJD02D',
|
2016-05-28 23:48:40 +00:00
|
|
|
:source_customer => 'cus_88Vp44SLnBWMXq', # seth@jamkazam.com in JamKazam-test account
|
2017-01-17 18:24:49 +00:00
|
|
|
:ach_pct => 0.008,
|
|
|
|
|
:charge_fee => 0.03
|
2016-04-06 02:23:15 +00:00
|
|
|
}
|
|
|
|
|
end
|
2016-06-02 14:04:56 +00:00
|
|
|
def musician_count
|
|
|
|
|
'40,000+'
|
|
|
|
|
end
|
2014-01-08 22:55:44 +00:00
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def audiomixer_workspace_path
|
|
|
|
|
if ENV['WORKSPACE']
|
|
|
|
|
dev_path = ENV['WORKSPACE']
|
|
|
|
|
else
|
|
|
|
|
dev_path = ENV['HOME']
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
dev_path = "#{dev_path}/audiomixer/audiomixer/audiomixerapp"
|
|
|
|
|
dev_path if File.exist? dev_path
|
|
|
|
|
end
|
2013-12-17 19:44:21 +00:00
|
|
|
end
|
|
|
|
|
|
2014-04-09 21:11:13 +00:00
|
|
|
klass.new
|
2014-01-07 19:40:26 +00:00
|
|
|
end
|
|
|
|
|
|
2014-01-11 04:57:07 +00:00
|
|
|
def run_tests? type
|
|
|
|
|
type = type.to_s.capitalize
|
|
|
|
|
|
|
|
|
|
ENV["RUN_#{type}_TESTS"] == "1" || ENV[type] == "1" || ENV['ALL_TESTS'] == "1"
|
|
|
|
|
end
|
|
|
|
|
|
2014-05-01 19:09:33 +00:00
|
|
|
# you have go out of your way to update 'updated_at '
|
|
|
|
|
def set_updated_at(resource, time)
|
|
|
|
|
begin
|
|
|
|
|
ActiveRecord::Base.record_timestamps = false
|
|
|
|
|
resource.updated_at = time
|
|
|
|
|
resource.save!(validate: false)
|
|
|
|
|
ensure
|
|
|
|
|
# very important to turn it back; it'll break all tests otherwise
|
|
|
|
|
ActiveRecord::Base.record_timestamps = true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2014-01-07 19:40:26 +00:00
|
|
|
def wipe_s3_test_bucket
|
2014-09-13 03:30:51 +00:00
|
|
|
begin
|
|
|
|
|
# don't bother if the user isn't doing AWS tests
|
|
|
|
|
if run_tests? :aws
|
|
|
|
|
test_config = app_config
|
|
|
|
|
s3 = AWS::S3.new(:access_key_id => test_config.aws_access_key_id,
|
|
|
|
|
:secret_access_key => test_config.aws_secret_access_key)
|
|
|
|
|
test_bucket = s3.buckets[JAMKAZAM_TESTING_BUCKET]
|
|
|
|
|
if test_bucket.name == JAMKAZAM_TESTING_BUCKET
|
|
|
|
|
test_bucket.objects.each do |obj|
|
|
|
|
|
obj.delete
|
|
|
|
|
end
|
2014-02-02 01:30:23 +00:00
|
|
|
end
|
2014-01-11 04:57:07 +00:00
|
|
|
end
|
2014-09-13 03:30:51 +00:00
|
|
|
rescue
|
|
|
|
|
puts "Unable to cleanup AWS"
|
2014-01-07 19:40:26 +00:00
|
|
|
end
|
2014-07-14 20:53:04 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# creates a maxmind 'GEO-124' zip file using the supplied CSV
|
|
|
|
|
def fake_geo_124_zip(geoisp_csv)
|
|
|
|
|
zipfile = Tempfile.new(['fake_geo_124', '.zip'])
|
|
|
|
|
|
|
|
|
|
Zip::File.open(Pathname.new(zipfile.path).realpath.to_s, Zip::File::CREATE) do |zipfile|
|
|
|
|
|
zipfile.add('fake_geo_124/GeoIPISP.csv', Pathname.new(geoisp_csv.path).realpath.to_s)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
zipfile
|
2014-08-01 21:17:04 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def friend(user1, user2)
|
|
|
|
|
FactoryGirl.create(:friendship, user: user1, friend: user2)
|
|
|
|
|
FactoryGirl.create(:friendship, user: user2, friend: user1)
|
2015-04-12 06:18:31 +00:00
|
|
|
end
|
2016-04-06 02:23:15 +00:00
|
|
|
|
|
|
|
|
def stripe_oauth_client
|
|
|
|
|
# from here in the JamKazam Test account: https://dashboard.stripe.com/account/applications/settings
|
|
|
|
|
client_id = "ca_88T6HlHg1NRyKFossgWIz1Tf431Jshft"
|
|
|
|
|
options = {
|
|
|
|
|
:site => 'https://connect.stripe.com',
|
|
|
|
|
:authorize_url => '/oauth/authorize',
|
|
|
|
|
:token_url => '/oauth/token'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@stripe_oauth_client ||= OAuth2::Client.new(client_id, APP_CONFIG.stripe[:publishable_key], options)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def stripe_account2_id
|
|
|
|
|
# seth+stripe+test1@jamkazam.com / jam12345
|
|
|
|
|
"acct_17sCNpDcwjPgpqRL"
|
|
|
|
|
end
|
|
|
|
|
def stripe_account1_id
|
|
|
|
|
# seth+stripe1@jamkazam.com / jam123
|
|
|
|
|
=begin
|
|
|
|
|
curl -X POST https://connect.stripe.com/oauth/token \
|
|
|
|
|
-d client_secret=sk_test_OkjoIF7FmdjunyNsdVqJD02D \
|
|
|
|
|
-d code=ac_88U1TDwBgao4I3uYyyFEO3pVbbEed6tm \
|
|
|
|
|
-d grant_type=authorization_code
|
|
|
|
|
|
|
|
|
|
# {
|
|
|
|
|
"access_token": "sk_test_q8WZbdQXt7RGRkBR0fhgohG6",
|
|
|
|
|
"livemode": false,
|
|
|
|
|
"refresh_token": "rt_88U3csV42HtY1P1Cd9KU2GCez3wixgsHtIHaQbeeu1dXVWo9",
|
|
|
|
|
"token_type": "bearer",
|
|
|
|
|
"stripe_publishable_key": "pk_test_s1YZDczylyRUvhAGeVhxqznp",
|
|
|
|
|
"stripe_user_id": "acct_17sCNpDcwjPgpqRL",
|
|
|
|
|
"scope": "read_write"
|
|
|
|
|
}
|
|
|
|
|
=end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"acct_17sCEyH8FcKpNSnR"
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
2017-03-22 12:39:06 +00:00
|
|
|
def create_stripe_token(exp_month = 2019)
|
2016-04-06 02:23:15 +00:00
|
|
|
Stripe::Token.create(
|
|
|
|
|
:card => {
|
|
|
|
|
:number => "4111111111111111",
|
|
|
|
|
:exp_month => 2,
|
|
|
|
|
:exp_year => exp_month,
|
|
|
|
|
:cvc => "314"
|
|
|
|
|
},
|
|
|
|
|
).id
|
|
|
|
|
end
|