trackable_tasks 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,9 @@
1
1
  == unreleased changes
2
2
 
3
+ == 0.0.12
4
+
5
+ * Updated the trackable task frontend with options to view the tasks by day or week
6
+
3
7
  == 0.0.11
4
8
 
5
9
  * Displaying times in date time format instead of only date
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trackable_tasks (0.0.10)
4
+ trackable_tasks (0.0.11)
5
5
  rails (>= 3.0.7)
6
6
  trackable_tasks
7
7
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.11
1
+ 0.0.12
@@ -1,9 +1,24 @@
1
1
  # Index and show controller for TaskRuns
2
- # TaskRuns should not be created or edited here because they are generate by rake tasks
2
+ # TaskRuns should not be created or edited here because they are generated by rake tasks
3
3
  class TrackableTasks::TaskRunsController < ApplicationController
4
4
  # Lists all tasks in task run
5
+ # Defaults to show today's tasks but can also show by week or all time
5
6
  def index
6
- @task_runs = TrackableTasks::TaskRun.all
7
+ if params[:timeframe] =='week'
8
+ @task_runs = TrackableTasks::TaskRun.newest_first.this_week
9
+ elsif params[:timeframe] == 'all'
10
+ @task_runs = TrackableTasks::TaskRun.newest_first
11
+ else
12
+ @task_runs = TrackableTasks::TaskRun.newest_first.today
13
+ end
14
+
15
+ # Paginate with kaminari if it is installed
16
+ begin
17
+ @task_runs = Kaminari.paginate_array(@task_runs.each).page(params[:page])
18
+ @pagination_enabled = true
19
+ rescue NameError => e
20
+ @pagination_enabled = false
21
+ end
7
22
 
8
23
  respond_to do |format|
9
24
  format.html # index.html.erb
@@ -21,4 +36,4 @@ class TrackableTasks::TaskRunsController < ApplicationController
21
36
 
22
37
  end
23
38
  end
24
-
39
+
@@ -16,6 +16,11 @@ module TrackableTasks
16
16
  end
17
17
  end
18
18
 
19
+ scope :newest_first, lambda { order("trackable_tasks_task_runs.start_time desc") }
20
+ scope :today, lambda { where(["trackable_tasks_task_runs.start_time >= ?", 24.hours.ago]) }
21
+ # this may have some odd effects on things that are 7 days but less than 7 * 24 hours old
22
+ scope :this_week, lambda { where(["trackable_tasks_task_runs.start_time >= ?", 7.days.ago]) }
23
+
19
24
  # Appends the input text onto the log text
20
25
  #
21
26
  # I am aware that these two methods are duplicates nd we could merge them
@@ -1,3 +1,11 @@
1
+ <div class='navigation'>
2
+ <%= link_to 'Today', trackable_tasks_task_runs_path(:timeframe => "today") %>
3
+ |
4
+ <%= link_to 'This Week', trackable_tasks_task_runs_path(:timeframe => "week") %>
5
+ |
6
+ <%= link_to 'All Time', trackable_tasks_task_runs_path(:timeframe => "all") %>
7
+ </div>
8
+
1
9
  <table>
2
10
  <tr>
3
11
  <th>Task Type </th>
@@ -11,7 +11,7 @@ Dummy::Application.configure do
11
11
 
12
12
  # Show full error reports and disable caching
13
13
  config.consider_all_requests_local = true
14
- config.action_view.debug_rjs = true
14
+ # config.action_view.debug_rjs = true
15
15
  config.action_controller.perform_caching = false
16
16
 
17
17
  # Don't care if the mailer can't send
@@ -69,6 +69,51 @@ describe TaskRun do
69
69
 
70
70
  end
71
71
 
