-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
738 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,9 @@ composer.lock | |
Thumbs.db | ||
.vagrant/ | ||
dump.rdb | ||
|
||
*.scssc | ||
|
||
*.cdncache | ||
|
||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
var PROD_DEST = "../www/" | ||
var PUBLIC_PATH = "./public/" | ||
/*global module:false*/ | ||
module.exports = function(grunt) { | ||
|
||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
|
||
/* TEMPLATING */ | ||
|
||
template: { | ||
views: { | ||
options: { | ||
data: { | ||
env: 'dev' | ||
}, | ||
}, | ||
files: { | ||
'./public/index.html': PUBLIC_PATH + './index.tpl' | ||
} | ||
}, | ||
prod: { | ||
options: { | ||
data: { | ||
env: 'prod' | ||
} | ||
}, | ||
files: { | ||
'./public/index.html': PUBLIC_PATH + './index.tpl' | ||
} | ||
}, | ||
dev: { | ||
options: { | ||
data: { | ||
env: 'dev' | ||
} | ||
}, | ||
files: { | ||
'./public/index.html': PUBLIC_PATH + './index.tpl' | ||
} | ||
}, | ||
}, | ||
|
||
/* COMPILE OUR COFFEE SCRIPTS FILES */ | ||
|
||
coffee: { | ||
dist: { | ||
options: { | ||
bare: true | ||
}, | ||
files: [{ | ||
expand: true, | ||
cwd: PUBLIC_PATH + 'js', | ||
src: ['{,*/}*.coffee'], | ||
dest: PUBLIC_PATH + 'js', | ||
ext: '.js' | ||
}] | ||
} | ||
}, | ||
|
||
/* CONCAT AND MINIFY OUR JS FILES */ | ||
|
||
uglify: { | ||
options: { | ||
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + | ||
'<%= grunt.template.today("yyyy-mm-dd") %> */', | ||
mangle:false | ||
}, | ||
my_target: { | ||
files: { | ||
'app.js': [ | ||
PUBLIC_PATH + "js/storage.coffee" | ||
] | ||
} | ||
} | ||
}, | ||
|
||
/* COMPILE OUR SCSS FILES */ | ||
|
||
sass: { | ||
options: { | ||
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + | ||
'<%= grunt.template.today("yyyy-mm-dd") %> */' | ||
}, | ||
dist: { | ||
files: [{ | ||
expand: true, | ||
src: ['public/css/*.scss'], | ||
ext: '.css' | ||
}] | ||
} | ||
}, | ||
|
||
/* COMPRESS CSS RULE */ | ||
|
||
cssmin: { | ||
minify: { | ||
files: { | ||
'css/app.css': ['css/app.css'] | ||
} | ||
} | ||
}, | ||
|
||
/* OUR WATCH RULES */ | ||
|
||
watch: { | ||
html: { | ||
files: ['app/**/*.blade.php', 'public/partials/*.html'], | ||
options: { | ||
livereload: true | ||
} | ||
}, | ||
coffee: { | ||
files: ['public/js/*.coffee'], | ||
tasks: ['coffee'], | ||
options: { | ||
livereload: true | ||
} | ||
}, | ||
scss: { | ||
files: ['public/css/*.scss'], | ||
tasks: ['sass'], | ||
options: { | ||
livereload: true | ||
} | ||
}, | ||
} | ||
|
||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
grunt.loadNpmTasks('grunt-contrib-coffee'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
grunt.loadNpmTasks('grunt-contrib-sass'); | ||
grunt.loadNpmTasks('grunt-template'); | ||
grunt.loadNpmTasks('grunt-contrib-clean'); | ||
grunt.loadNpmTasks('grunt-contrib-cssmin'); | ||
|
||
|
||
grunt.registerTask('dev', ['watch']); | ||
grunt.registerTask('prod', ['clean:prod' , 'sass', 'cssmin', 'coffee', 'uglify', 'template:prod', 'htmlmin' ]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,35 @@ | ||
<?php | ||
|
||
function is_hexadecimal($color) | ||
{ | ||
return preg_match('/^#[a-f0-9]{6}$/i', $color); | ||
} | ||
|
||
use Larabooster\DbColorRepository; | ||
use Larabooster\MemcacheColorRepository; | ||
use Larabooster\RedisColorRepository; | ||
|
||
Route::get('/', function() | ||
{ | ||
$MySQL_storage = new ColorsController(new DbColorRepository); | ||
$memcache_storage = new ColorsController(new MemcacheColorRepository); | ||
$redis_storage = new ColorsController(new RedisColorRepository); | ||
|
||
$mysql_colors = $MySQL_storage->getAll(); | ||
$memcache_colors = $memcache_storage->getAll(); | ||
$redis_colors = $redis_storage->getAll(); | ||
|
||
$to_view = [ | ||
'mysql_colors' => $mysql_colors, | ||
'memcache_colors' => $memcache_colors, | ||
'redis_colors' => $redis_colors | ||
]; | ||
|
||
return View::make('home')->with($to_view); | ||
{ | ||
return View::make('home'); | ||
}); | ||
|
||
Route::group(array('prefix' => 'api'), function() | ||
{ | ||
Route::post('mysql', function() { | ||
$controller = new ColorsController(new DbColorRepository); | ||
return $controller->store(); | ||
}); | ||
|
||
Route::delete('mysql', function() { | ||
$controller = new ColorsController(new DbColorRepository); | ||
return $controller->delete(); | ||
}); | ||
|
||
Route::post('memcache', function() { | ||
$controller = new ColorsController(new MemcacheColorRepository); | ||
return $controller->store(); | ||
}); | ||
|
||
Route::delete('memcache', function() { | ||
$controller = new ColorsController(new MemcacheColorRepository); | ||
return $controller->delete(); | ||
}); | ||
|
||
Route::post('redis', function() { | ||
$controller = new ColorsController(new RedisColorRepository); | ||
return $controller->store(); | ||
}); | ||
|
||
Route::delete('redis', function() { | ||
$controller = new ColorsController(new RedisColorRepository); | ||
return $controller->delete(); | ||
}); | ||
$storages = [ | ||
'mysql' => [ 'repo' => 'Larabooster\DbColorRepository' ], | ||
'memcache' => [ 'repo' => 'Larabooster\MemcacheColorRepository' ], | ||
'redis' => [ 'repo' => 'Larabooster\RedisColorRepository' ] | ||
]; | ||
|
||
foreach ($storages as $kStorage => $vStorage) | ||
{ | ||
Route::group(array('prefix' => $kStorage), function() use ($kStorage, $vStorage) { | ||
|
||
$controller = new ColorsController(new $vStorage['repo']); | ||
|
||
Route::get("/", function() use ($controller) { | ||
return $controller->getAll(3); | ||
}); | ||
Route::post("/", function() use ($controller) { | ||
return $controller->store(); | ||
}); | ||
Route::delete("/", function() use ($controller) { | ||
return $controller->delete(); | ||
}); | ||
|
||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,3 +79,4 @@ | |
*/ | ||
|
||
require app_path().'/filters.php'; | ||
|
Oops, something went wrong.