best_boy 1.3.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +36 -3
- data/Rakefile +45 -7
- data/app/controllers/best_boy/best_boy_events_controller.rb +147 -98
- data/app/helpers/best_boy/best_boy_view_helper.rb +9 -0
- data/app/views/best_boy/best_boy_events/details.html.erb +33 -27
- data/app/views/best_boy/best_boy_events/monthly_details.html.erb +9 -9
- data/app/views/best_boy/best_boy_events/stats.html.erb +20 -19
- data/lib/best_boy/engine.rb +2 -0
- data/lib/best_boy/models/active_record/best_boy/eventable.rb +19 -0
- data/lib/best_boy/models/active_record/best_boy_day_report.rb +65 -0
- data/lib/best_boy/models/active_record/best_boy_event.rb +1 -11
- data/lib/best_boy/models/active_record/best_boy_month_report.rb +63 -0
- data/lib/best_boy/version.rb +1 -1
- data/lib/generators/active_record/best_boy_generator.rb +4 -1
- data/lib/generators/active_record/templates/create_best_boy_reports.rb +30 -0
- data/lib/tasks/recover_report_history.rake +146 -0
- data/spec/{best_boy → controllers}/best_boy_controller_spec.rb +6 -4
- data/spec/dummy/app/views/test_events/index.html.haml +9 -1
- data/spec/dummy/config/routes.rb +1 -0
- data/spec/dummy/db/migrate/20131108085915_create_best_boy_reports.rb +30 -0
- data/spec/dummy/db/schema.rb +27 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +10092 -0
- data/spec/dummy/log/test.log +531 -0
- data/spec/dummy/tmp/cache/assets/development/sass/f99cb4f6f36f128b2d6950c813eec72c66616bfc/bootstrap.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/01af51e20498d87feb18694bed0d0731 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/057daf732c672b9e0ec8bd233ec79077 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1565c81151c1e0fe577f787a645bca3d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1c90620581903652712500bb92915909 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3241270f308313221453f51980c07883 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3a59d6acf2f4543a36d946d653b08dab +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3a5f8aba9c98833836df55cdc5502ee8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/42804a4f90448633879c06a33e49f4e6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/48279ff6b6f65f85e766c3a7ae0c71f6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/642b8ba757f92502a3a3281a956eec2a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/64fe0e7bbf53d3cf292e85e123137bcb +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/77e01a708457c1d4aac9446e173321a1 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/8ac87e607a25fc208fc1da0c60b24b8b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/8dab559778ce584628d484b9d919cfa8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/8fde9b9595ed926214e7858402849bb2 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c9e7400c0b4cf9165368acf909971237 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e58e48ebcd3216893f3b053ee6a3d7eb +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e5cfb1a438298274f827c0cbea06e7dc +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f14dc22e71f0438b9fc154ec08da7c10 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/models/best_boy_event_spec.rb +20 -0
- data/spec/models/day_report_spec.rb +115 -0
- data/spec/models/eventable_spec.rb +51 -0
- data/spec/models/month_report_spec.rb +113 -0
- data/spec/spec_helper.rb +96 -40
- metadata +110 -123
- data/.gitignore +0 -10
- data/.rspec +0 -1
- data/.travis.yml +0 -3
- data/Gemfile +0 -3
- data/LICENSE.txt +0 -20
- data/best_boy.gemspec +0 -38
- data/db/bestboy.db +0 -0
- data/spec/best_boy/best_boy_event_spec.rb +0 -62
- data/spec/best_boy/eventable_spec.rb +0 -20
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
data/best_boy.gemspec
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
|
3
|
-
require "best_boy/version"
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |s|
|
|
6
|
-
s.name = "best_boy"
|
|
7
|
-
s.version = BestBoy::VERSION
|
|
8
|
-
s.platform = Gem::Platform::RUBY
|
|
9
|
-
s.licenses =["MIT"]
|
|
10
|
-
s.authors = ["Christoph Seydel"]
|
|
11
|
-
s.email = ["christoph.seydel@me.com"]
|
|
12
|
-
s.homepage = "https://github.com/absolventa/best_boy"
|
|
13
|
-
s.summary = %q{a simple event driven logging for models}
|
|
14
|
-
s.description = %q{Hybrid action logging, consisting of standard and custom logging.}
|
|
15
|
-
|
|
16
|
-
s.rubyforge_project = "best_boy"
|
|
17
|
-
s.required_rubygems_version = ">= 1.3.6"
|
|
18
|
-
|
|
19
|
-
s.add_dependency('kaminari')
|
|
20
|
-
s.add_dependency('google_visualr')
|
|
21
|
-
|
|
22
|
-
s.add_development_dependency('rails', '~> 4.0.0')
|
|
23
|
-
s.add_development_dependency('foreman', '~> 0.63.0')
|
|
24
|
-
s.add_development_dependency('thin', '~> 1.5.1')
|
|
25
|
-
s.add_development_dependency('sqlite3', '~> 1.3.6')
|
|
26
|
-
s.add_development_dependency('rake', '~> 10.0.3')
|
|
27
|
-
s.add_development_dependency('rspec', '~> 2.13.0')
|
|
28
|
-
s.add_development_dependency('shoulda', '~> 3.4.0')
|
|
29
|
-
s.add_development_dependency "haml"
|
|
30
|
-
s.add_development_dependency 'kaminari', "~> 0.14.1"
|
|
31
|
-
s.add_development_dependency 'sass-rails', '~> 4.0.0'
|
|
32
|
-
s.add_development_dependency "bootstrap-sass", "~> 2.1.0.1"
|
|
33
|
-
|
|
34
|
-
s.files = `git ls-files`.split("\n")
|
|
35
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
36
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
37
|
-
s.require_paths = ["lib"]
|
|
38
|
-
end
|
data/db/bestboy.db
DELETED
|
Binary file
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
describe BestBoyEvent, 'with creating' do
|
|
4
|
-
it "should have valid model" do
|
|
5
|
-
example = Example.create
|
|
6
|
-
best_boy_event = BestBoyEvent.create(:event => "create")
|
|
7
|
-
best_boy_event.owner = example
|
|
8
|
-
best_boy_event.should be_valid
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe BestBoyEvent, 'with associations' do
|
|
13
|
-
it { should belong_to(:owner) }
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
describe BestBoyEvent, 'with validations' do
|
|
17
|
-
it "should require a event" do
|
|
18
|
-
BestBoyEvent.create(:event => "").should_not be_valid
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
describe BestBoyEvent, 'with scopes' do
|
|
23
|
-
def setup_data_aggreagations times, created_at
|
|
24
|
-
ActiveRecord::Base.connection.execute("DELETE FROM 'best_boy_events'")
|
|
25
|
-
example = Example.create
|
|
26
|
-
(1..times).each do
|
|
27
|
-
example.trigger_best_boy_event("year_test")
|
|
28
|
-
example.best_boy_events.last.update_attribute(:created_at, created_at)
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it "should return correct per_year scope" do
|
|
33
|
-
setup_data_aggreagations 3, Time.now - 2.years
|
|
34
|
-
BestBoyEvent.per_year(Time.now - 2.years).count.should eql(3)
|
|
35
|
-
BestBoyEvent.per_year(Time.now - 2.years).last.created_at.to_date.year.should eql((Time.now - 2.years).year)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it "should return correct per_month scope" do
|
|
39
|
-
setup_data_aggreagations 4, Time.now - 2.month
|
|
40
|
-
BestBoyEvent.per_month(Time.now - 2.month).count.should eql(4)
|
|
41
|
-
BestBoyEvent.per_month(Time.now - 2.month).last.created_at.to_date.month.should eql((Time.now - 2.month).month)
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
it "should return correct per_week scope" do
|
|
45
|
-
setup_data_aggreagations 5, Time.now - 2.weeks
|
|
46
|
-
BestBoyEvent.per_week(Time.now - 2.weeks).count.should eql(5)
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
it "should return correct per_month scope" do
|
|
50
|
-
setup_data_aggreagations 7, Time.now - 2.days
|
|
51
|
-
BestBoyEvent.per_day(Time.now - 2.days).count.should eql(7)
|
|
52
|
-
BestBoyEvent.per_day(Time.now - 2.days).last.created_at.to_date.day.should eql((Time.now - 2.days).day)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
it "should return 0 for wrong dates" do
|
|
56
|
-
setup_data_aggreagations 5, Time.now - 2.weeks
|
|
57
|
-
BestBoyEvent.per_year(Time.now - 2.years).count.should eql(0)
|
|
58
|
-
BestBoyEvent.per_month(Time.now - 2.month).count.should eql(0)
|
|
59
|
-
BestBoyEvent.per_week(Time.now - 3.weeks).count.should eql(0)
|
|
60
|
-
BestBoyEvent.per_day(Time.now - 2.days).count.should eql(0)
|
|
61
|
-
end
|
|
62
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
describe BestBoy::Eventable do
|
|
4
|
-
before(:each) do
|
|
5
|
-
@example = Example.create
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
it "should send valid create event" do
|
|
9
|
-
best_boy_event = @example.best_boy_events.first.should_not be_nil
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it "should send valid destroy event" do
|
|
13
|
-
@example.destroy
|
|
14
|
-
BestBoyEvent.where(:owner_type => "User", :event => "destroy").should_not be_nil
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it "should be an eventable" do
|
|
18
|
-
@example.respond_to?("eventable?").should eql(true)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
File without changes
|
|
File without changes
|
|
Binary file
|
|
File without changes
|