72
+ describe "today scope" do
73
+ before(:each) do
74
+ @today = TrackableTasks::TaskRun.create!(:task_type => "test task", :start_time => 5.hours.ago, :end_time => 3.hours.ago, :success => true)
75
+ @yesterday = TrackableTasks::TaskRun.create!(:task_type => "test task", :start_time => 30.hours.ago, :end_time => 29.hours.ago, :success => true)
76
+ end
77
+
78
+ it "should include today" do
79
+ TrackableTasks::TaskRun.today.should include @today
80
+ end
81
+
82
+ it "should not include yesterday" do
83
+ TrackableTasks::TaskRun.today.should_not include @yesterday
84
+ end
85
+ end
86
+
87
+ describe "this_week scope" do
88
+ before(:each) do
89
+ @this_week= TrackableTasks::TaskRun.create!(:task_type => "test task", :start_time => 5.days.ago, :end_time => 3.days.ago, :success => true)
90
+ @older = TrackableTasks::TaskRun.create!(:task_type => "test task", :start_time => 30.days.ago, :end_time => 29.days.ago, :success => true)
91
+ end
92
+
93
+ it "should include this week" do
94
+ TrackableTasks::TaskRun.this_week.should include @this_week
95
+ end
96
+
97
+ it "should not include older" do
98
+ TrackableTasks::TaskRun.this_week.should_not include @older
99
+ end
100
+ end
101
+
102
+ describe "newest_first_scope" do
103
+ before(:each) do
104
+ @today = TrackableTasks::TaskRun.create!(:task_type => "test task", :start_time => 5.hours.ago, :end_time => 3.hours.ago, :success => true)
105
+ @yesterday = TrackableTasks::TaskRun.create!(:task_type => "test task", :start_time => 30.hours.ago, :end_time => 29.hours.ago, :success => true)
106
+ end
107
+
108
+ it "today should be first" do
109
+ TrackableTasks::TaskRun.newest_first.first.should == @today
110
+ end
111
+
112
+ it "yesterday should be last" do
113
+ TrackableTasks::TaskRun.newest_first.last.should == @yesterday
114
+ end
115
+ end
116
+
72
117
  describe "add_error_text method" do
73
118
  before(:each) do
74
119
  @run = TaskRun.new()
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "trackable_tasks"
8
- s.version = "0.0.11"
8
+ s.version = "0.0.12"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeremiah Hemphill"]
12
- s.date = "2012-04-20"
12
+ s.date = "2012-04-23"
13
13
  s.description = "Adds tracking to rake tasks including error capturing and logging."
14
14
  s.email = "jeremiah@cloudspace.com"
