Branding
This commit is contained in:
parent
971ef5e530
commit
04a9f70b26
1
Gemfile
1
Gemfile
|
@ -1,4 +1,3 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
# Specify your gem's dependencies in rake_control.gemspec
|
||||
gemspec
|
||||
|
|
11
README.md
11
README.md
|
@ -1,12 +1,12 @@
|
|||
# RakeControl
|
||||
# Burden
|
||||
|
||||
RakeControl is a tool for managing Rake tasks.
|
||||
Burden is a tool for managing Rake tasks.
|
||||
|
||||
## Installation
|
||||
|
||||
Add this line to your application's Gemfile:
|
||||
```ruby
|
||||
gem 'rake_control'
|
||||
gem 'burden'
|
||||
```
|
||||
|
||||
And then execute:
|
||||
|
@ -16,11 +16,10 @@ $ bundle
|
|||
|
||||
## Configuration
|
||||
|
||||
|
||||
Add this lines to the top of your application's Rakefile:
|
||||
```ruby
|
||||
require 'rake_control'
|
||||
RakeControl.configure do |c|
|
||||
require 'burden'
|
||||
Burden.configure do |c|
|
||||
c.storage = :active_record # or :mongoid, :mongo_mapper
|
||||
end
|
||||
```
|
||||
|
|
15
Rakefile
15
Rakefile
|
@ -1,16 +1 @@
|
|||
require 'bundler/gem_tasks'
|
||||
require 'rake_control'
|
||||
|
||||
task :regular_task do
|
||||
puts 'I am being invoked'
|
||||
end
|
||||
|
||||
task :failing_task do
|
||||
raise 'wtf'
|
||||
end
|
||||
|
||||
task :sleepy_task do
|
||||
puts 'Sleeping...'
|
||||
sleep 2
|
||||
puts 'Woke up!'
|
||||
end
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
lib = File.expand_path('../lib', __FILE__)
|
||||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||
require 'rake_control/version'
|
||||
require 'burden/version'
|
||||
|
||||
Gem::Specification.new do |spec|
|
||||
spec.name = 'rake_control'
|
||||
spec.version = RakeControl::VERSION
|
||||
spec.name = 'burden'
|
||||
spec.version = Burden::VERSION
|
||||
spec.authors = ['Gregory Eremin']
|
||||
spec.email = ['magnolia_fan@me.com']
|
||||
spec.description = %q{}
|
||||
spec.summary = %q{Rake tasks manager and statistics collector}
|
||||
spec.homepage = 'https://github.com/magnolia-fan/rake_control'
|
||||
spec.homepage = 'https://github.com/magnolia-fan/burden'
|
||||
spec.license = 'MIT'
|
||||
|
||||
spec.files = `git ls-files`.split($/)
|
|
@ -3,4 +3,4 @@ source 'http://rubygems.org'
|
|||
gemspec
|
||||
|
||||
gem 'jquery-rails'
|
||||
gem 'rake_control', path: '..'
|
||||
gem 'burden', path: '..'
|
|
@ -0,0 +1 @@
|
|||
# Burden Web Interface
|
|
@ -14,7 +14,7 @@ end
|
|||
|
||||
RDoc::Task.new(:rdoc) do |rdoc|
|
||||
rdoc.rdoc_dir = 'rdoc'
|
||||
rdoc.title = 'RakeControlWeb'
|
||||
rdoc.title = 'BurdenWeb'
|
||||
rdoc.options << '--line-numbers'
|
||||
rdoc.rdoc_files.include('README.rdoc')
|
||||
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
@ -0,0 +1,7 @@
|
|||
/*
|
||||
*= require burden_web/normalize
|
||||
*= require burden_web/foundation.min
|
||||
*= require_self
|
||||
*/
|
||||
|
||||
a.button { margin: 0; }
|
|
@ -1,4 +1,4 @@
|
|||
module RakeControlWeb
|
||||
module BurdenWeb
|
||||
class ApplicationController < ActionController::Base
|
||||
def tasks
|
||||
Rails.application.load_tasks
|
|
@ -1,9 +1,9 @@
|
|||
module RakeControlWeb
|
||||
module BurdenWeb
|
||||
class TasksController < ApplicationController
|
||||
def index
|
||||
@tasks = RakeControl::Storage.run.summary
|
||||
@tasks = Burden::Storage.run.summary
|
||||
(tasks.map(&:name) - @tasks.map(&:name)).each do |nr_task| # Never runned tasks
|
||||
@tasks << RakeControl::Storage.run.new(
|
||||
@tasks << Burden::Storage.run.new(
|
||||
name: nr_task
|
||||
)
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
module RakeControlWeb
|
||||
module BurdenWeb
|
||||
module ApplicationHelper
|
||||
def task_label run
|
||||
case run.success
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Burden</title>
|
||||
<%= stylesheet_link_tag 'burden_web/application', media: 'all' %>
|
||||
<%= csrf_meta_tags %>
|
||||
</head>
|
||||
<body>
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<h2 class="subheader">Burden Dashboard</h2>
|
||||
<%= yield %>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,22 +1,22 @@
|
|||
$:.push File.expand_path("../lib", __FILE__)
|
||||
|
||||
# Maintain your gem's version:
|
||||
require "rake_control_web/version"
|
||||
require "burden_web/version"
|
||||
|
||||
# Describe your gem and declare its dependencies:
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "rake_control_web"
|
||||
s.version = RakeControlWeb::VERSION
|
||||
s.name = "burden_web"
|
||||
s.version = BurdenWeb::VERSION
|
||||
s.authors = ["TODO: Your name"]
|
||||
s.email = ["TODO: Your email"]
|
||||
s.homepage = "TODO"
|
||||
s.summary = "TODO: Summary of RakeControlWeb."
|
||||
s.description = "TODO: Description of RakeControlWeb."
|
||||
s.summary = "TODO: Summary of BurdenWeb."
|
||||
s.description = "TODO: Description of BurdenWeb."
|
||||
|
||||
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
|
||||
|
||||
s.add_dependency 'rails', '>= 3.2'
|
||||
s.add_development_dependency 'rake_control'
|
||||
s.add_development_dependency 'burden'
|
||||
|
||||
s.add_development_dependency 'sqlite3'
|
||||
s.add_development_dependency 'awesome_print'
|
|
@ -1,4 +1,4 @@
|
|||
RakeControlWeb::Engine.routes.draw do
|
||||
BurdenWeb::Engine.routes.draw do
|
||||
resources :tasks, path: '/', only: [:index], constraints: { id: /[a-z0-9_:]+/ } do
|
||||
member{ get :run }
|
||||
resources :runs, only: [:index, :show]
|
|
@ -0,0 +1,4 @@
|
|||
require "burden_web/engine"
|
||||
|
||||
module BurdenWeb
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
module BurdenWeb
|
||||
class Engine < ::Rails::Engine
|
||||
isolate_namespace BurdenWeb
|
||||
end
|
||||
end
|
|
@ -1,3 +1,3 @@
|
|||
module RakeControl
|
||||
module BurdenWeb
|
||||
VERSION = '0.1.0'
|
||||
end
|
|
@ -2,7 +2,7 @@
|
|||
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
||||
|
||||
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
||||
ENGINE_PATH = File.expand_path('../../lib/rake_control_web/engine', __FILE__)
|
||||
ENGINE_PATH = File.expand_path('../../lib/burden_web/engine', __FILE__)
|
||||
|
||||
require 'rails/all'
|
||||
require 'rails/engine/commands'
|
|
@ -9,7 +9,7 @@ require "sprockets/railtie"
|
|||
# require "rails/test_unit/railtie"
|
||||
|
||||
Bundler.require(*Rails.groups)
|
||||
require "rake_control_web"
|
||||
require "burden_web"
|
||||
|
||||
module Dummy
|
||||
class Application < Rails::Application
|
|
@ -1,4 +1,4 @@
|
|||
RakeControl.configure do |c|
|
||||
Burden.configure do |c|
|
||||
c.storage = :active_record
|
||||
c.ignored_tasks = [:environment]
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
Rails.application.routes.draw do
|
||||
mount BurdenWeb::Engine => "/burden"
|
||||
end
|
|
@ -1,6 +1,6 @@
|
|||
class CreateRakeControlRuns < ActiveRecord::Migration
|
||||
class CreateBurdenRuns < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :rake_control_runs do |t|
|
||||
create_table :burden_runs do |t|
|
||||
t.string :name
|
||||
t.boolean :success
|
||||
t.float :execution_time
|
||||
|
@ -9,6 +9,6 @@ class CreateRakeControlRuns < ActiveRecord::Migration
|
|||
end
|
||||
|
||||
def down
|
||||
drop_table :rake_control_runs
|
||||
drop_table :burden_runs
|
||||
end
|
||||
end
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
ActiveRecord::Schema.define(:version => 20130606131532) do
|
||||
|
||||
create_table "rake_control_runs", :force => true do |t|
|
||||
create_table "burden_runs", :force => true do |t|
|
||||
t.string "name"
|
||||
t.boolean "success"
|
||||
t.float "execution_time"
|
|
@ -2,13 +2,13 @@ require 'bundler/setup'
|
|||
require 'rake'
|
||||
require File.expand_path('../rake/task', __FILE__)
|
||||
|
||||
require 'rake_control/config'
|
||||
require 'rake_control/statistics'
|
||||
require 'rake_control/storage'
|
||||
require 'rake_control/version'
|
||||
require 'rake_control/wrapper'
|
||||
require 'burden/config'
|
||||
require 'burden/statistics'
|
||||
require 'burden/storage'
|
||||
require 'burden/version'
|
||||
require 'burden/wrapper'
|
||||
|
||||
module RakeControl
|
||||
module Burden
|
||||
include Config::Helper
|
||||
|
||||
def wrap(name, description, &block)
|
|
@ -1,4 +1,4 @@
|
|||
module RakeControl
|
||||
module Burden
|
||||
class Config
|
||||
attr_accessor :storage, # Storage backend (ActiveRecord, Mongoid, MongoMapper)
|
||||
:ignored_tasks # Do not log this tasks (eg. environment task)
|
|
@ -1,4 +1,4 @@
|
|||
module RakeControl
|
||||
module Burden
|
||||
class Statistics
|
||||
attr_reader :name, :success, :execution_time
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
module Burden
|
||||
module Storage
|
||||
def run
|
||||
case Burden.config.storage
|
||||
when :active_record, :activerecord
|
||||
require 'burden/storage/active_record/run'
|
||||
Burden::Storage::ActiveRecord::Run
|
||||
when :mongoid
|
||||
require 'burden/storage/mongoid/run'
|
||||
Burden::Storage::Mongoid::Run
|
||||
when :mongo_mapper, :mongomapper
|
||||
require 'burden/storage/mongo_mapper/run'
|
||||
Burden::Storage::MongoMapper::Run
|
||||
else
|
||||
raise Exception.new("Unknown storage: #{storage}")
|
||||
end
|
||||
end
|
||||
|
||||
extend self
|
||||
end
|
||||
end
|
|
@ -1,8 +1,8 @@
|
|||
module RakeControl
|
||||
module Burden
|
||||
module Storage
|
||||
module ActiveRecord
|
||||
class Run < ::ActiveRecord::Base
|
||||
self.table_name = 'rake_control_runs'
|
||||
self.table_name = 'burden_runs'
|
||||
attr_accessible :name, :success, :execution_time
|
||||
|
||||
scope :summary, ->{ group(:name).order('created_at desc') }
|
|
@ -1,9 +1,10 @@
|
|||
module RakeControl
|
||||
module Burden
|
||||
module Storage
|
||||
module MongoMapper
|
||||
class Run
|
||||
include ::MongoMapper::Document
|
||||
|
||||
set_collection_name 'burden_runs'
|
||||
key :name, String
|
||||
key :success, Boolean
|
||||
key :execution_time, Float
|
|
@ -1,9 +1,10 @@
|
|||
module RakeControl
|
||||
module Burden
|
||||
module Storage
|
||||
module Mongoid
|
||||
class Run
|
||||
include ::Mongoid::Document
|
||||
|
||||
store_in collection: 'burden_runs'
|
||||
field :name, type: String
|
||||
field :success, type: Boolean
|
||||
field :execution_time, type: Float
|
|
@ -0,0 +1,3 @@
|
|||
module Burden
|
||||
VERSION = '0.1.0'
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
module RakeControl
|
||||
module Burden
|
||||
class Wrapper
|
||||
attr_reader :name, :description, :block, :success, :exception, :execution_time
|
||||
|
||||
|
@ -42,7 +42,7 @@ module RakeControl
|
|||
end
|
||||
|
||||
def ignored?
|
||||
RakeControl.config.ignored_tasks.include?(name.to_sym)
|
||||
Burden.config.ignored_tasks.include?(name.to_sym)
|
||||
end
|
||||
|
||||
def save_statistics
|
|
@ -1,7 +1,7 @@
|
|||
require 'rails/generators'
|
||||
require 'rails/generators/migration'
|
||||
|
||||
class RakeControlGenerator < Rails::Generators::Base
|
||||
class BurdenGenerator < Rails::Generators::Base
|
||||
include Rails::Generators::Migration
|
||||
|
||||
def self.source_root
|
||||
|
@ -17,6 +17,6 @@ class RakeControlGenerator < Rails::Generators::Base
|
|||
end
|
||||
|
||||
def create_migration_file
|
||||
migration_template 'create_rake_control_runs.rb', 'db/migrate/create_rake_control_runs.rb'
|
||||
migration_template 'create_burden_runs.rb', 'db/migrate/create_burden_runs.rb'
|
||||
end
|
||||
end
|
|
@ -1,6 +1,6 @@
|
|||
class CreateRakeControlRuns < ActiveRecord::Migration
|
||||
class CreateBurdenRuns < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :rake_control_runs do |t|
|
||||
create_table :burden_runs do |t|
|
||||
t.string :name
|
||||
t.boolean :success
|
||||
t.float :execution_time
|
||||
|
@ -9,6 +9,6 @@ class CreateRakeControlRuns < ActiveRecord::Migration
|
|||
end
|
||||
|
||||
def self.down
|
||||
drop_table :rake_control_runs
|
||||
drop_table :burden_runs
|
||||
end
|
||||
end
|
|
@ -3,7 +3,7 @@ module Rake
|
|||
alias_method :original_execute, :execute
|
||||
|
||||
def execute(args)
|
||||
RakeControl.wrap(name, comment) do
|
||||
Burden.wrap(name, comment) do
|
||||
original_execute(args)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
module RakeControl
|
||||
module Storage
|
||||
def run
|
||||
case RakeControl.config.storage
|
||||
when :active_record, :activerecord
|
||||
require 'rake_control/storage/active_record/run'
|
||||
RakeControl::Storage::ActiveRecord::Run
|
||||
when :mongoid
|
||||
require 'rake_control/storage/mongoid/run'
|
||||
RakeControl::Storage::Mongoid::Run
|
||||
when :mongo_mapper, :mongomapper
|
||||
require 'rake_control/storage/mongo_mapper/run'
|
||||
RakeControl::Storage::MongoMapper::Run
|
||||
else
|
||||
raise Exception.new("Unknown storage: #{storage}")
|
||||
end
|
||||
end
|
||||
|
||||
extend self
|
||||
end
|
||||
end
|
|
@ -1,3 +0,0 @@
|
|||
= RakeControlWeb
|
||||
|
||||
This project rocks and uses MIT-LICENSE.
|
|
@ -1,7 +0,0 @@
|
|||
/*
|
||||
*= require rake_control_web/normalize
|
||||
*= require rake_control_web/foundation.min
|
||||
*= require_self
|
||||
*/
|
||||
|
||||
a.button { margin: 0; }
|
|
@ -1,17 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>RakeControlWeb</title>
|
||||
<%= stylesheet_link_tag 'rake_control_web/application', media: 'all' %>
|
||||
<%= javascript_include_tag 'rake_control_web/application' %>
|
||||
<%= csrf_meta_tags %>
|
||||
</head>
|
||||
<body>
|
||||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<h2 class="subheader">Rake Control Dashboard</h2>
|
||||
<%= yield %>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,4 +0,0 @@
|
|||
require "rake_control_web/engine"
|
||||
|
||||
module RakeControlWeb
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
module RakeControlWeb
|
||||
class Engine < ::Rails::Engine
|
||||
isolate_namespace RakeControlWeb
|
||||
end
|
||||
end
|
|
@ -1,3 +0,0 @@
|
|||
module RakeControlWeb
|
||||
VERSION = "0.0.1"
|
||||
end
|
|
@ -1,4 +0,0 @@
|
|||
# desc "Explaining what the task does"
|
||||
# task :rake_control_web do
|
||||
# # Task goes here
|
||||
# end
|
|
@ -1,3 +0,0 @@
|
|||
Rails.application.routes.draw do
|
||||
mount RakeControlWeb::Engine => "/rake_control"
|
||||
end
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe RakeControl::Wrapper do
|
||||
describe Burden::Wrapper do
|
||||
before :all do
|
||||
Rake::Task.define_task('dummy_task'){}
|
||||
Rake::Task['dummy_task'].invoke
|
|
@ -1,4 +1,4 @@
|
|||
require 'rake_control'
|
||||
require 'burden'
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.formatter = :progress
|
||||
|
|
Loading…
Reference in New Issue