Skip to content

Commit

Permalink
Make everything consistent with deployed version 0.0.1.alpha1
Browse files Browse the repository at this point in the history
  • Loading branch information
danascheider committed May 5, 2015
2 parents f8ea325 + 901652a commit 1fd27ac
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 17 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,9 @@
/.vagrant/*
/.vagrant/**/*

# Ignore RVM file
# Ignore RVM and rbenv files
/.ruby-gemset
/.ruby-version

# Ignore gem
/*.gem
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RSpec::Core::RakeTask.new

task 'suite:run' do
Rake::Task[:spec].invoke
Rake::Task['db:test:prepare'].invoke
Rake::Task['db:prepare'].invoke
Rake::Task[:cucumber].invoke
end

Expand All @@ -24,4 +24,4 @@ task :default => [:all]
desc "Run all tests."
task :all => [
'suite:run'
]
]
7 changes: 4 additions & 3 deletions config/database.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
defaults: &defaults
adapter: mysql2
host: 127.0.0.1
host: localhost
port: 3306
username: canto
password: C*iEpr3ePrO@CRI7xoUX
database: defaults
password: CiEpr3ePrOCRI7xoUX
pool: 5
timeout: 5000
timeout: 5000
4 changes: 2 additions & 2 deletions config/database_task_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def self.get_yaml(file)
yaml = (File.open(file, 'r+') {|file| YAML.load_file(file) }).to_h
yaml['defaults'] = yaml['defaults'].to_h

yaml['defaults'].each do |key, value|
yaml['defaults'].keys.each do |key|
yaml['defaults'][(key.to_sym rescue key) || key] = yaml['defaults'].delete(key)
end

Expand All @@ -21,4 +21,4 @@ def self.get_yaml(file)
def self.get_string(hash, env)
"#{hash[:adapter]}://#{hash[:username]}:#{hash[:password]}@#{hash[:host]}:#{hash[:port]}/#{env}"
end
end
end
4 changes: 2 additions & 2 deletions config/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class Canto < Sinatra::Base

ENV['RACK_ENV'] ||= 'development'
ENV['RACK_ENV'] = 'defaults'
db_location = ENV['TRAVIS'] ? 'mysql2://[email protected]:3306/test' : DatabaseTaskHelper.get_string(DB_CONFIG_INFO[ENV['RACK_ENV']], ENV['RACK_ENV'])

set :app_file, File.expand_path(CONFIG_INFO[:app_file])
Expand Down Expand Up @@ -62,4 +62,4 @@ def to_json
helpers Sinatra::ErrorHandling
helpers Sinatra::GeneralHelperMethods
helpers Sinatra::LogHelper
end
end
6 changes: 3 additions & 3 deletions tasks/database_tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ namespace :db do
end

desc 'Migrate the database'
task :migrate, [:PATH] => ['db:development:create'] do |t, args|
task :migrate, [:PATH] => ['db:create'] do |t, args|
path = args[:path] || MIGRATION_PATH
Sequel::Migrator.run(DB, path)
STDOUT.puts 'Development database migrated successfully.'.green
STDOUT.puts 'Database \'defaults\' migrated successfully.'.green
end

desc 'Reset the test database'
Expand All @@ -53,4 +53,4 @@ namespace :db do
client.query('SET FOREIGN_KEY_CHECKS = 1')
puts "Success!".green
end
end
end
4 changes: 2 additions & 2 deletions tasks/schema_migrations.rake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'mysql2'
require 'sequel'

DB = Sequel.connect(DatabaseTaskHelper.get_string(YAML_DATA['defaults'], ''))
DB ||= Sequel.connect(DatabaseTaskHelper.get_string(YAML_DATA['defaults'], 'defaults'))

namespace :db do
desc 'Create new migration, required arg NAME, default PATH /db/migrate'
Expand Down Expand Up @@ -45,4 +45,4 @@ EOF
File.open("#{path}/#{timestamp}_schema.rb", 'w+') {|file| file << schema }
end
end
end
end
4 changes: 2 additions & 2 deletions tasks/travis.rake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require 'sequel'
Sequel.extension :migration

DATABASE = 'mysql2://[email protected]:3306/test'
DB = Sequel.connect(DATABASE)
DB ||= Sequel.connect(DATABASE)

namespace :travis do
Cucumber::Rake::Task.new do |task|
Expand All @@ -30,4 +30,4 @@ namespace :travis do
Rake::Task['spec'].invoke
Rake::Task['travis:cucumber'].invoke
end
end
end

0 comments on commit 1fd27ac

Please sign in to comment.