mongosteen 0.1.8 → 0.2.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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +57 -57
  3. data/LICENSE.md +1 -1
  4. data/README.md +14 -5
  5. data/TODO.md +9 -0
  6. data/lib/mongosteen.rb +1 -11
  7. data/lib/mongosteen/actions.rb +13 -8
  8. data/lib/mongosteen/base_helpers.rb +28 -37
  9. data/lib/mongosteen/class_methods.rb +20 -5
  10. data/lib/mongosteen/version.rb +1 -1
  11. data/mongosteen.gemspec +20 -20
  12. data/test/rails_app/config/mongoid.yml +1 -1
  13. metadata +32 -54
  14. data/test/rails_app/app/assets/images/.keep +0 -0
  15. data/test/rails_app/app/assets/javascripts/application.js +0 -16
  16. data/test/rails_app/app/assets/stylesheets/application.css +0 -15
  17. data/test/rails_app/app/controllers/concerns/.keep +0 -0
  18. data/test/rails_app/app/helpers/application_helper.rb +0 -2
  19. data/test/rails_app/app/mailers/.keep +0 -0
  20. data/test/rails_app/app/models/concerns/.keep +0 -0
  21. data/test/rails_app/app/views/layouts/application.html.erb +0 -14
  22. data/test/rails_app/bin/bundle +0 -3
  23. data/test/rails_app/bin/rails +0 -8
  24. data/test/rails_app/bin/rake +0 -8
  25. data/test/rails_app/bin/setup +0 -29
  26. data/test/rails_app/bin/spring +0 -15
  27. data/test/rails_app/db/seeds.rb +0 -7
  28. data/test/rails_app/lib/assets/.keep +0 -0
  29. data/test/rails_app/lib/tasks/.keep +0 -0
  30. data/test/rails_app/public/404.html +0 -67
  31. data/test/rails_app/public/422.html +0 -67
  32. data/test/rails_app/public/500.html +0 -66
  33. data/test/rails_app/public/favicon.ico +0 -0
  34. data/test/rails_app/public/robots.txt +0 -5
  35. data/test/rails_app/vendor/assets/javascripts/.keep +0 -0
  36. data/test/rails_app/vendor/assets/stylesheets/.keep +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 325065f2760805276ab8edd204e936e5432454e3
4
- data.tar.gz: a403374a18b9d16305e4b5d41afc6c2c637159f8
3
+ metadata.gz: 08cf151e85ea0382ac854035799f0e338b61681d
4
+ data.tar.gz: 7083d727c0787f7fe6ce53781ba83ecba8251346
5
5
  SHA512:
6
- metadata.gz: ef6cb8f0f688f1e03d823ea8916bbad5cbf1f40523805030cc58967fc1eab5ea8d269dd2e6897c7075d68af74c54829a41089fc31ebbc575f2068e66013eb7ae
7
- data.tar.gz: 1463a325e93a5fb6b398afe82c83b310b76217003d882762ec03e0adbddbaca7a84f7bf1e1a8681e2762345dfce070e7ce152bd9cc5df7ec4dd499978ecbf100
6
+ metadata.gz: d7d20b67098846d208558ed1301227ddb312c7c857ddfbb87f272757887a1fd8f9cf7f35f622a57080db3a39b2a5d4ac676017c381ca2c063aa6bccbe6bef02c
7
+ data.tar.gz: 9f52d7ca51cdacf04d1ce7947eaac32517add219de9bf990ae0fe6ded3e97521b283c08ccd3ab4b43936687a624d373529f3401ca4fdcd88e74249095c8638b5
@@ -1,47 +1,47 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongosteen (0.1.8)
5
- has_scope (> 0.5)
4
+ mongosteen (0.2.0)
5
+ has_scope (>= 0.6)
6
6
  inherited_resources (>= 1.6)
7
7
  kaminari (>= 0.16)
8
- mongoid (>= 4.0)
9
- mongoid-history (>= 0.4.5)
8
+ mongoid (>= 5.0)
9
+ mongoid-history (>= 0.5.0)
10
10
  mongoid_search (>= 0.3)
11
11
 
12
12
  GEM
13
13
  remote: http://rubygems.org/
14
14
  specs:
15
- actionmailer (4.2.4)
16
- actionpack (= 4.2.4)
17
- actionview (= 4.2.4)
18
- activejob (= 4.2.4)
15
+ actionmailer (4.2.5)
16
+ actionpack (= 4.2.5)
17
+ actionview (= 4.2.5)
18
+ activejob (= 4.2.5)
19
19
  mail (~> 2.5, >= 2.5.4)
