days 0.0.1.earlier → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data/.gitignore +6 -0
  2. data/.rspec +2 -0
  3. data/.travis.yml +9 -0
  4. data/README.md +2 -0
  5. data/app/images/glyphicons-halflings-white.png +0 -0
  6. data/app/images/glyphicons-halflings.png +0 -0
  7. data/app/javascripts/bootstrap.js +2159 -0
  8. data/app/javascripts/bootstrap.min.js +6 -0
  9. data/app/javascripts/jquery-1.8.3.min.js +2 -0
  10. data/app/stylesheets/admin/login.scss +26 -0
  11. data/app/stylesheets/admin.scss +28 -0
  12. data/app/stylesheets/bootstrap-responsive.css +1092 -0
  13. data/app/stylesheets/bootstrap-responsive.min.css +9 -0
  14. data/app/stylesheets/bootstrap.css +6039 -0
  15. data/app/stylesheets/bootstrap.min.css +9 -0
  16. data/app/stylesheets/style.scss +132 -0
  17. data/app/views/admin/categories.haml +53 -0
  18. data/app/views/admin/entries/form.haml +55 -0
  19. data/app/views/admin/entries/index.haml +31 -0
  20. data/app/views/admin/index.haml +0 -0
  21. data/app/views/admin/login.haml +19 -0
  22. data/app/views/admin/setup.haml +22 -0
  23. data/app/views/admin/users/form.haml +25 -0
  24. data/app/views/admin/users/index.haml +23 -0
  25. data/app/views/admin.haml +37 -0
  26. data/app/views/entries.haml +4 -0
  27. data/app/views/entry.haml +32 -0
  28. data/app/views/layout.haml +32 -0
  29. data/bin/days +5 -0
  30. data/bootstrap.sh +41 -0
  31. data/days.gemspec +25 -2
  32. data/lib/days/app/admin/categories.rb +43 -0
  33. data/lib/days/app/admin/entries.rb +72 -0
  34. data/lib/days/app/admin/session.rb +28 -0
  35. data/lib/days/app/admin/setup.rb +20 -0
  36. data/lib/days/app/admin/users.rb +59 -0
  37. data/lib/days/app/admin.rb +11 -0
  38. data/lib/days/app/entries.rb +84 -0
  39. data/lib/days/app.rb +110 -0
  40. data/lib/days/command.rb +158 -0
  41. data/lib/days/config.rb +42 -0
  42. data/lib/days/helpers.rb +101 -0
  43. data/lib/days/migrate/20121221000000_create_entries.rb +18 -0
  44. data/lib/days/migrate/20121221001000_create_users.rb +12 -0
  45. data/lib/days/migrate/20121221002000_create_categories.rb +17 -0
  46. data/lib/days/migrator.rb +33 -0
  47. data/lib/days/models/category.rb +12 -0
  48. data/lib/days/models/entry.rb +63 -0
  49. data/lib/days/models/user.rb +14 -0
  50. data/lib/days/models.rb +7 -0
  51. data/lib/days/version.rb +1 -1
  52. data/lib/days.rb +3 -1
  53. data/scripts/lokka_export.rb +45 -0
  54. data/skeleton/days/Gemfile +11 -0
  55. data/skeleton/days/config.ru +6 -0
  56. data/skeleton/days/config.yml +33 -0
  57. data/skeleton/days/db/.gitkeep +0 -0
  58. data/spec/controllers/admin/categories_spec.rb +100 -0
  59. data/spec/controllers/admin/entries_spec.rb +185 -0
  60. data/spec/controllers/admin/session_spec.rb +112 -0
  61. data/spec/controllers/admin/setup_spec.rb +85 -0
  62. data/spec/controllers/admin/users_spec.rb +163 -0
  63. data/spec/controllers/entries_spec.rb +129 -0
  64. data/spec/environment/Gemfile +11 -0
  65. data/spec/environment/config.ru +6 -0
  66. data/spec/environment/config.yml +32 -0
  67. data/spec/environment/db/.gitkeep +0 -0
  68. data/spec/fixtures/categories.yml +5 -0
  69. data/spec/fixtures/entries.yml +25 -0
  70. data/spec/fixtures/users.yml +6 -0
  71. data/spec/helpers_spec.rb +117 -0
  72. data/spec/models/entry_spec.rb +238 -0
  73. data/spec/shared/admin.rb +8 -0
  74. data/spec/spec_helper.rb +134 -0
  75. data/tasks +9 -0
  76. metadata +353 -9
