acts_as_bookable 0.1.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.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +2 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +43 -0
  6. data/Appraisals +21 -0
  7. data/Gemfile +21 -0
  8. data/Gemfile.lock +168 -0
  9. data/Guardfile +5 -0
  10. data/MIT-LICENSE +20 -0
  11. data/README.md +473 -0
  12. data/Rakefile +19 -0
  13. data/acts_as_bookable.gemspec +41 -0
  14. data/app/assets/images/acts_as_bookable/.keep +0 -0
  15. data/app/assets/javascripts/acts_as_bookable/application.js +13 -0
  16. data/app/assets/stylesheets/acts_as_bookable/application.css +15 -0
  17. data/app/controllers/acts_as_bookable/application_controller.rb +4 -0
  18. data/app/helpers/acts_as_bookable/application_helper.rb +4 -0
  19. data/app/views/layouts/acts_as_bookable/application.html.erb +14 -0
  20. data/bin/rails +12 -0
  21. data/config/locales/en.yml +12 -0
  22. data/config/routes.rb +2 -0
  23. data/db/migrate/20160217085200_create_acts_as_bookable_bookings.rb +14 -0
  24. data/gemfiles/activerecord_3.2.gemfile +16 -0
  25. data/gemfiles/activerecord_4.0.gemfile +16 -0
  26. data/gemfiles/activerecord_4.1.gemfile +16 -0
  27. data/gemfiles/activerecord_4.2.gemfile +17 -0
  28. data/gemfiles/activerecord_5.0.gemfile +17 -0
  29. data/lib/acts_as_bookable/bookable/core.rb +285 -0
  30. data/lib/acts_as_bookable/bookable.rb +56 -0
  31. data/lib/acts_as_bookable/booker.rb +70 -0
  32. data/lib/acts_as_bookable/booking.rb +54 -0
  33. data/lib/acts_as_bookable/db_utils.rb +39 -0
  34. data/lib/acts_as_bookable/engine.rb +5 -0
  35. data/lib/acts_as_bookable/t.rb +11 -0
  36. data/lib/acts_as_bookable/time_utils.rb +135 -0
  37. data/lib/acts_as_bookable/version.rb +3 -0
  38. data/lib/acts_as_bookable.rb +42 -0
  39. data/lib/tasks/acts_as_bookable_tasks.rake +4 -0
  40. data/spec/acts_as_bookable/acts_as_bookable_spec.rb +52 -0
  41. data/spec/acts_as_bookable/acts_as_booker_spec.rb +57 -0
  42. data/spec/acts_as_bookable/bookable/core_spec.rb +593 -0
  43. data/spec/acts_as_bookable/bookable_spec.rb +124 -0
  44. data/spec/acts_as_bookable/booker_spec.rb +140 -0
  45. data/spec/acts_as_bookable/booking_spec.rb +241 -0
  46. data/spec/acts_as_bookable/schedule_spec.rb +137 -0
  47. data/spec/acts_as_bookable/time_utils_spec.rb +525 -0
  48. data/spec/factories/bookable.rb +7 -0
  49. data/spec/factories/booker.rb +5 -0
  50. data/spec/factories/room.rb +11 -0
  51. data/spec/internal/app/models/Bookable.rb +3 -0
  52. data/spec/internal/app/models/Booker.rb +3 -0
  53. data/spec/internal/app/models/Event.rb +3 -0
  54. data/spec/internal/app/models/Generic.rb +2 -0
  55. data/spec/internal/app/models/NotBooker.rb +2 -0
  56. data/spec/internal/app/models/Room.rb +3 -0
  57. data/spec/internal/app/models/Show.rb +3 -0
  58. data/spec/internal/app/models/Unbookable.rb +2 -0
  59. data/spec/internal/config/database.yml.sample +17 -0
  60. data/spec/internal/db/schema.rb +51 -0
  61. data/spec/spec_helper.rb +26 -0
  62. data/spec/support/0-helpers.rb +32 -0
  63. data/spec/support/1-database.rb +42 -0
  64. data/spec/support/2-database_cleaner.rb +21 -0
  65. data/spec/support/3-factory_girl.rb +12 -0
  66. metadata +296 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 46007420d7fa9800a6b6d31202bc306702f38f02