20
20
  rails-dom-testing (~> 1.0, >= 1.0.5)
21
- actionpack (4.2.4)
22
- actionview (= 4.2.4)
23
- activesupport (= 4.2.4)
21
+ actionpack (4.2.5)
22
+ actionview (= 4.2.5)
23
+ activesupport (= 4.2.5)
24
24
  rack (~> 1.6)
25
25
  rack-test (~> 0.6.2)
26
26
  rails-dom-testing (~> 1.0, >= 1.0.5)
27
27
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
- actionview (4.2.4)
29
- activesupport (= 4.2.4)
28
+ actionview (4.2.5)
29
+ activesupport (= 4.2.5)
30
30
  builder (~> 3.1)
31
31
  erubis (~> 2.7.0)
32
32
  rails-dom-testing (~> 1.0, >= 1.0.5)
33
33
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
34
- activejob (4.2.4)
35
- activesupport (= 4.2.4)
34
+ activejob (4.2.5)
35
+ activesupport (= 4.2.5)
36
36
  globalid (>= 0.3.0)
37
- activemodel (4.2.4)
38
- activesupport (= 4.2.4)
37
+ activemodel (4.2.5)
38
+ activesupport (= 4.2.5)
39
39
  builder (~> 3.1)
40
- activerecord (4.2.4)
41
- activemodel (= 4.2.4)
42
- activesupport (= 4.2.4)
40
+ activerecord (4.2.5)
41
+ activemodel (= 4.2.5)
42
+ activesupport (= 4.2.5)
43
43
  arel (~> 6.0)
44
- activesupport (4.2.4)
44
+ activesupport (4.2.5)
45
45
  i18n (~> 0.7)
46
46
  json (~> 1.7, >= 1.7.7)
47
47
  minitest (~> 5.1)
@@ -49,7 +49,7 @@ GEM
49
49
  tzinfo (~> 1.1)
50
50
  ansi (1.5.0)
51
51
  arel (6.0.3)
52
- bson (3.2.4)
52
+ bson (3.2.6)
53
53
  builder (3.2.2)
54
54
  capybara (2.5.0)
55
55
  mime-types (>= 1.16)
@@ -57,7 +57,7 @@ GEM
57
57
  rack (>= 1.0.0)
58
58
  rack-test (>= 0.5.4)
59
59
  xpath (~> 2.0)
60
- capybara-webkit (1.7.0)
60
+ capybara-webkit (1.7.1)
61
61
  capybara (>= 2.3.0, < 2.6.0)
62
62
  json
63
63
  coffee-rails (4.1.0)
@@ -66,9 +66,8 @@ GEM
66
66
  coffee-script (2.4.1)
67
67
  coffee-script-source
68
68
  execjs
69
- coffee-script-source (1.9.1.1)
70
- connection_pool (2.2.0)
71
- database_cleaner (1.0.1)
69
+ coffee-script-source (1.10.0)
70
+ database_cleaner (1.5.1)
72
71
  easy_diff (0.0.6)
73
72
  erubis (2.7.0)
74
73
  execjs (2.6.0)
@@ -97,9 +96,9 @@ GEM
97
96
  nokogiri (>= 1.5.9)
98
97
  mail (2.6.3)
99
98
  mime-types (>= 1.16, < 3)
100
- mime-types (2.6.1)
99
+ mime-types (2.6.2)
101
100
  mini_portile (0.6.2)
102
- minitest (5.8.0)
101
+ minitest (5.8.2)
103
102
  minitest-capybara (0.7.2)
104
103
  capybara (~> 2.2)
105
104
  minitest (~> 5.0)
@@ -116,44 +115,45 @@ GEM
116
115
  minitest-capybara (~> 0.7.0)
117
116
  minitest-metadata (~> 0.5.0)
118
117
  minitest-rails (~> 2.1)
119
- minitest-reporters (1.0.20)
118
+ minitest-reporters (1.1.5)
120
119
  ansi
121
120
  builder
122
121
  minitest (>= 5.0)
123
122
  ruby-progressbar
124
- mongoid (4.0.2)
123
+ mongo (2.1.2)
124
+ bson (~> 3.0)
125
+ mongoid (5.0.1)
125
126
  activemodel (~> 4.0)
126
- moped (~> 2.0.0)
127
+ mongo (~> 2.1)
127
128
  origin (~> 2.1)
128
129
  tzinfo (>= 0.3.37)
129
- mongoid-history (0.4.7)
130
+ mongoid-compatibility (0.3.1)
131
+ activesupport
132
+ mongoid (>= 2.0)
133
+ mongoid-history (0.5.0)
130
134
  activesupport