@@ -0,0 +1,134 @@
1
+ ENV["RACK_ENV"] ||= 'test'
2
+ require 'days'
3
+ require 'days/models'
4
+ require 'days/migrator'
5
+ require 'rack/test'
6
+ require 'active_record'
7
+ require 'active_record/fixtures'
8
+ require 'active_support/test_case'
9
+ require 'pry'
10
+
11
+ Days::App.set :environment, :test
12
+
13
+ module AppSpecHelper
14
+ include Rack::Test::Methods
15
+
16
+ def app
17
+ ::Days::App.rack
18
+ end
19
+
20
+ def response
21
+ last_response
22
+ end
23
+
24
+ def env
25
+ @env ||= {'rack.session' => session}
26
+ end
27
+
28
+ def session
29
+ @session ||= {}
30
+ end
31
+
32
+ def last_render
33
+ @renders.last
34
+ end
35
+
36
+ def render
37
+ subject; @renders.last
38
+ end
39
+
40
+ def login(user)
41
+ session.merge!(user_id: user.id)
42
+ env
43
+ end
44
+
45
+ def self.included(k)
46
+ k.module_eval do
47
+ before(:all) do
48
+ Days::App.config = RSpec.configuration.days_config
49
+ ActiveRecord::Base.logger = nil
50
+ end
51
+
52
+ before(:each) do
53
+ @renders = []
54
+ unless self.example.metadata[:render]
55
+ Days::App.any_instance.stub(:render) do |*args, &block|
56
+ @renders << {engine: args[0], data: args[1], options: args[2] || {}, locals: args[3] || {}, ivars: args[4] || {}}
57
+ ""
58
+ end
59
+ Days::App.class_eval do
60
+ alias render_orig render
61
+ def render(*args)
62
+ render_orig *args, Hash[self.instance_variables.map{ |k| [k, instance_variable_get(k)] }]
63
+ end
64
+ private :render, :render_orig
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+
72
+ module SetupAndTeardown
73
+ extend ActiveSupport::Concern
74
+ module ClassMethods
75
+ def setup(*methods)
76
+ methods.each do |m|
77
+ prepend_before do
78
+ send m
79
+ end
80
+ end
81
+ end
82
+
83
+ def teardown(*methods)
84
+ methods.each do |m|
85
+ after do
86
+ send m
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
92
+
93
+ module FixturesAdapter
94
+ extend ActiveSupport::Concern
95
+ include SetupAndTeardown
96
+ include ActiveRecord::TestFixtures
97
+
98
+ included do
99
+ self.fixture_path = "#{File.dirname(__FILE__)}/fixtures"
100
+ self.use_transactional_fixtures = false
101
+ self.use_instantiated_fixtures = true
102
+
103
+ self.fixture_class_names = Hash.new do |h, table_name|
104
+ h[table_name] = "Days::#{ActiveRecord::Fixtures.find_table_name(table_name)}"
105
+ end
106
+ end
107
+ end
108
+
109
+ RSpec.configure do |config|
110
+ config.treat_symbols_as_metadata_keys_with_true_values = true
111
+ config.run_all_when_everything_filtered = true
112
+ config.filter_run :focus
113
+ # config.order = 'random'
114
+
115
+ env = File.join(File.dirname(__FILE__), 'environment')
116
+ config.add_setting :days_env, default: env
117
+ config.add_setting :days_config, default: Days::Config.new(File.join(env, 'config.yml'))
118
+
119
+ config.before(:suite) do
120
+ Days::App.environment = ENV["RACK_ENV"] || :test
121
+ config.days_config.establish_db_connection()
122
+ Days::Migrator.start(config.days_config, verbose: true)
123
+ ActiveRecord::Base.configurations = {'test' => Hash[config.days_config.database]}
124
+ ActiveRecord::Base.logger = nil
125
+ end
126
+
127
+
128
+ config.include AppSpecHelper, type: :controller
129
+ config.include FixturesAdapter
130
+
131
+ config.tty = true
132
+ end
133
+
134
+ require_relative "./shared/admin"
data/tasks ADDED
@@ -0,0 +1,9 @@
1
+ * Show validation errors
2
+ * /admin/users
3
+ * /admin/categories
4
+ * /admin/entries
5
+ * Flash messages
6
+ * User dropdown on entries/form
7
+ * Add database level restriction
8
+ * Ugly establish on App.config =
9
+ * precompile command
metadata CHANGED
@@ -1,18 +1,66 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: days
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.earlier
5
- prerelease: 6
4
+ version: 0.1.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Shota Fukumori (sora_h)
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-17 00:00:00.000000000 Z
12
+ date: 2013-01-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.3.3
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.3.3
30
+ - !ruby/object:Gem::Dependency
31
+ name: thor
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rack_csrf
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: settingslogic
16
64
  requirement: !ruby/object:Gem::Requirement