15
15
  s.extra_rdoc_files = [
@@ -147,6 +147,20 @@ Gem::Specification.new do |s|
147
147
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.3"])
148
148
  s.add_development_dependency(%q<json>, [">= 0"])
149
149
  s.add_development_dependency(%q<ci_reporter>, [">= 0"])
150
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.3"])
151
+ s.add_development_dependency(%q<capybara>, [">= 0.4.0"])
152
+ s.add_development_dependency(%q<sqlite3>, [">= 0"])
153
+ s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
154
+ s.add_development_dependency(%q<rspec>, ["~> 2.6.0"])
155
+ s.add_development_dependency(%q<rspec-rails>, ["~> 2.6.1"])
156
+ s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
157
+ s.add_development_dependency(%q<cucumber>, [">= 0"])
158
+ s.add_development_dependency(%q<cucumber-rails>, [">= 0"])
159
+ s.add_development_dependency(%q<database_cleaner>, [">= 0"])
160
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
161
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.3"])
162
+ s.add_development_dependency(%q<json>, [">= 0"])
163
+ s.add_development_dependency(%q<ci_reporter>, [">= 0"])
150
164
  else
151
165
  s.add_dependency(%q<trackable_tasks>, [">= 0"])
152
166
  s.add_dependency(%q<rails>, [">= 3.0.7"])
@@ -196,6 +210,20 @@ Gem::Specification.new do |s|
196
210
  s.add_dependency(%q<jeweler>, ["~> 1.6.3"])
197
211
  s.add_dependency(%q<json>, [">= 0"])
198
212
  s.add_dependency(%q<ci_reporter>, [">= 0"])
213
+ s.add_dependency(%q<jeweler>, ["~> 1.6.3"])
214
+ s.add_dependency(%q<capybara>, [">= 0.4.0"])
215
+ s.add_dependency(%q<sqlite3>, [">= 0"])
216
+ s.add_dependency(%q<ruby-debug19>, [">= 0"])
217
+ s.add_dependency(%q<rspec>, ["~> 2.6.0"])
218
+ s.add_dependency(%q<rspec-rails>, ["~> 2.6.1"])
219
+ s.add_dependency(%q<yard>, ["~> 0.6.0"])
220
+ s.add_dependency(%q<cucumber>, [">= 0"])
221
+ s.add_dependency(%q<cucumber-rails>, [">= 0"])
222
+ s.add_dependency(%q<database_cleaner>, [">= 0"])
223
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
224
+ s.add_dependency(%q<jeweler>, ["~> 1.6.3"])
225
+ s.add_dependency(%q<json>, [">= 0"])
226
+ s.add_dependency(%q<ci_reporter>, [">= 0"])
199
227
  end
200
228
  else
201
229
  s.add_dependency(%q<trackable_tasks>, [">= 0"])
@@ -246,6 +274,20 @@ Gem::Specification.new do |s|
246
274
  s.add_dependency(%q<jeweler>, ["~> 1.6.3"])
247
275
  s.add_dependency(%q<json>, [">= 0"])
248
276
  s.add_dependency(%q<ci_reporter>, [">= 0"])
277
+ s.add_dependency(%q<jeweler>, ["~> 1.6.3"])
278
+ s.add_dependency(%q<capybara>, [">= 0.4.0"])
279
+ s.add_dependency(%q<sqlite3>, [">= 0"])
280
+ s.add_dependency(%q<ruby-debug19>, [">= 0"])
281
+ s.add_dependency(%q<rspec>, ["~> 2.6.0"])
282
+ s.add_dependency(%q<rspec-rails>, ["~> 2.6.1"])
283
+ s.add_dependency(%q<yard>, ["~> 0.6.0"])
284
+ s.add_dependency(%q<cucumber>, [">= 0"])
285
+ s.add_dependency(%q<cucumber-rails>, [">= 0"])
286
+ s.add_dependency(%q<database_cleaner>, [">= 0"])
287
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
288
+ s.add_dependency(%q<jeweler>, ["~> 1.6.3"])
289
+ s.add_dependency(%q<json>, [">= 0"])
290
+ s.add_dependency(%q<ci_reporter>, [">= 0"])
249
291
  end
250
292
  end
251
293
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: trackable_tasks
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.11
5
+ version: 0.0.12
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jeremiah Hemphill
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-04-20 00:00:00 Z
13
+ date: 2012-04-23 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: trackable_tasks
@@ -540,6 +540,160 @@ dependencies:
540
540
  type: :development
541
541
  prerelease: false
542
542
  version_requirements: *id048
543
+ - !ruby/object:Gem::Dependency
544
+ name: jeweler
545
+ requirement: &id049 !ruby/object:Gem::Requirement
546
+ none: false
547
+ requirements:
548
+ - - ~>
549
+ - !ruby/object:Gem::Version
550
+ version: 1.6.3
551
+ type: :development
552
+ prerelease: false
553
+ version_requirements: *id049
554
+ - !ruby/object:Gem::Dependency
555
+ name: capybara
556
+ requirement: &id050 !ruby/object:Gem::Requirement
557
+ none: false
558
+ requirements:
559
+ - - ">="
560
+ - !ruby/object:Gem::Version
561
+ version: 0.4.0
562
+ type: :development
563
+ prerelease: false
564
+ version_requirements: *id050
565
+ - !ruby/object:Gem::Dependency
566
+ name: sqlite3
567
+ requirement: &id051 !ruby/object:Gem::Requirement
568
+ none: false
569
+ requirements:
570
+ - - ">="
571
+ - !ruby/object:Gem::Version
572
+ version: "0"
573
+ type: :development
574
+ prerelease: false
575
+ version_requirements: *id051
576
+ - !ruby/object:Gem::Dependency
577
+ name: ruby-debug19
578
+ requirement: &id052 !ruby/object:Gem::Requirement
579
+ none: false
580
+ requirements:
581
+ - - ">="
582
+ - !ruby/object:Gem::Version
583
+ version: "0"
584
+ type: :development
585
+ prerelease: false
586
+ version_requirements: *id052
587
+ - !ruby/object:Gem::Dependency
588
+ name: rspec
589
+ requirement: &id053 !ruby/object:Gem::Requirement
590
+ none: false
591
+ requirements:
592
+ - - ~>
593
+ - !ruby/object:Gem::Version
594
+ version: 2.6.0
595
+ type: :development
596
+ prerelease: false
597
+ version_requirements: *id053
598
+ - !ruby/object:Gem::Dependency
599
+ name: rspec-rails
600
+ requirement: &id054 !ruby/object:Gem::Requirement
601
+ none: false
602
+ requirements:
603
+ - - ~>
604
+ - !ruby/object:Gem::Version
605
+ version: 2.6.1
606
+ type: :development
607
+ prerelease: false
608
+ version_requirements: *id054
609
+ - !ruby/object:Gem::Dependency
610
+ name: yard
611
+ requirement: &id055 !ruby/object:Gem::Requirement
612
+ none: false
613
+ requirements:
614
+ - - ~>
615
+ - !ruby/object:Gem::Version
616
+ version: 0.6.0
617
+ type: :development
618
+ prerelease: false
619
+ version_requirements: *id055
620
+ - !ruby/object:Gem::Dependency
621
+ name: cucumber
622
+ requirement: &id056 !ruby/object:Gem::Requirement
623
+ none: false
624
+ requirements:
625
+ - - ">="
626
+ - !ruby/object:Gem::Version
627
+ version: "0"
628
+ type: :development
629
+ prerelease: false
630
+ version_requirements: *id056
631
+ - !ruby/object:Gem::Dependency
632
+ name: cucumber-rails
633
+ requirement: &id057 !ruby/object:Gem::Requirement
634
+ none: false
635
+ requirements:
636
+ - - ">="
637
+ - !ruby/object:Gem::Version
638
+ version: "0"
639
+ type: :development
640
+ prerelease: false
641
+ version_requirements: *id057
642
+ - !ruby/object:Gem::Dependency
643
+ name: database_cleaner
644
+ requirement: &id058 !ruby/object:Gem::Requirement
645
+ none: false
646
+ requirements:
647
+ - - ">="
648
+ - !ruby/object:Gem::Version
649
+ version: "0"
650
+ type: :development
651
+ prerelease: false
652
+ version_requirements: *id058
653
+ - !ruby/object:Gem::Dependency
654
+ name: bundler
655
+ requirement: &id059 !ruby/object:Gem::Requirement
656
+ none: false
657
+ requirements:
658
+ - - ~>
659
+ - !ruby/object:Gem::Version
660
+ version: 1.0.0
661
+ type: :development
662
+ prerelease: false
663
+ version_requirements: *id059
664
+ - !ruby/object:Gem::Dependency
665
+ name: jeweler
666
+ requirement: &id060 !ruby/object:Gem::Requirement
667
+ none: false
668
+ requirements:
669
+ - - ~>
670
+ - !ruby/object:Gem::Version
671
+ version: 1.6.3
672
+ type: :development
673
+ prerelease: false
674
+ version_requirements: *id060
675
+ - !ruby/object:Gem::Dependency
676
+ name: json
677
+ requirement: &id061 !ruby/object:Gem::Requirement
678
+ none: false
679
+ requirements:
680
+ - - ">="
681
+ - !ruby/object:Gem::Version
682
+ version: "0"
683
+ type: :development
684
+ prerelease: false
685
+ version_requirements: *id061
686
+ - !ruby/object:Gem::Dependency
687
+ name: ci_reporter
688
+ requirement: &id062 !ruby/object:Gem::Requirement
689
+ none: false
690
+ requirements:
691
+ - - ">="
692
+ - !ruby/object:Gem::Version
693
+ version: "0"
694
+ type: :development
695
+ prerelease: false
696
+ version_requirements: *id062
543
697
  description: Adds tracking to rake tasks including error capturing and logging.
544
698
  email: jeremiah@cloudspace.com
545
699
  executables: []
@@ -634,7 +788,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
634
788
  requirements:
635
789
  - - ">="
636
790
  - !ruby/object:Gem::Version
637
- hash: -290318209744097699
791
+ hash: -3026263602722594006
638
792
  segments:
639
793
  - 0
640
794
  version: "0"