131
135
  easy_diff
132
136
  mongoid (>= 3.0)
137
+ mongoid-compatibility
133
138
  mongoid_search (0.3.2)
134
139
  fast-stemmer (~> 1.0.0)
135
140
  mongoid (>= 3.0.0)
136
- moped (2.0.7)
137
- bson (~> 3.0)
138
- connection_pool (~> 2.0)
139
- optionable (~> 0.2.0)
140
141
  nokogiri (1.6.6.2)
141
142
  mini_portile (~> 0.6.0)
142
- optionable (0.2.0)
143
143
  origin (2.1.1)
144
144
  rack (1.6.4)
145
145
  rack-test (0.6.3)
146
146
  rack (>= 1.0)
147
- rails (4.2.4)
148
- actionmailer (= 4.2.4)
149
- actionpack (= 4.2.4)
150
- actionview (= 4.2.4)
151
- activejob (= 4.2.4)
152
- activemodel (= 4.2.4)
153
- activerecord (= 4.2.4)
154
- activesupport (= 4.2.4)
147
+ rails (4.2.5)
148
+ actionmailer (= 4.2.5)
149
+ actionpack (= 4.2.5)
150
+ actionview (= 4.2.5)
151
+ activejob (= 4.2.5)
152
+ activemodel (= 4.2.5)
153
+ activerecord (= 4.2.5)
154
+ activesupport (= 4.2.5)
155
155
  bundler (>= 1.3.0, < 2.0)
156
- railties (= 4.2.4)
156
+ railties (= 4.2.5)
157
157
  sprockets-rails
158
158
  rails-deprecated_sanitizer (1.0.3)
159
159
  activesupport (>= 4.2.0.alpha)
@@ -163,18 +163,18 @@ GEM
163
163
  rails-deprecated_sanitizer (>= 1.0.1)
164
164
  rails-html-sanitizer (1.0.2)
165
165
  loofah (~> 2.0)
166
- railties (4.2.4)
167
- actionpack (= 4.2.4)
168
- activesupport (= 4.2.4)
166
+ railties (4.2.5)
167
+ actionpack (= 4.2.5)
168
+ activesupport (= 4.2.5)
169
169
  rake (>= 0.8.7)
170
170
  thor (>= 0.18.1, < 2.0)
171
171
  rake (10.4.2)
172
172
  responders (2.1.0)
173
173
  railties (>= 4.2.0, < 5)
174
174
  ruby-progressbar (1.7.5)
175
- sprockets (3.3.4)
176
- rack (~> 1.0)
177
- sprockets-rails (2.3.2)
175
+ sprockets (3.4.0)
176
+ rack (> 1, < 3)
177
+ sprockets-rails (2.3.3)
178
178
  actionpack (>= 3.0)
179
179
  activesupport (>= 3.0)
180
180
  sprockets (>= 2.8, < 4.0)
@@ -189,17 +189,17 @@ PLATFORMS
189
189
  ruby
190
190
 
191
191
  DEPENDENCIES
192
- bundler (~> 1.9)
192
+ bundler
193
193
  capybara-webkit
194
- coffee-rails (~> 4.1.0)
195
- database_cleaner (= 1.0.1)
194
+ coffee-rails
195
+ database_cleaner
196
196
  factory_girl_rails
197
197
  minitest-focus
198
198
  minitest-rails-capybara
199
199
  minitest-reporters
200
200
  mongosteen!
201
- rails (~> 4.2.3)
202
- rake (~> 10.0)
201
+ rails
202
+ rake
203
203
 
204
204
  BUNDLED WITH
205
205
  1.10.6