4
+ data.tar.gz: 0a0c5fc00feaa8092c3abc14aeb3ed4d374989a7
5
+ SHA512:
6
+ metadata.gz: 07fa09943cf5eb6416ad5ea116530546d6413e24e3c339dbbd270d6711fa8fdbbfa1f698bb131096feceebbf2eab74d0be767c292a23b5e81332487af6885b26
7
+ data.tar.gz: b16acfa084dfa57117a4f88d9d27e0fcc529c8748769080f70c8f44ffaf49e412dd4e3b8db5524f0e5f64c1cbc066948660d82c4191068529393b59dd2f09132
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ *.log
2
+ *.sqlite3
3
+ /pkg/*
4
+ .bundle
5
+ .ruby-version
6
+ spec/internal/config/database.yml
7
+ tmp*.sw?
8
+ *.sw?
9
+ tmp
10
+ *.gem
11
+ *.lock
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --backtrace
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.3.0
data/.travis.yml ADDED
@@ -0,0 +1,43 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.3.0
5
+ - 2.2.2
6
+ - 2.1
7
+ - 2.0.0
8
+ - rbx-2
9
+
10
+ env:
11
+ - DB=sqlite3
12
+ - DB=mysql
13
+ - DB=postgresql
14
+
15
+ gemfile:
16
+ - gemfiles/activerecord_3.2.gemfile
17
+ - gemfiles/activerecord_4.0.gemfile
18
+ - gemfiles/activerecord_4.1.gemfile
19
+ - gemfiles/activerecord_4.2.gemfile
20
+ - gemfiles/activerecord_5.0.gemfile
21
+
22
+ sudo: false
23
+
24
+ bundler_args: '--without local_development --jobs 3 --retry 3'
25
+
26
+ script: bundle exec rake
27
+
28
+ matrix:
29
+ fast_finish: true
30
+ allow_failures:
31
+ - gemfile: gemfiles/activerecord_edge.gemfile
32
+ - rvm: rbx-2
33
+ exclude:
34
+ - rvm: 2.2.2
35
+ gemfile: gemfiles/activerecord_3.2.gemfile
36
+ - rvm: rbx-2
37
+ gemfile: gemfiles/activerecord_3.2.gemfile
38
+ - rvm: 2.1
39
+ gemfile: gemfiles/activerecord_5.0.gemfile
40
+ - rvm: 2.0.0
41
+ gemfile: gemfiles/activerecord_5.0.gemfile
42
+ - rvm: rbx-2
43
+ gemfile: gemfiles/activerecord_5.0.gemfile
data/Appraisals ADDED
@@ -0,0 +1,21 @@
1
+ appraise "activerecord-3.2" do
2
+ gem "activerecord", github: "rails/rails" , branch: '3-2-stable'
3
+ end
4
+
5
+ appraise "activerecord-4.0" do
6
+ gem "activerecord", github: "rails/rails" , branch: '4-0-stable'
7
+ end
8
+
9
+ appraise "activerecord-4.1" do
10
+ gem "activerecord", github: "rails/rails" , branch: '4-1-stable'
11
+ end
12
+
13
+ appraise "activerecord-4.2" do
14
+ gem "railties", github: "rails/rails" , branch: '4-2-stable'
15
+ gem "activerecord", github: "rails/rails" , branch: '4-2-stable'
16
+ end
17
+
18
+ appraise "activerecord-5.0" do
19
+ gem "railties", github: "rails/rails" , branch: 'master'
20
+ gem "activerecord", github: "rails/rails" , branch: 'master'
21
+ end
data/Gemfile ADDED
@@ -0,0 +1,21 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Declare your gem's dependencies in acts_as_bookable.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
7
+
8
+ # Declare any dependencies that are still in development here instead of in
9
+ # your gemspec. These might include edge Rails or gems from your path or
10
+ # Git. Remember to move these dependencies to your gemspec before releasing
11
+ # your gem to rubygems.org.
12
+
13
+ # To use a debugger
14
+ group :local_development do
15
+ gem 'guard'
16
+ gem 'guard-rspec'
17
+ gem 'appraisal'
18
+ gem 'rake'
19
+ gem 'byebug' , platform: :mri_21
20
+ gem 'pry-nav'
21
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,168 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ acts_as_bookable (0.1.0)
5
+ activerecord (>= 3.2, < 5)
6
+ ice_cube_chosko (~> 0.1.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionpack (4.2.5.1)
12
+ actionview (= 4.2.5.1)
13
+ activesupport (= 4.2.5.1)
14
+ rack (~> 1.6)
15
+ rack-test (~> 0.6.2)
16
+ rails-dom-testing (~> 1.0, >= 1.0.5)
17
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
18
+ actionview (4.2.5.1)
19
+ activesupport (= 4.2.5.1)
20
+ builder (~> 3.1)
21
+ erubis (~> 2.7.0)
22
+ rails-dom-testing (~> 1.0, >= 1.0.5)
23
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
24
+ activemodel (4.2.5.1)
25
+ activesupport (= 4.2.5.1)
26
+ builder (~> 3.1)
27
+ activerecord (4.2.5.1)
28
+ activemodel (= 4.2.5.1)
29
+ activesupport (= 4.2.5.1)
30
+ arel (~> 6.0)
31
+ activesupport (4.2.5.1)
32
+ i18n (~> 0.7)
33
+ json (~> 1.7, >= 1.7.7)
34
+ minitest (~> 5.1)
35
+ thread_safe (~> 0.3, >= 0.3.4)
36
+ tzinfo (~> 1.1)
37
+ appraisal (2.1.0)
38
+ bundler
39
+ rake
40
+ thor (>= 0.14.0)
41
+ arel (6.0.3)
42
+ awesome_print (1.6.1)
43
+ barrier (1.0.2)
44
+ builder (3.2.2)
45
+ byebug (8.2.2)
46
+ coderay (1.1.0)
47
+ database_cleaner (1.5.1)
48
+ diff-lcs (1.2.5)
49
+ erubis (2.7.0)
50
+ factory_girl (4.5.0)
51
+ activesupport (>= 3.0.0)
52
+ factory_girl_rails (4.6.0)
53
+ factory_girl (~> 4.5.0)
54
+ railties (>= 3.0.0)
55
+ ffi (1.9.10)
56
+ formatador (0.2.5)
57
+ guard (2.13.0)
58
+ formatador (>= 0.2.4)
59
+ listen (>= 2.7, <= 4.0)
60
+ lumberjack (~> 1.0)
61
+ nenv (~> 0.1)
62
+ notiffany (~> 0.0)
63
+ pry (>= 0.9.12)
64
+ shellany (~> 0.0)
65
+ thor (>= 0.18.1)
66
+ guard-compat (1.2.1)
67
+ guard-rspec (4.6.4)
68
+ guard (~> 2.1)
69
+ guard-compat (~> 1.1)
70
+ rspec (>= 2.99.0, < 4.0)
71
+ i18n (0.7.0)
72
+ ice_cube_chosko (0.1.0)
73
+ json (1.8.3)
74
+ listen (3.0.6)
75
+ rb-fsevent (>= 0.9.3)
76
+ rb-inotify (>= 0.9.7)
77
+ loofah (2.0.3)
78
+ nokogiri (>= 1.5.9)
79
+ lumberjack (1.0.10)
80
+ method_source (0.8.2)
81
+ mini_portile2 (2.0.0)
82
+ minitest (5.8.4)
83
+ mysql2 (0.3.20)
84
+ nenv (0.3.0)
85
+ nokogiri (1.6.7.2)
86
+ mini_portile2 (~> 2.0.0.rc2)
87
+ notiffany (0.0.8)
88
+ nenv (~> 0.1)
89
+ shellany (~> 0.0)
90
+ pg (0.18.4)
91
+ pry (0.10.3)
92
+ coderay (~> 1.1.0)
93
+ method_source (~> 0.8.1)
94
+ slop (~> 3.4)
95
+ pry-nav (0.2.4)
96
+ pry (>= 0.9.10, < 0.11.0)
97
+ rack (1.6.4)
98
+ rack-test (0.6.3)
99
+ rack (>= 1.0)
100
+ rails-deprecated_sanitizer (1.0.3)
101
+ activesupport (>= 4.2.0.alpha)
102
+ rails-dom-testing (1.0.7)
103
+ activesupport (>= 4.2.0.beta, < 5.0)
104
+ nokogiri (~> 1.6.0)
105
+ rails-deprecated_sanitizer (>= 1.0.1)
106
+ rails-html-sanitizer (1.0.3)
107
+ loofah (~> 2.0)
108
+ railties (4.2.5.1)
109
+ actionpack (= 4.2.5.1)
110
+ activesupport (= 4.2.5.1)
111
+ rake (>= 0.8.7)
112
+ thor (>= 0.18.1, < 2.0)
113
+ rake (10.5.0)
114
+ rb-fsevent (0.9.7)
115
+ rb-inotify (0.9.7)
116
+ ffi (>= 0.5.0)
117
+ rspec (3.4.0)
118
+ rspec-core (~> 3.4.0)
119
+ rspec-expectations (~> 3.4.0)
120
+ rspec-mocks (~> 3.4.0)
121
+ rspec-core (3.4.2)
122
+ rspec-support (~> 3.4.0)
123
+ rspec-expectations (3.4.0)
124
+ diff-lcs (>= 1.2.0, < 2.0)
125
+ rspec-support (~> 3.4.0)
126
+ rspec-mocks (3.4.1)
127
+ diff-lcs (>= 1.2.0, < 2.0)
128
+ rspec-support (~> 3.4.0)
129
+ rspec-rails (3.4.2)
130
+ actionpack (>= 3.0, < 4.3)
131
+ activesupport (>= 3.0, < 4.3)
132
+ railties (>= 3.0, < 4.3)
133
+ rspec-core (~> 3.4.0)
134
+ rspec-expectations (~> 3.4.0)
135
+ rspec-mocks (~> 3.4.0)
136
+ rspec-support (~> 3.4.0)
137
+ rspec-support (3.4.1)
138
+ shellany (0.0.1)
139
+ slop (3.6.0)
140
+ sqlite3 (1.3.11)
141
+ thor (0.19.1)
142
+ thread_safe (0.3.5)
143
+ tzinfo (1.2.2)
144
+ thread_safe (~> 0.1)
145
+
146
+ PLATFORMS
147
+ ruby
148
+
149
+ DEPENDENCIES
150
+ acts_as_bookable!
151
+ appraisal
152
+ awesome_print
153
+ barrier
154
+ byebug
155
+ database_cleaner
156
+ factory_girl_rails
157
+ guard
158
+ guard-rspec
159
+ mysql2 (~> 0.3.7)
160
+ pg
161
+ pry-nav
162
+ rake
163
+ rspec
164
+ rspec-rails
165
+ sqlite3
166
+
167
+ BUNDLED WITH
168
+ 1.11.2
data/Guardfile ADDED
@@ -0,0 +1,5 @@
1
+ guard :rspec, cmd: "bundle exec rspec" do
2
+ watch(%r{^spec/.+_spec\.rb})
3
+ watch(%r{^lib/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { "spec" }
5
+ end
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2016 Tandù srl
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.