post_clerk 0.4 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +66 -21
- data/.travis.yml +10 -0
- data/Gemfile +34 -3
- data/Gemfile.lock +334 -0
- data/Guardfile +2 -4
- data/README.md +11 -6
- data/Rakefile +10 -12
- data/lib/office_clerk/post.rb +21 -16
- data/lib/post_clerk.rb +1 -1
- data/post_clerk.gemspec +2 -2
- data/spec/controllers/orders_controller_spec.rb +59 -0
- data/spec/features/orders_spec.rb +32 -0
- data/spec/lib/post_spec.rb +84 -85
- data/spec/spec_helper.rb +27 -29
- data/spec/support/admin.rb +4 -0
- data/spec/support/capybara.rb +14 -0
- data/spec/support/cleaner.rb +22 -0
- data/spec/support/email.rb +6 -0
- data/spec/support/request_helper.rb +31 -0
- data/test_app/README.rdoc +28 -0
- data/test_app/app/assets/javascripts/application.js +15 -0
- data/test_app/app/assets/stylesheets/application.css +13 -0
- data/test_app/app/controllers/application_controller.rb +5 -0
- data/test_app/app/helpers/application_helper.rb +2 -0
- data/test_app/app/views/layouts/sales_clerk.haml +9 -0
- data/test_app/bin/bundle +3 -0
- data/test_app/bin/rails +4 -0
- data/test_app/bin/rake +4 -0
- data/test_app/config/application.rb +30 -0
- data/test_app/config/boot.rb +4 -0
- data/test_app/config/database.yml +25 -0
- data/test_app/config/environment.rb +5 -0
- data/test_app/config/environments/development.rb +32 -0
- data/test_app/config/environments/production.rb +80 -0
- data/test_app/config/environments/test.rb +39 -0
- data/test_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/test_app/config/initializers/inflections.rb +16 -0
- data/test_app/config/initializers/mime_types.rb +5 -0
- data/test_app/config/initializers/secret_token.rb +12 -0
- data/test_app/config/initializers/session_store.rb +3 -0
- data/test_app/config/initializers/wrap_parameters.rb +14 -0
- data/test_app/config/locales/config.yml +22 -0
- data/test_app/config/locales/en.yml +2 -0
- data/test_app/config/routes.rb +4 -0
- data/test_app/config.ru +4 -0
- data/test_app/db/migrate/20141114205525_clerks.office.rb +16 -0
- data/test_app/db/migrate/20141114205526_suppliers.office.rb +10 -0
- data/test_app/db/migrate/20141114205527_categories.office.rb +19 -0
- data/test_app/db/migrate/20141114205528_items.office.rb +15 -0
- data/test_app/db/migrate/20141114205529_orders.office.rb +23 -0
- data/test_app/db/migrate/20141114205530_baskets.office.rb +13 -0
- data/test_app/db/migrate/20141114205531_purchases.office.rb +12 -0
- data/test_app/db/migrate/20141114205532_products.office.rb +28 -0
- data/test_app/db/schema.rb +141 -0
- data/test_app/db/seeds.rb +7 -0
- data/test_app/log/development.log +0 -0
- data/test_app/public/404.html +58 -0
- data/test_app/public/422.html +58 -0
- data/test_app/public/500.html +57 -0
- data/test_app/public/favicon.ico +0 -0
- data/test_app/public/robots.txt +5 -0
- metadata +64 -6
- data/config/locales/en.yml +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d11f486cf1b7fc92b45f1aa06816f3c1500e57c7
|
4
|
+
data.tar.gz: 2d9836b37b02330135332856c817f602d628c1c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 064b9c8b4c5f9b01918170b808314ee580867b69fa3837aecf6fbaccbb9a5145f54df33ae8a4cdc685039ce3b210919d7588f64575b1ebb62162dae3312053ec
|
7
|
+
data.tar.gz: c9b3a68ce5fe5ace40daac9d1dd61d7cbcb23955b063d38b45c0e1fe4bf61ac33996e9342366912b19156244e39dd61f3de33d1d63ede876171fce20c2ba8947
|
data/.gitignore
CHANGED
@@ -1,31 +1,76 @@
|
|
1
|
+
# bundler state
|
2
|
+
/.bundle
|
3
|
+
/vendor/bundle/
|
4
|
+
/vendor/ruby/
|
5
|
+
|
6
|
+
# minimal Rails specific artifacts
|
7
|
+
*.sqlite3
|
8
|
+
*.sqlite3-journal
|
9
|
+
/log/*
|
10
|
+
/tmp/*
|
11
|
+
.ruby-version
|
12
|
+
test_app/tmp
|
13
|
+
test_app/log
|
14
|
+
test_app/db/*.sqlite3
|
15
|
+
|
16
|
+
# configuration file introduced in Rails 4.1
|
17
|
+
/config/secrets.yml
|
18
|
+
|
19
|
+
.localeapp
|
20
|
+
|
21
|
+
# various artifacts
|
22
|
+
**.war
|
1
23
|
*.rbc
|
2
|
-
|
24
|
+
*.sassc
|
3
25
|
.rspec
|
4
|
-
/
|
5
|
-
|
6
|
-
/
|
7
|
-
/public/system
|
26
|
+
.redcar/
|
27
|
+
.sass-cache
|
28
|
+
/coverage.data
|
8
29
|
/coverage/
|
9
|
-
/
|
10
|
-
|
30
|
+
/db/*.javadb/
|
31
|
+
/db/*.sqlite3
|
32
|
+
/doc/api/
|
33
|
+
/doc/app/
|
34
|
+
/doc/features.html
|
35
|
+
/doc/specs.html
|
36
|
+
/public/cache
|
37
|
+
/public/assets
|
38
|
+
/public/stylesheets/compiled
|
39
|
+
/public/system/*
|
40
|
+
/spec/tmp/*
|
41
|
+
/cache
|
42
|
+
/capybara*
|
43
|
+
/capybara-*.html
|
44
|
+
/gems
|
45
|
+
/specifications
|
11
46
|
rerun.txt
|
12
47
|
pickle-email-*.html
|
48
|
+
.zeus.sock
|
49
|
+
webrat.log
|
50
|
+
public/images
|
51
|
+
public/extra_pictures/
|
52
|
+
public/main_pictures/
|
53
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
54
|
+
# or operating system, you probably want to add a global ignore instead:
|
55
|
+
# git config --global core.excludesfile ~/.gitignore_global
|
56
|
+
#
|
57
|
+
# Here are some files you may want to ignore globally:
|
13
58
|
|
14
|
-
#
|
15
|
-
|
16
|
-
config/secrets.yml
|
59
|
+
# scm revert files
|
60
|
+
**.orig
|
17
61
|
|
18
|
-
|
19
|
-
|
20
|
-
|
62
|
+
# Mac finder artifacts
|
63
|
+
.DS_Store
|
64
|
+
|
65
|
+
# Netbeans project directory
|
66
|
+
/nbproject/
|
21
67
|
|
22
|
-
#
|
23
|
-
|
68
|
+
# RubyMine project files
|
69
|
+
.idea
|
24
70
|
|
25
|
-
#
|
26
|
-
|
71
|
+
# Textmate project files
|
72
|
+
/*.tmproj
|
27
73
|
|
28
|
-
#
|
29
|
-
|
30
|
-
|
31
|
-
bower.json
|
74
|
+
# vim artifacts
|
75
|
+
**.swp
|
76
|
+
.localeapp
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -1,5 +1,36 @@
|
|
1
|
-
source 'https://rubygems.org
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem
|
3
|
+
gem "office_clerk" , :github => "rubyclerks/office_clerk"
|
4
|
+
#gem "office_clerk" , :path => "../office_clerk"
|
5
|
+
gem "post_clerk" , :path => "../"
|
4
6
|
|
5
|
-
|
7
|
+
gem 'sqlite3'
|
8
|
+
|
9
|
+
# those guys dropped 1.9 support, but i haven't
|
10
|
+
gem "autoprefixer-rails" , '< 6.0' , :platform => [:ruby_19]
|
11
|
+
|
12
|
+
#asset / production reelated
|
13
|
+
gem "therubyracer"
|
14
|
+
gem "libv8"
|
15
|
+
gem "rb-readline"
|
16
|
+
gem 'uglifier', '>= 1.3.0'
|
17
|
+
|
18
|
+
group :development do
|
19
|
+
gem 'better_errors' , :platforms=>[:mri_20, :mri_21, :rbx]
|
20
|
+
gem 'binding_of_caller', :platforms=>[:mri_19, :mri_20, :mri_21,:rbx]
|
21
|
+
gem 'quiet_assets'
|
22
|
+
end
|
23
|
+
group :test do
|
24
|
+
# gem "poltergeist"
|
25
|
+
# gem "phantomjs"
|
26
|
+
gem "codeclimate-test-reporter"
|
27
|
+
gem 'rspec-rails'
|
28
|
+
gem 'capybara'
|
29
|
+
gem 'capybara-screenshot'
|
30
|
+
gem 'database_cleaner'
|
31
|
+
gem "factory_girl_rails"
|
32
|
+
gem 'email_spec'
|
33
|
+
gem 'i18n-spec'
|
34
|
+
gem 'guard-rails'
|
35
|
+
gem 'guard-rspec'
|
36
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,334 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/rubyclerks/office_clerk.git
|
3
|
+
revision: 9b4b90d42bef4ea44f1f4c22d38e43c2f8c2cde3
|
4
|
+
specs:
|
5
|
+
office_clerk (0.9)
|
6
|
+
bcrypt-ruby (~> 3.1)
|
7
|
+
best_in_place (~> 3.0)
|
8
|
+
bootstrap-sass (~> 3.1)
|
9
|
+
bootstrap_form (~> 2.2)
|
10
|
+
coffee-rails (~> 4.0)
|
11
|
+
gon (~> 5.2)
|
12
|
+
haml (~> 4.0)
|
13
|
+
jquery-rails (~> 3.1)
|
14
|
+
jquery-ui-rails (~> 5.0)
|
15
|
+
kramdown (~> 1.5)
|
16
|
+
paperclip (~> 4.0)
|
17
|
+
rails (~> 4.2, < 5.0)
|
18
|
+
rails-i18n (~> 4.0)
|
19
|
+
ransack (~> 1.7)
|
20
|
+
sass-rails (~> 5.0)
|
21
|
+
valid_email (~> 0.0, >= 0.0.10)
|
22
|
+
will_paginate-bootstrap (~> 1.0)
|
23
|
+
|
24
|
+
PATH
|
25
|
+
remote: ../
|
26
|
+
specs:
|
27
|
+
post_clerk (0.5)
|
28
|
+
office_clerk (~> 0.9)
|
29
|
+
|
30
|
+
GEM
|
31
|
+
remote: https://rubygems.org/
|
32
|
+
specs:
|
33
|
+
actionmailer (4.2.5)
|
34
|
+
actionpack (= 4.2.5)
|
35
|
+
actionview (= 4.2.5)
|
36
|
+
activejob (= 4.2.5)
|
37
|
+
mail (~> 2.5, >= 2.5.4)
|
38
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
39
|
+
actionpack (4.2.5)
|
40
|
+
actionview (= 4.2.5)
|
41
|
+
activesupport (= 4.2.5)
|
42
|
+
rack (~> 1.6)
|
43
|
+
rack-test (~> 0.6.2)
|
44
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
45
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
46
|
+
actionview (4.2.5)
|
47
|
+
activesupport (= 4.2.5)
|
48
|
+
builder (~> 3.1)
|
49
|
+
erubis (~> 2.7.0)
|
50
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
51
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
52
|
+
activejob (4.2.5)
|
53
|
+
activesupport (= 4.2.5)
|
54
|
+
globalid (>= 0.3.0)
|
55
|
+
activemodel (4.2.5)
|
56
|
+
activesupport (= 4.2.5)
|
57
|
+
builder (~> 3.1)
|
58
|
+
activerecord (4.2.5)
|
59
|
+
activemodel (= 4.2.5)
|
60
|
+
activesupport (= 4.2.5)
|
61
|
+
arel (~> 6.0)
|
62
|
+
activesupport (4.2.5)
|
63
|
+
i18n (~> 0.7)
|
64
|
+
json (~> 1.7, >= 1.7.7)
|
65
|
+
minitest (~> 5.1)
|
66
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
67
|
+
tzinfo (~> 1.1)
|
68
|
+
addressable (2.3.6)
|
69
|
+
arel (6.0.3)
|
70
|
+
autoprefixer-rails (5.2.1.3)
|
71
|
+
execjs
|
72
|
+
json
|
73
|
+
bcrypt (3.1.10)
|
74
|
+
bcrypt-ruby (3.1.5)
|
75
|
+
bcrypt (>= 3.1.3)
|
76
|
+
best_in_place (3.1.0)
|
77
|
+
actionpack (>= 3.2)
|
78
|
+
railties (>= 3.2)
|
79
|
+
better_errors (2.0.0)
|
80
|
+
coderay (>= 1.0.0)
|
81
|
+
erubis (>= 2.6.6)
|
82
|
+
rack (>= 0.9.0)
|
83
|
+
binding_of_caller (0.7.2)
|
84
|
+
debug_inspector (>= 0.0.1)
|
85
|
+
bootstrap-sass (3.3.6)
|
86
|
+
autoprefixer-rails (>= 5.2.1)
|
87
|
+
sass (>= 3.3.4)
|
88
|
+
bootstrap_form (2.3.0)
|
89
|
+
builder (3.2.2)
|
90
|
+
capybara (2.4.4)
|
91
|
+
mime-types (>= 1.16)
|
92
|
+
nokogiri (>= 1.3.3)
|
93
|
+
rack (>= 1.0.0)
|
94
|
+
rack-test (>= 0.5.4)
|
95
|
+
xpath (~> 2.0)
|
96
|
+
capybara-screenshot (1.0.3)
|
97
|
+
capybara (>= 1.0, < 3)
|
98
|
+
colored
|
99
|
+
launchy
|
100
|
+
celluloid (0.16.0)
|
101
|
+
timers (~> 4.0.0)
|
102
|
+
climate_control (0.0.3)
|
103
|
+
activesupport (>= 3.0)
|
104
|
+
cocaine (0.5.8)
|
105
|
+
climate_control (>= 0.0.3, < 1.0)
|
106
|
+
codeclimate-test-reporter (0.4.1)
|
107
|
+
simplecov (>= 0.7.1, < 1.0.0)
|
108
|
+
coderay (1.1.0)
|
109
|
+
coffee-rails (4.1.0)
|
110
|
+
coffee-script (>= 2.2.0)
|
111
|
+
railties (>= 4.0.0, < 5.0)
|
112
|
+
coffee-script (2.4.1)
|
113
|
+
coffee-script-source
|
114
|
+
execjs
|
115
|
+
coffee-script-source (1.10.0)
|
116
|
+
colored (1.2)
|
117
|
+
concurrent-ruby (1.0.0)
|
118
|
+
database_cleaner (1.3.0)
|
119
|
+
debug_inspector (0.0.2)
|
120
|
+
diff-lcs (1.2.5)
|
121
|
+
docile (1.1.5)
|
122
|
+
email_spec (1.6.0)
|
123
|
+
launchy (~> 2.1)
|
124
|
+
mail (~> 2.2)
|
125
|
+
erubis (2.7.0)
|
126
|
+
execjs (2.6.0)
|
127
|
+
factory_girl (4.5.0)
|
128
|
+
activesupport (>= 3.0.0)
|
129
|
+
factory_girl_rails (4.5.0)
|
130
|
+
factory_girl (~> 4.5.0)
|
131
|
+
railties (>= 3.0.0)
|
132
|
+
ffi (1.9.6)
|
133
|
+
formatador (0.2.5)
|
134
|
+
globalid (0.3.6)
|
135
|
+
activesupport (>= 4.1.0)
|
136
|
+
gon (5.2.3)
|
137
|
+
actionpack (>= 2.3.0)
|
138
|
+
json
|
139
|
+
multi_json
|
140
|
+
request_store (>= 1.0.5)
|
141
|
+
guard (2.9.0)
|
142
|
+
formatador (>= 0.2.4)
|
143
|
+
listen (~> 2.7)
|
144
|
+
lumberjack (~> 1.0)
|
145
|
+
pry (>= 0.9.12)
|
146
|
+
thor (>= 0.18.1)
|
147
|
+
guard-rails (0.7.0)
|
148
|
+
guard (~> 2.0)
|
149
|
+
guard-rspec (4.3.1)
|
150
|
+
guard (~> 2.1)
|
151
|
+
rspec (>= 2.14, < 4.0)
|
152
|
+
haml (4.0.7)
|
153
|
+
tilt
|
154
|
+
hitimes (1.2.2)
|
155
|
+
i18n (0.7.0)
|
156
|
+
i18n-spec (0.6.0)
|
157
|
+
iso
|
158
|
+
iso (0.2.1)
|
159
|
+
i18n
|
160
|
+
jquery-rails (3.1.4)
|
161
|
+
railties (>= 3.0, < 5.0)
|
162
|
+
thor (>= 0.14, < 2.0)
|
163
|
+
jquery-ui-rails (5.0.5)
|
164
|
+
railties (>= 3.2.16)
|
165
|
+
json (1.8.3)
|
166
|
+
kramdown (1.9.0)
|
167
|
+
launchy (2.4.3)
|
168
|
+
addressable (~> 2.3)
|
169
|
+
libv8 (3.16.14.13)
|
170
|
+
listen (2.8.2)
|
171
|
+
celluloid (>= 0.15.2)
|
172
|
+
rb-fsevent (>= 0.9.3)
|
173
|
+
rb-inotify (>= 0.9)
|
174
|
+
loofah (2.0.3)
|
175
|
+
nokogiri (>= 1.5.9)
|
176
|
+
lumberjack (1.0.9)
|
177
|
+
mail (2.6.3)
|
178
|
+
mime-types (>= 1.16, < 3)
|
179
|
+
method_source (0.8.2)
|
180
|
+
mime-types (2.99)
|
181
|
+
mimemagic (0.3.0)
|
182
|
+
mini_portile (0.6.1)
|
183
|
+
minitest (5.8.3)
|
184
|
+
multi_json (1.11.2)
|
185
|
+
nokogiri (1.6.4.1)
|
186
|
+
mini_portile (~> 0.6.0)
|
187
|
+
paperclip (4.3.2)
|
188
|
+
activemodel (>= 3.2.0)
|
189
|
+
activesupport (>= 3.2.0)
|
190
|
+
cocaine (~> 0.5.5)
|
191
|
+
mime-types
|
192
|
+
mimemagic (= 0.3.0)
|
193
|
+
polyamorous (1.3.0)
|
194
|
+
activerecord (>= 3.0)
|
195
|
+
pry (0.10.1)
|
196
|
+
coderay (~> 1.1.0)
|
197
|
+
method_source (~> 0.8.1)
|
198
|
+
slop (~> 3.4)
|
199
|
+
quiet_assets (1.0.3)
|
200
|
+
railties (>= 3.1, < 5.0)
|
201
|
+
rack (1.6.4)
|
202
|
+
rack-test (0.6.3)
|
203
|
+
rack (>= 1.0)
|
204
|
+
rails (4.2.5)
|
205
|
+
actionmailer (= 4.2.5)
|
206
|
+
actionpack (= 4.2.5)
|
207
|
+
actionview (= 4.2.5)
|
208
|
+
activejob (= 4.2.5)
|
209
|
+
activemodel (= 4.2.5)
|
210
|
+
activerecord (= 4.2.5)
|
211
|
+
activesupport (= 4.2.5)
|
212
|
+
bundler (>= 1.3.0, < 2.0)
|
213
|
+
railties (= 4.2.5)
|
214
|
+
sprockets-rails
|
215
|
+
rails-deprecated_sanitizer (1.0.3)
|
216
|
+
activesupport (>= 4.2.0.alpha)
|
217
|
+
rails-dom-testing (1.0.7)
|
218
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
219
|
+
nokogiri (~> 1.6.0)
|
220
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
221
|
+
rails-html-sanitizer (1.0.2)
|
222
|
+
loofah (~> 2.0)
|
223
|
+
rails-i18n (4.0.7)
|
224
|
+
i18n (~> 0.7)
|
225
|
+
railties (~> 4.0)
|
226
|
+
railties (4.2.5)
|
227
|
+
actionpack (= 4.2.5)
|
228
|
+
activesupport (= 4.2.5)
|
229
|
+
rake (>= 0.8.7)
|
230
|
+
thor (>= 0.18.1, < 2.0)
|
231
|
+
rake (10.4.2)
|
232
|
+
ransack (1.7.0)
|
233
|
+
actionpack (>= 3.0)
|
234
|
+
activerecord (>= 3.0)
|
235
|
+
activesupport (>= 3.0)
|
236
|
+
i18n
|
237
|
+
polyamorous (~> 1.2)
|
238
|
+
rb-fsevent (0.9.4)
|
239
|
+
rb-inotify (0.9.5)
|
240
|
+
ffi (>= 0.5.0)
|
241
|
+
rb-readline (0.5.1)
|
242
|
+
ref (1.0.5)
|
243
|
+
request_store (1.2.1)
|
244
|
+
rspec (3.1.0)
|
245
|
+
rspec-core (~> 3.1.0)
|
246
|
+
rspec-expectations (~> 3.1.0)
|
247
|
+
rspec-mocks (~> 3.1.0)
|
248
|
+
rspec-core (3.1.7)
|
249
|
+
rspec-support (~> 3.1.0)
|
250
|
+
rspec-expectations (3.1.2)
|
251
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
252
|
+
rspec-support (~> 3.1.0)
|
253
|
+
rspec-mocks (3.1.3)
|
254
|
+
rspec-support (~> 3.1.0)
|
255
|
+
rspec-rails (3.1.0)
|
256
|
+
actionpack (>= 3.0)
|
257
|
+
activesupport (>= 3.0)
|
258
|
+
railties (>= 3.0)
|
259
|
+
rspec-core (~> 3.1.0)
|
260
|
+
rspec-expectations (~> 3.1.0)
|
261
|
+
rspec-mocks (~> 3.1.0)
|
262
|
+
rspec-support (~> 3.1.0)
|
263
|
+
rspec-support (3.1.2)
|
264
|
+
sass (3.4.20)
|
265
|
+
sass-rails (5.0.4)
|
266
|
+
railties (>= 4.0.0, < 5.0)
|
267
|
+
sass (~> 3.1)
|
268
|
+
sprockets (>= 2.8, < 4.0)
|
269
|
+
sprockets-rails (>= 2.0, < 4.0)
|
270
|
+
tilt (>= 1.1, < 3)
|
271
|
+
simplecov (0.9.1)
|
272
|
+
docile (~> 1.1.0)
|
273
|
+
multi_json (~> 1.0)
|
274
|
+
simplecov-html (~> 0.8.0)
|
275
|
+
simplecov-html (0.8.0)
|
276
|
+
slop (3.6.0)
|
277
|
+
sprockets (3.5.2)
|
278
|
+
concurrent-ruby (~> 1.0)
|
279
|
+
rack (> 1, < 3)
|
280
|
+
sprockets-rails (2.3.3)
|
281
|
+
actionpack (>= 3.0)
|
282
|
+
activesupport (>= 3.0)
|
283
|
+
sprockets (>= 2.8, < 4.0)
|
284
|
+
sqlite3 (1.3.10)
|
285
|
+
therubyracer (0.12.1)
|
286
|
+
libv8 (~> 3.16.14.0)
|
287
|
+
ref
|
288
|
+
thor (0.19.1)
|
289
|
+
thread_safe (0.3.5)
|
290
|
+
tilt (2.0.1)
|
291
|
+
timers (4.0.1)
|
292
|
+
hitimes
|
293
|
+
tzinfo (1.2.2)
|
294
|
+
thread_safe (~> 0.1)
|
295
|
+
uglifier (2.5.3)
|
296
|
+
execjs (>= 0.3.0)
|
297
|
+
json (>= 1.8.0)
|
298
|
+
valid_email (0.0.11)
|
299
|
+
activemodel
|
300
|
+
mail (~> 2.6.1)
|
301
|
+
will_paginate (3.0.7)
|
302
|
+
will_paginate-bootstrap (1.0.1)
|
303
|
+
will_paginate (>= 3.0.3)
|
304
|
+
xpath (2.0.0)
|
305
|
+
nokogiri (~> 1.3)
|
306
|
+
|
307
|
+
PLATFORMS
|
308
|
+
ruby
|
309
|
+
|
310
|
+
DEPENDENCIES
|
311
|
+
autoprefixer-rails (< 6.0)
|
312
|
+
better_errors
|
313
|
+
binding_of_caller
|
314
|
+
capybara
|
315
|
+
capybara-screenshot
|
316
|
+
codeclimate-test-reporter
|
317
|
+
database_cleaner
|
318
|
+
email_spec
|
319
|
+
factory_girl_rails
|
320
|
+
guard-rails
|
321
|
+
guard-rspec
|
322
|
+
i18n-spec
|
323
|
+
libv8
|
324
|
+
office_clerk!
|
325
|
+
post_clerk!
|
326
|
+
quiet_assets
|
327
|
+
rb-readline
|
328
|
+
rspec-rails
|
329
|
+
sqlite3
|
330
|
+
therubyracer
|
331
|
+
uglifier (>= 1.3.0)
|
332
|
+
|
333
|
+
BUNDLED WITH
|
334
|
+
1.10.6
|
data/Guardfile
CHANGED
@@ -4,10 +4,8 @@ group :red_green_refactor, halt_on_fail: true do
|
|
4
4
|
watch('spec/spec_helper.rb') { 'spec' }
|
5
5
|
watch(%r{^spec/(.+)_spec\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
6
6
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
7
|
+
# locales
|
8
|
+
watch(%r{^config/locales/.*yml}) { |m| "spec/i18n_spec.rb" }
|
7
9
|
end
|
8
10
|
|
9
|
-
guard :rubocop, all_on_start: false, cli: ['--format', 'clang', '--rails'] do
|
10
|
-
watch(%r{.+\.rb$})
|
11
|
-
watch(%r{(?:.+/)?\.(rubocop|hound)\.yml$}) { |m| File.dirname(m[0]) }
|
12
|
-
end
|
13
11
|
end
|
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/rubyclerks/post_clerk.svg?branch=master)](https://travis-ci.org/rubyclerks/post_clerk)
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/post_clerk.svg)](http://badge.fury.io/rb/post_clerk)
|
3
|
+
[![Code Climate](https://codeclimate.com/github/rubyclerks/post_clerk/badges/gpa.svg)](https://codeclimate.com/github/rubyclerks/post_clerk)
|
4
|
+
[![Test Coverage](https://codeclimate.com/github/rubyclerks/post_clerk/badges/coverage.svg)](https://codeclimate.com/github/rubyclerks/post_clerk)
|
5
|
+
|
1
6
|
# Post Clerk
|
2
7
|
|
3
|
-
A postal service
|
8
|
+
A postal service delivers based on weight only. Like most post services in Europe will.
|
4
9
|
|
5
10
|
This extension adds a office_clerk/shipping_method model to do this.
|
6
11
|
|
@@ -30,24 +35,24 @@ Add a config/locale/config.yml with the data for the calculator (s)
|
|
30
35
|
|
31
36
|
With the default settings (measurements in kg and cm):
|
32
37
|
|
33
|
-
- Max weight of one item:
|
38
|
+
- Max weight of one item: 20
|
34
39
|
- Default weight: 1kg (applies when product weight is 0)
|
35
40
|
- Handling fee: 0
|
36
41
|
- Amount, over which handling fee won't be applied: 50
|
37
|
-
- Max total of the order:
|
42
|
+
- Max total of the order: 100.0
|
38
43
|
- Weights (space separated): 1 2 5 10 20
|
39
44
|
- Prices (space separated): 2 5 10 15 18
|
40
45
|
|
41
46
|
|
42
|
-
The Shipping method does not apply to the order if any items weighs more than
|
47
|
+
The Shipping method does not apply to the order if any items weighs more than 20 kg.
|
43
48
|
|
44
49
|
## Cost examples
|
45
50
|
|
46
|
-
- Items weighing 10 kg of worth
|
51
|
+
- Items weighing 10 kg of worth 90 Euros will cost 15 Euros.
|
47
52
|
- Items weighing 10 kg of worth 40 Euros will cost 25 Euros (15 + 10 handling).
|
48
53
|
- Items weighing less than 1 kg of worth 60 Euros will cost 6 Euros.
|
49
54
|
- Items weighing less than 1 kg of worth 40 Euros will cost 16 Euros (6 + 10).
|
50
|
-
- Items weighing 25 kg of worth
|
55
|
+
- Items weighing 25 kg of worth 90 Euros will cost 30 Euros (2 packages, 18 + 12 Euro).
|
51
56
|
- 3 items without weight information of worth 100 euros will cost 12 Euro.
|
52
57
|
- Any amount of items costing more than the max_price will cost 0 Euro.
|
53
58
|
|
data/Rakefile
CHANGED
@@ -1,16 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Bundler.setup
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
3
|
|
5
|
-
require '
|
6
|
-
require 'office_clerk/testing_support/common_rake'
|
4
|
+
require File.expand_path('../test_app/config/application', __FILE__)
|
7
5
|
|
8
|
-
|
6
|
+
TestApp::Application.load_tasks
|
7
|
+
require 'bundler/gem_tasks'
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
task :test_app do
|
14
|
-
ENV['LIB_NAME'] = 'post_clerk'
|
15
|
-
Rake::Task['common:test_app'].invoke
|
9
|
+
desc 'Rebuild test and run specs'
|
10
|
+
task :full_test do
|
11
|
+
system("rake db:drop db:migrate RAILS_ENV=test && rspec")
|
16
12
|
end
|
13
|
+
|
14
|
+
task :default => 'full_test'
|
data/lib/office_clerk/post.rb
CHANGED
@@ -3,25 +3,16 @@ module OfficeClerk
|
|
3
3
|
|
4
4
|
DEFAULTS ={ :weight_table => '1 2 5 10 20' ,
|
5
5
|
:price_table => '2 5 10 15 18' ,
|
6
|
-
:max_item_weight => "
|
7
|
-
:max_price => "
|
6
|
+
:max_item_weight => "20" ,
|
7
|
+
:max_price => "100" ,
|
8
8
|
:handling_max => "20" ,
|
9
|
-
:handling_fee => "
|
9
|
+
:handling_fee => "0" ,
|
10
10
|
:default_weight => "1" }
|
11
11
|
|
12
12
|
def initialize data
|
13
13
|
super DEFAULTS.merge(data)
|
14
|
-
|
15
|
-
|
16
|
-
@max_item_weight = @data[:max_item_weight].to_f || 18.0
|
17
|
-
@max_price = @data[:max_price].to_f || 120.0
|
18
|
-
@handling_max = @data[:handling_max].to_f || 20.0
|
19
|
-
@handling_fee = @data[:handling_fee].to_f || 2.0
|
20
|
-
@default_weight = @data[:default_weight].to_f || 1.0
|
21
|
-
raise "Could not parse weights #{@data[:weight_table]} for #{key}" if @weights.empty?
|
22
|
-
raise "Could not parse weights #{@data[:weight_table]} for #{key}" if @weights.include?(nil)
|
23
|
-
raise "Could not parse prices #{@data[:price_table]} for #{key}" if @prices.empty?
|
24
|
-
raise "Could not parse prices #{@data[:price_table]} for #{key}" if @prices.include?(nil)
|
14
|
+
set_members
|
15
|
+
check_values!
|
25
16
|
end
|
26
17
|
attr_reader :prices , :weights , :max_item_weight , :max_price , :handling_fee , :handling_max , :default_weight
|
27
18
|
|
@@ -37,8 +28,7 @@ module OfficeClerk
|
|
37
28
|
|
38
29
|
def price_for(basket)
|
39
30
|
total_price = basket.total_price
|
40
|
-
return 0.0 if total_price > max_price
|
41
|
-
|
31
|
+
return 0.0 if total_price > self.max_price
|
42
32
|
total_weight = basket.items.map {|item| item.quantity * (item.product.weight || default_weight) }.reduce(:+) || 0.0
|
43
33
|
shipping = 0
|
44
34
|
|
@@ -64,5 +54,20 @@ module OfficeClerk
|
|
64
54
|
def calc_handling_fee(total_price)
|
65
55
|
handling_max < total_price ? 0 : handling_fee
|
66
56
|
end
|
57
|
+
private
|
58
|
+
def set_members
|
59
|
+
@prices = @data[:price_table].split.map(&:to_f)
|
60
|
+
@weights = @data[:weight_table].split.map(&:to_f)
|
61
|
+
@max_item_weight = @data[:max_item_weight].to_f || 18.0
|
62
|
+
@max_price = @data[:max_price].to_f || 100.0
|
63
|
+
@handling_max = @data[:handling_max].to_f || 20.0
|
64
|
+
@handling_fee = @data[:handling_fee].to_f || 2.0
|
65
|
+
@default_weight = @data[:default_weight].to_f || 1.0
|
66
|
+
end
|
67
|
+
def check_values!
|
68
|
+
raise "Could not parse weights #{@weights}" if @weights.empty? or @weights.include?(nil)
|
69
|
+
raise "Could not parse prices #{@prices}" if @prices.empty? or @prices.include?(nil)
|
70
|
+
raise "Price length #{@prices.length} and weight length #{@weights.length} differ" if @weights.length != @prices.length
|
71
|
+
end
|
67
72
|
end
|
68
73
|
end
|
data/lib/post_clerk.rb
CHANGED
data/post_clerk.gemspec
CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.platform = Gem::Platform::RUBY
|
7
7
|
s.name = 'post_clerk'
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.5"
|
9
9
|
s.summary = 'Calculate weight based charges for a OfficeClerk basket'
|
10
10
|
s.description = s.summary
|
11
11
|
s.required_ruby_version = '>= 1.9.3'
|
@@ -22,6 +22,6 @@ Gem::Specification.new do |s|
|
|
22
22
|
|
23
23
|
s.has_rdoc = false
|
24
24
|
|
25
|
-
s.add_runtime_dependency 'office_clerk', '~> 0.
|
25
|
+
s.add_runtime_dependency 'office_clerk', '~> 0.9'
|
26
26
|
|
27
27
|
end
|