17
65
  none: false
18
66
  requirements:
@@ -60,7 +108,23 @@ dependencies:
60
108
  - !ruby/object:Gem::Version
61
109
  version: '0'
62
110
  - !ruby/object:Gem::Dependency
63
- name: scss
111
+ name: sass
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: redcarpet
64
128
  requirement: !ruby/object:Gem::Requirement
65
129
  none: false
66
130
  requirements:
@@ -75,21 +139,284 @@ dependencies:
75
139
  - - ! '>='
76
140
  - !ruby/object:Gem::Version
77
141
  version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: builder
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :runtime
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: activerecord
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ~>
164
+ - !ruby/object:Gem::Version
165
+ version: 3.2.9
166
+ type: :runtime
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ~>
172
+ - !ruby/object:Gem::Version
173
+ version: 3.2.9
174
+ - !ruby/object:Gem::Dependency
175
+ name: kaminari
176
+ requirement: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ! '>'
180
+ - !ruby/object:Gem::Version
181
+ version: 0.13.0
182
+ type: :runtime
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>'
188
+ - !ruby/object:Gem::Version
189
+ version: 0.13.0
190
+ - !ruby/object:Gem::Dependency
191
+ name: padrino-helpers
192
+ requirement: !ruby/object:Gem::Requirement
193
+ none: false
194
+ requirements:
195
+ - - ! '>='
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ type: :runtime
199
+ prerelease: false
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ! '>='
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ - !ruby/object:Gem::Dependency
207
+ name: stringex
208
+ requirement: !ruby/object:Gem::Requirement
209
+ none: false
210
+ requirements:
211
+ - - ! '>='
212
+ - !ruby/object:Gem::Version
213
+ version: '0'
214
+ type: :runtime
215
+ prerelease: false
216
+ version_requirements: !ruby/object:Gem::Requirement
217
+ none: false
218
+ requirements:
219
+ - - ! '>='
220
+ - !ruby/object:Gem::Version
221
+ version: '0'
222
+ - !ruby/object:Gem::Dependency
223
+ name: bcrypt-ruby
224
+ requirement: !ruby/object:Gem::Requirement
225
+ none: false
226
+ requirements:
227
+ - - ! '>='
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :runtime
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ none: false
234
+ requirements:
235
+ - - ! '>='
236
+ - !ruby/object:Gem::Version
237
+ version: '0'
238
+ - !ruby/object:Gem::Dependency
239
+ name: sqlite3
240
+ requirement: !ruby/object:Gem::Requirement
241
+ none: false
242
+ requirements:
243
+ - - ! '>='
244
+ - !ruby/object:Gem::Version
245
+ version: '0'
246
+ type: :development
247
+ prerelease: false
248
+ version_requirements: !ruby/object:Gem::Requirement
249
+ none: false
250
+ requirements:
251
+ - - ! '>='
252
+ - !ruby/object:Gem::Version
253
+ version: '0'
254
+ - !ruby/object:Gem::Dependency
255
+ name: rspec
256
+ requirement: !ruby/object:Gem::Requirement
257
+ none: false
258
+ requirements:
259
+ - - ! '>='
260
+ - !ruby/object:Gem::Version
261
+ version: '0'
262
+ type: :development
263
+ prerelease: false
264
+ version_requirements: !ruby/object:Gem::Requirement
265
+ none: false
266
+ requirements:
267
+ - - ! '>='
268
+ - !ruby/object:Gem::Version
269
+ version: '0'
270
+ - !ruby/object:Gem::Dependency
271
+ name: rack-test
272
+ requirement: !ruby/object:Gem::Requirement
273
+ none: false
274
+ requirements:
275
+ - - ! '>='
276
+ - !ruby/object:Gem::Version
277
+ version: '0'
278
+ type: :development
279
+ prerelease: false
280
+ version_requirements: !ruby/object:Gem::Requirement
281
+ none: false
282
+ requirements:
283
+ - - ! '>='
284
+ - !ruby/object:Gem::Version
285
+ version: '0'
286
+ - !ruby/object:Gem::Dependency
287
+ name: fuubar
288
+ requirement: !ruby/object:Gem::Requirement
289
+ none: false
290
+ requirements:
291
+ - - ! '>='
292
+ - !ruby/object:Gem::Version
293
+ version: '0'
294
+ type: :development
295
+ prerelease: false
296
+ version_requirements: !ruby/object:Gem::Requirement
297
+ none: false
298
+ requirements:
299
+ - - ! '>='
300
+ - !ruby/object:Gem::Version
301
+ version: '0'
302
+ - !ruby/object:Gem::Dependency
303
+ name: pry
304
+ requirement: !ruby/object:Gem::Requirement
305
+ none: false
306
+ requirements:
307
+ - - ! '>='
308
+ - !ruby/object:Gem::Version
309
+ version: '0'
310
+ type: :runtime
311
+ prerelease: false
312
+ version_requirements: !ruby/object:Gem::Requirement
313
+ none: false
314
+ requirements:
315
+ - - ! '>='
316
+ - !ruby/object:Gem::Version
317
+ version: '0'
318
+ - !ruby/object:Gem::Dependency
319
+ name: pry-nav
320
+ requirement: !ruby/object:Gem::Requirement
321
+ none: false
322
+ requirements:
323
+ - - ! '>='
324
+ - !ruby/object:Gem::Version
325
+ version: '0'
326
+ type: :development
327
+ prerelease: false
328
+ version_requirements: !ruby/object:Gem::Requirement
329
+ none: false
330
+ requirements:
331
+ - - ! '>='
332
+ - !ruby/object:Gem::Version
333
+ version: '0'
78
334
  description: Simple blog system built up with Sinatra. Under in development