data/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright © 2015 [Slate Studio, LLC.](http://slatestudio.com)
3
+ Copyright © 2015 [Slate Studio, LLC.](https://www.slatestudio.com)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the “Software”), to deal
data/README.md CHANGED
@@ -69,12 +69,25 @@ Sometimes there is a need to configure json output for the model, for example to
69
69
  ```ruby
70
70
  class PostsController < ApplicationController
71
71
  mongosteen
72
- json_config({ methods: [ :published_at ] })
72
+ json_config methods: %w(published_at)
73
73
  end
74
74
  ```
75
75
 
76
76
  ```json_config``` accepts configuration hash and passes it to [as_json](http://apidock.com/rails/ActiveResource/Base/as_json) method while rendering document json.
77
77
 
78
+ If you need to define configuration specifically for methods, e.g. index might not need all document fields to make requests lighter, there is an `actions` special key for that:
79
+
80
+ ```ruby
81
+ class PostsController < ApplicationController
82
+ mongosteen
83
+ json_config methods: %w(published_at),
84
+ actions: {
85
+ index: { methods: %w(published_at), exclude: %w(body_html) }
86
+ }
87
+ end
88
+ ```
89
+
90
+ There are four default actions you can use here: `index`, `show`, `create`, `update`. Also you can specify your custom methods defined in controller and connected via routes.
78
91
 
79
92
  ### Permitted Parameters
80
93
 
@@ -111,7 +124,3 @@ Copyright © 2015 [Slate Studio, LLC](http://slatestudio.com). Mongoosteen is fr
111
124
  [![Slate Studio](https://slate-git-images.s3-us-west-1.amazonaws.com/slate.png)](http://slatestudio.com)
112
125
 
113
126
  Mongoosteen is maintained and funded by [Slate Studio, LLC](http://slatestudio.com). Tweet your questions or suggestions to [@slatestudio](https://twitter.com/slatestudio) and while you’re at it follow us too.
114
-
115
-
116
-
117
-
data/TODO.md ADDED
@@ -0,0 +1,9 @@
1
+ # TODO
2
+
3
+ 1. Tests for document_versions
4
+ 2. Tests for custom json config
5
+ 3. Tests for custom methods in controller
6
+ 4. Tests for csv_config
7
+ 5. Connect document_versions by default only to show/create/update
8
+ 6. Tests for custom json config for custom methods
9
+ 7. Take a look at http://jsonapi.org/implementations/ — see if any use of it
@@ -1,16 +1,11 @@
1
- # @TODO: take a look at http://jsonapi.org/implementations/
2
-
3
-
4
1
  require 'inherited_resources'
5
2
  require 'mongoid'
6
3
  require 'mongoid_search'
7
4
  require 'mongoid-history'
8
5
  require 'kaminari'
9
6
  require 'has_scope'
10
-
11
7
  require 'mongosteen/csv_renderer'
12
8
 
13
-
14
9
  module Mongosteen
15
10
  autoload :Actions, 'mongosteen/actions'
16
11
  autoload :ClassMethods, 'mongosteen/class_methods'
@@ -22,9 +17,7 @@ module Mongosteen
22
17
  end
23
18
  end
24
19
 
25
-
26
20
  class ActionController::Base
27
-
28
21
  # Call mongosteen in your controller to have all the
29
22
  # required modules and funcionality included.
30
23
  def self.mongosteen
@@ -36,6 +29,7 @@ class ActionController::Base
36
29
  respond_to :csv, :only => :index
37
30
 
38
31
  class_attribute :as_json_config
32
+ class_attribute :as_json_config_actions
39
33
  class_attribute :json_default_methods
40
34
 
41
35
  class_attribute :as_csv_config
@@ -57,10 +51,6 @@ class ActionController::Base
57
51
 
58
52
  json_config()
59
53
  csv_config()
60
-
61
54
  end
62
55
  end
63
-
64
56
  end
65
-
66
-
@@ -1,41 +1,46 @@
1
1
  module Mongosteen
2
2
  module Actions
3
-
4
3
  # GET /resources
5
4
  def index(options={}, &block)
6
5
  super do |success, failure|
7
- success.json { render json: get_collection_ivar.as_json(as_json_config) }
6
+ success.json { render json: get_collection_ivar.as_json(json_config(:index)) }
8
7
  success.csv { render csv: get_collection_ivar }
9
8
  end
10
9
  end
11
10
 
12
-
13
11
  # GET /resources/1
14
12
  def show(options={}, &block)
15
13
  super do |success, failure|
16
- success.json { render json: get_resource_version.as_json(as_json_config) }
14
+ success.json { render json: get_resource_version.as_json(json_config(:show)) }
17
15
  end
18
16
  end
19
17
 
20
-
21
18
  # POST /resources
22
19
  def create(options={}, &block)
23
20
  super do |success, failure|
24
- success.json { render json: get_resource_ivar.as_json(as_json_config) }
21
+ success.json { render json: get_resource_ivar.as_json(json_config(:create)) }
25
22
  failure.json { render json: get_resource_ivar.errors, status: :unprocessable_entity }
26
23
  end
27
24
  end
28
25
 
29
-
30
26
  # PUT /resources/1
31
27
  def update(options={}, &block)
32
28
  super do |success, failure|
33
- success.json { render json: get_resource_ivar.as_json(as_json_config) }
29
+ success.json { render json: get_resource_ivar.as_json(json_config(:update)) }
34
30
  failure.json { render json: get_resource_ivar.errors, status: :unprocessable_entity }
35
31
  end
36
32
  end
37
33
 
34
+ private
38
35
 
36
+ # Action options are: :index, :show, :create, :update
37
+ def json_config(action)
38
+ if action && as_json_config_actions.has_key?(action)
39
+ as_json_config_actions[action]
40
+ else
41
+ as_json_config
42
+ end
43
+ end
39
44
  end
40
45
  end
41
46
 
@@ -3,53 +3,44 @@ module Mongosteen
3
3
 
4
4
  protected
5
5
 
6
- # add support for scopes, search and pagination
7
- def collection
8
- get_collection_ivar || begin
9
- chain = end_of_association_chain
10
-
11
- # scopes
12
- chain = apply_scopes(chain)
13
-
14
- # search
15
- if params[:search]
16
- chain = chain.search(params[:search].to_s.downcase, match: :all)
17
- end
18
-
19
- # pagination
20
- if params[:page]
21
- per_page = params[:perPage] || 20
22
- chain = chain.page(params[:page]).per(per_page)
23
- else
24
- chain = chain.all
25
- end
26
-
27
- set_collection_ivar(chain)
28
- end
29
- end
30
-
6
+ # add support for scopes, search and pagination
7
+ def collection
8
+ get_collection_ivar || begin
9
+ chain = end_of_association_chain
31
10
 
32
- # add support for history
33
- def get_resource_version
34
- resource = get_resource_ivar
11
+ # scopes
12
+ chain = apply_scopes(chain)
35
13
 
36
- version = params[:version].try(:to_i)
14
+ # search
15
+ if params[:search]
16
+ chain = chain.search(params[:search].to_s.downcase, match: :all)
17
+ end
37
18
 
38
- if version && version > 0 && version < resource.version
39
- resource.undo(nil, from: version + 1, to: resource.version)
40
- resource.version = version
19
+ # pagination
20
+ if params[:page]
21
+ per_page = params[:perPage] || 20
22
+ chain = chain.page(params[:page]).per(per_page)
23
+ else
24
+ chain = chain.all
41
25
  end
42
26
 
43
- return resource
27
+ set_collection_ivar(chain)
44
28
  end
29
+ end
45
30
 
31
+ # add support for history
32
+ def get_resource_version
33
+ resource = get_resource_ivar
46
34
 
47
- # support for json resource configuration
48
- def as_json_config
49
- self.class.as_json_config
50
- end
35
+ version = params[:version].try(:to_i)
51
36
 
37
+ if version && version > 0 && version < resource.version
38
+ resource.undo(nil, from: version + 1, to: resource.version)
39
+ resource.version = version
40
+ end
52
41
 
42
+ return resource
43
+ end
53
44
  end
54
45
  end
55
46
 
@@ -1,16 +1,31 @@
1
1
  module Mongosteen
2
2
  module ClassMethods
3
-
4
3
  def json_config(config_hash={})
5
- config_hash[:methods] ||= []
6
- config_hash[:methods].concat(json_default_methods).uniq!
7
- self.as_json_config = config_hash
8
- end
4
+ self.as_json_config_actions = {}
5
+ actions = config_hash.delete(:actions) || {}
9
6
 
7
+ set_json_actions(actions)
8
+ set_json_default(config_hash)
9
+ end
10
10
 
11
11
  def csv_config(config_hash={})
12
12
  self.as_csv_config = config_hash
13
13
  end
14
14
 
15
+ private
16
+
17
+ def set_json_actions(config)
18
+ config.each do |k, v|
19
+ v[:methods] ||= []
20
+ v[:methods].concat(json_default_methods).uniq!
21
+ end
22
+ self.as_json_config_actions = config
23
+ end
24
+
25
+ def set_json_default(config)
26
+ config[:methods] ||= []
27
+ config[:methods].concat(json_default_methods).uniq!
28
+ self.as_json_config = config
29
+ end
15
30
  end
16
31
  end
@@ -1,3 +1,3 @@
1
1
  module Mongosteen
2
- VERSION = "0.1.8"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -3,14 +3,14 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
  require 'mongosteen/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
- s.name = 'mongosteen'
7
- s.version = Mongosteen::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ['Alexander Kravets']
10
- s.email = 'alex@slatestudio.com'
11
- s.license = 'MIT'
12
- s.homepage = 'https://github.com/slate-studio/mongosteen'
13
- s.summary = 'An easy way to add restful actions'
6
+ s.name = 'mongosteen'
7
+ s.version = Mongosteen::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ['Alexander Kravets']
10
+ s.email = 'alex@slatestudio.com'
11
+ s.license = 'MIT'
12
+ s.homepage = 'https://github.com/slate-studio/mongosteen'
13
+ s.summary = 'An easy way to add restful actions'
14
14
  s.description = <<-DESC
15
15
  Mongosteen is a library that helps to easily add RESTful actions to
16
16
  mongoid models with support of search, pagination, scopes, history,
@@ -19,22 +19,22 @@ json config.
19
19
 
20
20
  s.rubyforge_project = 'mongosteen'
21
21
 
22
- s.files = `git ls-files`.split("\n")
22
+ s.files = `git ls-files`.split("\n")
23
23
  s.require_paths = ['lib']
24
24
 
25
- s.add_dependency('inherited_resources', '>= 1.6') # resources
26
- s.add_dependency('mongoid-history', '>= 0.4.5') # history
27
- s.add_dependency('mongoid', '>= 4.0') # orm
28
- s.add_dependency('mongoid_search', '>= 0.3') # search
29
- s.add_dependency('kaminari', '>= 0.16') # pagination
30
- s.add_dependency('has_scope', '> 0.5') # scopes
25
+ s.add_dependency('inherited_resources', '>= 1.6')
26
+ s.add_dependency('mongoid-history', '>= 0.5.0')
27
+ s.add_dependency('mongoid', '>= 5.0')
28
+ s.add_dependency('mongoid_search', '>= 0.3')
29
+ s.add_dependency('kaminari', '>= 0.16')
30
+ s.add_dependency('has_scope', '>= 0.6')
31
31
 
32
32
  # automated tests
33
- s.add_development_dependency 'bundler', '~> 1.9'
34
- s.add_development_dependency 'rake', '~> 10.0'
35
- s.add_development_dependency 'rails', '~> 4.2.3'
36
- s.add_development_dependency 'coffee-rails', '~> 4.1.0'
37
- s.add_development_dependency 'database_cleaner', '1.0.1'
33
+ s.add_development_dependency 'bundler'
34
+ s.add_development_dependency 'rake'
35
+ s.add_development_dependency 'rails'
36
+ s.add_development_dependency 'coffee-rails'
37
+ s.add_development_dependency 'database_cleaner'
38
38
  s.add_development_dependency 'factory_girl_rails'
39
39
  s.add_development_dependency 'capybara-webkit'
40
40
  s.add_development_dependency 'minitest-reporters'
@@ -1,5 +1,5 @@
1
1
  test:
2
- sessions:
2
+ clients:
3
3
  default:
4
4
  database: mongosteen_test
5
5
  hosts:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongosteen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kravets
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-04 00:00:00.000000000 Z
11
+ date: 2015-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inherited_resources
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.4.5
33
+ version: 0.5.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 0.4.5
40
+ version: 0.5.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mongoid
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '4.0'
47
+ version: '5.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '4.0'
54
+ version: '5.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: mongoid_search
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -84,86 +84,86 @@ dependencies:
84
84
  name: has_scope
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '0.5'
89
+ version: '0.6'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '0.5'
96
+ version: '0.6'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: bundler
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '1.9'
103
+ version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '1.9'
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rake
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '10.0'
117
+ version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: '10.0'
124
+ version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rails
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
- version: 4.2.3
131
+ version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
- version: 4.2.3
138
+ version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: coffee-rails
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - "~>"
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
- version: 4.1.0
145
+ version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - "~>"
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
- version: 4.1.0
152
+ version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: database_cleaner
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - '='
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
- version: 1.0.1
159
+ version: '0'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - '='
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
- version: 1.0.1
166
+ version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: factory_girl_rails
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -250,6 +250,7 @@ files:
250
250
  - LICENSE.md
251
251
  - README.md
252
252
  - Rakefile
253
+ - TODO.md
253
254
  - lib/mongosteen.rb
254
255
  - lib/mongosteen/actions.rb
255
256
  - lib/mongosteen/base_helpers.rb
@@ -264,24 +265,11 @@ files:
264
265
  - test/integration/api_test.rb
265
266
  - test/rails_app/.DS_Store
266
267
  - test/rails_app/Rakefile
267
- - test/rails_app/app/assets/images/.keep
268
- - test/rails_app/app/assets/javascripts/application.js
269
- - test/rails_app/app/assets/stylesheets/application.css
270
268
  - test/rails_app/app/controllers/application_controller.rb
271
- - test/rails_app/app/controllers/concerns/.keep
272
269
  - test/rails_app/app/controllers/test_items_controller.rb
273
270
  - test/rails_app/app/controllers/test_permit_items_controller.rb
274
- - test/rails_app/app/helpers/application_helper.rb
275
- - test/rails_app/app/mailers/.keep
276
- - test/rails_app/app/models/concerns/.keep
277
271
  - test/rails_app/app/models/test_item.rb
278
272
  - test/rails_app/app/models/test_permit_item.rb
279
- - test/rails_app/app/views/layouts/application.html.erb
280
- - test/rails_app/bin/bundle
281
- - test/rails_app/bin/rails
282
- - test/rails_app/bin/rake
283
- - test/rails_app/bin/setup
284
- - test/rails_app/bin/spring
285
273
  - test/rails_app/config.ru
286
274
  - test/rails_app/config/application.rb
287
275
  - test/rails_app/config/boot.rb
@@ -301,16 +289,6 @@ files:
301
289
  - test/rails_app/config/mongoid.yml
302
290
  - test/rails_app/config/routes.rb
303
291
  - test/rails_app/config/secrets.yml
304
- - test/rails_app/db/seeds.rb
305
- - test/rails_app/lib/assets/.keep
306
- - test/rails_app/lib/tasks/.keep
307
- - test/rails_app/public/404.html
308
- - test/rails_app/public/422.html
309
- - test/rails_app/public/500.html
310
- - test/rails_app/public/favicon.ico
311
- - test/rails_app/public/robots.txt
312
- - test/rails_app/vendor/assets/javascripts/.keep
313
- - test/rails_app/vendor/assets/stylesheets/.keep
314
292
  - test/test_helper.rb
315
293
  homepage: https://github.com/slate-studio/mongosteen
316
294
  licenses:
@@ -332,7 +310,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
332
310
  version: '0'
333
311
  requirements: []
334
312
  rubyforge_project: mongosteen
335
- rubygems_version: 2.4.6
313
+ rubygems_version: 2.4.5.1
336
314
  signing_key:
337
315
  specification_version: 4
338
316
  summary: An easy way to add restful actions
File without changes
@@ -1,16 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
9
- //
10
- // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require jquery
14
- //= require jquery_ujs
15
- //= require turbolinks
16
- //= require_tree .
@@ -1,15 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any styles
10
- * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
- * file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
File without changes
File without changes
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>RailsApp</title>
5
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
- <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
- begin
3
- load File.expand_path("../spring", __FILE__)
4
- rescue LoadError
5
- end
6
- APP_PATH = File.expand_path('../../config/application', __FILE__)
7
- require_relative '../config/boot'
8
- require 'rails/commands'
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
- begin
3
- load File.expand_path("../spring", __FILE__)
4
- rescue LoadError
5
- end
6
- require_relative '../config/boot'
7
- require 'rake'
8
- Rake.application.run
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'pathname'
3
-
4
- # path to your application root.
5
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
-
7
- Dir.chdir APP_ROOT do
8
- # This script is a starting point to setup your application.
9
- # Add necessary setup steps to this file:
10
-
11
- puts "== Installing dependencies =="
12
- system "gem install bundler --conservative"
13
- system "bundle check || bundle install"
14
-
15
- # puts "\n== Copying sample files =="
16
- # unless File.exist?("config/database.yml")
17
- # system "cp config/database.yml.sample config/database.yml"
18
- # end
19
-
20
- puts "\n== Preparing database =="
21
- system "bin/rake db:setup"
22
-
23
- puts "\n== Removing old logs and tempfiles =="
24
- system "rm -f log/*"
25
- system "rm -rf tmp/cache"
26
-
27
- puts "\n== Restarting application server =="
28
- system "touch tmp/restart.txt"
29
- end
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # This file loads spring without using Bundler, in order to be fast.
4
- # It gets overwritten when you run the `spring binstub` command.
5
-
6
- unless defined?(Spring)
7
- require "rubygems"
8
- require "bundler"
9
-
10
- if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
11
- Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq }
12
- gem "spring", match[1]
13
- require "spring/binstub"
14
- end
15
- end
@@ -1,7 +0,0 @@
1
- # This file should contain all the record creation needed to seed the database with its default values.
2
- # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
- #
4
- # Examples:
5
- #
6
- # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
- # Mayor.create(name: 'Emanuel', city: cities.first)
File without changes
File without changes
@@ -1,67 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
-
15
- div.dialog {
16
- width: 95%;
17
- max-width: 33em;
18
- margin: 4em auto 0;
19
- }
20
-
21
- div.dialog > div {
22
- border: 1px solid #CCC;
23
- border-right-color: #999;
24
- border-left-color: #999;
25
- border-bottom-color: #BBB;
26
- border-top: #B00100 solid 4px;
27
- border-top-left-radius: 9px;
28
- border-top-right-radius: 9px;
29
- background-color: white;
30
- padding: 7px 12% 0;
31
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
- }
33
-
34
- h1 {
35
- font-size: 100%;
36
- color: #730E15;
37
- line-height: 1.5em;
38
- }
39
-
40
- div.dialog > p {
41
- margin: 0 0 1em;
42
- padding: 1em;
43
- background-color: #F7F7F7;
44
- border: 1px solid #CCC;
45
- border-right-color: #999;
46
- border-left-color: #999;
47
- border-bottom-color: #999;
48
- border-bottom-left-radius: 4px;
49
- border-bottom-right-radius: 4px;
50
- border-top-color: #DADADA;
51
- color: #666;
52
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
- }
54
- </style>
55
- </head>
56
-
57
- <body>
58
- <!-- This file lives in public/404.html -->
59
- <div class="dialog">
60
- <div>
61
- <h1>The page you were looking for doesn't exist.</h1>
62
- <p>You may have mistyped the address or the page may have moved.</p>
63
- </div>
64
- <p>If you are the application owner check the logs for more information.</p>
65
- </div>
66
- </body>
67
- </html>
@@ -1,67 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
-
15
- div.dialog {
16
- width: 95%;
17
- max-width: 33em;
18
- margin: 4em auto 0;
19
- }
20
-
21
- div.dialog > div {
22
- border: 1px solid #CCC;
23
- border-right-color: #999;
24
- border-left-color: #999;
25
- border-bottom-color: #BBB;
26
- border-top: #B00100 solid 4px;
27
- border-top-left-radius: 9px;
28
- border-top-right-radius: 9px;
29
- background-color: white;
30
- padding: 7px 12% 0;
31
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
- }
33
-
34
- h1 {
35
- font-size: 100%;
36
- color: #730E15;
37
- line-height: 1.5em;
38
- }
39
-
40
- div.dialog > p {
41
- margin: 0 0 1em;
42
- padding: 1em;
43
- background-color: #F7F7F7;
44
- border: 1px solid #CCC;
45
- border-right-color: #999;
46
- border-left-color: #999;
47
- border-bottom-color: #999;
48
- border-bottom-left-radius: 4px;
49
- border-bottom-right-radius: 4px;
50
- border-top-color: #DADADA;
51
- color: #666;
52
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
- }
54
- </style>
55
- </head>
56
-
57
- <body>
58
- <!-- This file lives in public/422.html -->
59
- <div class="dialog">
60
- <div>
61
- <h1>The change you wanted was rejected.</h1>
62
- <p>Maybe you tried to change something you didn't have access to.</p>
63
- </div>
64
- <p>If you are the application owner check the logs for more information.</p>
65
- </div>
66
- </body>
67
- </html>
@@ -1,66 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
-
15
- div.dialog {
16
- width: 95%;
17
- max-width: 33em;
18
- margin: 4em auto 0;
19
- }
20
-
21
- div.dialog > div {
22
- border: 1px solid #CCC;
23
- border-right-color: #999;
24
- border-left-color: #999;
25
- border-bottom-color: #BBB;
26
- border-top: #B00100 solid 4px;
27
- border-top-left-radius: 9px;
28
- border-top-right-radius: 9px;
29
- background-color: white;
30
- padding: 7px 12% 0;
31
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
- }
33
-
34
- h1 {
35
- font-size: 100%;
36
- color: #730E15;
37
- line-height: 1.5em;
38
- }
39
-
40
- div.dialog > p {
41
- margin: 0 0 1em;
42
- padding: 1em;
43
- background-color: #F7F7F7;
44
- border: 1px solid #CCC;
45
- border-right-color: #999;
46
- border-left-color: #999;
47
- border-bottom-color: #999;
48
- border-bottom-left-radius: 4px;
49
- border-bottom-right-radius: 4px;
50
- border-top-color: #DADADA;
51
- color: #666;
52
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
- }
54
- </style>
55
- </head>
56
-
57
- <body>
58
- <!-- This file lives in public/500.html -->
59
- <div class="dialog">
60
- <div>
61
- <h1>We're sorry, but something went wrong.</h1>
62
- </div>
63
- <p>If you are the application owner check the logs for more information.</p>
64
- </div>
65
- </body>
66
- </html>
File without changes
@@ -1,5 +0,0 @@
1
- # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2
- #
3
- # To ban all spiders from the entire site uncomment the next two lines:
4
- # User-agent: *
5
- # Disallow: /