79
335
  email:
80
336
  - sorah@tubusu.net
81
- executables: []
337
+ executables:
338
+ - days
82
339
  extensions: []
83
340
  extra_rdoc_files: []
84
341
  files:
85
342
  - .gitignore
343
+ - .rspec
344
+ - .travis.yml
86
345
  - Gemfile
87
346
  - LICENSE.txt
88
347
  - README.md
89
348
  - Rakefile
349
+ - app/images/glyphicons-halflings-white.png
350
+ - app/images/glyphicons-halflings.png
351
+ - app/javascripts/bootstrap.js
352
+ - app/javascripts/bootstrap.min.js
353
+ - app/javascripts/jquery-1.8.3.min.js
354
+ - app/stylesheets/admin.scss
355
+ - app/stylesheets/admin/login.scss
356
+ - app/stylesheets/bootstrap-responsive.css
357
+ - app/stylesheets/bootstrap-responsive.min.css
358
+ - app/stylesheets/bootstrap.css
359
+ - app/stylesheets/bootstrap.min.css
360
+ - app/stylesheets/style.scss
361
+ - app/views/admin.haml
362
+ - app/views/admin/categories.haml
363
+ - app/views/admin/entries/form.haml
364
+ - app/views/admin/entries/index.haml
365
+ - app/views/admin/index.haml
366
+ - app/views/admin/login.haml
367
+ - app/views/admin/setup.haml
368
+ - app/views/admin/users/form.haml
369
+ - app/views/admin/users/index.haml
370
+ - app/views/entries.haml
371
+ - app/views/entry.haml
372
+ - app/views/layout.haml
373
+ - bin/days
374
+ - bootstrap.sh
90
375
  - days.gemspec
91
376
  - lib/days.rb
377
+ - lib/days/app.rb
378
+ - lib/days/app/admin.rb
379
+ - lib/days/app/admin/categories.rb
380
+ - lib/days/app/admin/entries.rb
381
+ - lib/days/app/admin/session.rb
382
+ - lib/days/app/admin/setup.rb
383
+ - lib/days/app/admin/users.rb
384
+ - lib/days/app/entries.rb
385
+ - lib/days/command.rb
386
+ - lib/days/config.rb
387
+ - lib/days/helpers.rb
388
+ - lib/days/migrate/20121221000000_create_entries.rb
389
+ - lib/days/migrate/20121221001000_create_users.rb
390
+ - lib/days/migrate/20121221002000_create_categories.rb
391
+ - lib/days/migrator.rb
392
+ - lib/days/models.rb
393
+ - lib/days/models/category.rb
394
+ - lib/days/models/entry.rb
395
+ - lib/days/models/user.rb
92
396
  - lib/days/version.rb
397
+ - scripts/lokka_export.rb
398
+ - skeleton/days/Gemfile
399
+ - skeleton/days/config.ru
400
+ - skeleton/days/config.yml
401
+ - skeleton/days/db/.gitkeep
402
+ - spec/controllers/admin/categories_spec.rb
403
+ - spec/controllers/admin/entries_spec.rb
404
+ - spec/controllers/admin/session_spec.rb
405
+ - spec/controllers/admin/setup_spec.rb
406
+ - spec/controllers/admin/users_spec.rb
407
+ - spec/controllers/entries_spec.rb
408
+ - spec/environment/Gemfile
409
+ - spec/environment/config.ru
410
+ - spec/environment/config.yml
411
+ - spec/environment/db/.gitkeep
412
+ - spec/fixtures/categories.yml
413
+ - spec/fixtures/entries.yml
414
+ - spec/fixtures/users.yml
415
+ - spec/helpers_spec.rb
416
+ - spec/models/entry_spec.rb
417
+ - spec/shared/admin.rb
418
+ - spec/spec_helper.rb
419
+ - tasks
93
420
  homepage: https://github.com/sorah/days
94
421
  licenses: []
95
422
  post_install_message:
@@ -105,13 +432,30 @@ required_ruby_version: !ruby/object:Gem::Requirement
105
432
  required_rubygems_version: !ruby/object:Gem::Requirement
106
433
  none: false
107
434
  requirements:
108
- - - ! '>'
435
+ - - ! '>='
109
436
  - !ruby/object:Gem::Version
110
- version: 1.3.1
437
+ version: '0'
111
438
  requirements: []
112
439
  rubyforge_project:
113
- rubygems_version: 1.8.24
440
+ rubygems_version: 1.8.23
114
441
  signing_key:
115
442
  specification_version: 3
116
443
  summary: Simple blog system built up with Sinatra. Under in development
117
- test_files: []
444
+ test_files:
445
+ - spec/controllers/admin/categories_spec.rb
446
+ - spec/controllers/admin/entries_spec.rb
447
+ - spec/controllers/admin/session_spec.rb
448
+ - spec/controllers/admin/setup_spec.rb
449
+ - spec/controllers/admin/users_spec.rb
450
+ - spec/controllers/entries_spec.rb
451
+ - spec/environment/Gemfile
452
+ - spec/environment/config.ru
453
+ - spec/environment/config.yml
454
+ - spec/environment/db/.gitkeep
455
+ - spec/fixtures/categories.yml
456
+ - spec/fixtures/entries.yml
457
+ - spec/fixtures/users.yml
458
+ - spec/helpers_spec.rb
459
+ - spec/models/entry_spec.rb
460
+ - spec/shared/admin.rb
461
+ - spec/spec_helper.rb