scopes_rails 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/lib/generators/scope_generator.rb +5 -2
- data/lib/scopes_rails/templates/scopes_rails_including.rb +13 -0
- data/lib/scopes_rails/templates/scopes_rails_initializer.rb +3 -9
- data/lib/scopes_rails/templates/scopes_rails_middleware.rb +10 -0
- data/lib/scopes_rails/version.rb +1 -1
- metadata +31 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ede9e43b457af8da02450f21984e151d3b13a9ed
|
4
|
+
data.tar.gz: d3404c6822c81c10db44cda252963f059a6146ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e849493144bc1010a678e724887f3f13b470ce78f214887b28c9bc746b79133a417d753f43f1b708e1141faa708cf82a3a4e07a0c01173a76d3202604c0ed307
|
7
|
+
data.tar.gz: 2650e394d92ec8557ebb8769feb9492bac753a48248e7e8834dd79d2a12e5aa7c2bc2d1cb8ebc8dfa302767d5d2f2338be73952a499b687f1231150f95fd2209
|
@@ -10,11 +10,14 @@ module #{class_name}Scopes
|
|
10
10
|
extend ActiveSupport::Concern
|
11
11
|
include StateMachineScopes
|
12
12
|
|
13
|
-
included do
|
14
|
-
end
|
13
|
+
#included do
|
14
|
+
#end
|
15
15
|
end
|
16
16
|
FILE
|
17
17
|
|
18
18
|
copy_file 'scopes_rails_initializer.rb', 'config/initializers/scopes_rails_initializer.rb'
|
19
|
+
empty_directory 'lib/middleware'
|
20
|
+
copy_file 'scopes_rails_middleware.rb', 'lib/middleware/scopes_rails_middleware.rb'
|
21
|
+
copy_file 'scopes_rails_including.rb', 'lib/middleware/scopes_rails_including.rb'
|
19
22
|
end
|
20
23
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module ScopesRailsIncluding
|
2
|
+
def self.initialize_scopes
|
3
|
+
Dir.glob('app/scopes/**/*').each do |scopes|
|
4
|
+
next unless scopes.include? '.rb'
|
5
|
+
file_name = scopes.gsub('app/scopes/', '')
|
6
|
+
class_name = file_name[0, file_name.rindex('_')].camelize
|
7
|
+
scopes_module_name = "#{class_name}Scopes".constantize
|
8
|
+
class_name.constantize.class_eval do
|
9
|
+
include scopes_module_name
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -1,9 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
class_name = file_name[0, file_name.rindex('_')].camelize
|
5
|
-
scopes_module_name = "#{class_name}Scopes".constantize
|
6
|
-
class_name.constantize.class_eval do
|
7
|
-
include scopes_module_name
|
8
|
-
end
|
9
|
-
end
|
1
|
+
require "#{Rails.root}/lib/middleware/scopes_rails_middleware.rb"
|
2
|
+
|
3
|
+
Rails.application.config.middleware.use ScopesRailsMiddleware
|
data/lib/scopes_rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scopes_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -36,7 +36,9 @@ files:
|
|
36
36
|
- lib/generators/scope_generator.rb
|
37
37
|
- lib/scopes_rails.rb
|
38
38
|
- lib/scopes_rails/state_machine_scopes.rb
|
39
|
+
- lib/scopes_rails/templates/scopes_rails_including.rb
|
39
40
|
- lib/scopes_rails/templates/scopes_rails_initializer.rb
|
41
|
+
- lib/scopes_rails/templates/scopes_rails_middleware.rb
|
40
42
|
- lib/scopes_rails/version.rb
|
41
43
|
- lib/tasks/scopes_rails_tasks.rake
|
42
44
|
- test/dummy/README.rdoc
|
@@ -95,44 +97,44 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
97
|
version: '0'
|
96
98
|
requirements: []
|
97
99
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.4.
|
100
|
+
rubygems_version: 2.4.6
|
99
101
|
signing_key:
|
100
102
|
specification_version: 4
|
101
103
|
summary: Summary of ScopesRails.
|
102
104
|
test_files:
|
103
|
-
- test/scopes_rails_test.rb
|
104
105
|
- test/test_helper.rb
|
105
|
-
- test/
|
106
|
-
- test/dummy/
|
106
|
+
- test/scopes_rails_test.rb
|
107
|
+
- test/dummy/Rakefile
|
108
|
+
- test/dummy/bin/rake
|
109
|
+
- test/dummy/bin/rails
|
110
|
+
- test/dummy/bin/setup
|
111
|
+
- test/dummy/bin/bundle
|
112
|
+
- test/dummy/config.ru
|
113
|
+
- test/dummy/app/assets/stylesheets/application.css
|
114
|
+
- test/dummy/app/assets/javascripts/application.js
|
115
|
+
- test/dummy/app/controllers/application_controller.rb
|
116
|
+
- test/dummy/app/helpers/application_helper.rb
|
117
|
+
- test/dummy/app/views/layouts/application.html.erb
|
107
118
|
- test/dummy/public/favicon.ico
|
108
119
|
- test/dummy/public/404.html
|
120
|
+
- test/dummy/public/500.html
|
121
|
+
- test/dummy/public/422.html
|
109
122
|
- test/dummy/README.rdoc
|
110
|
-
- test/dummy/config/boot.rb
|
111
123
|
- test/dummy/config/routes.rb
|
112
|
-
- test/dummy/config/
|
124
|
+
- test/dummy/config/environments/development.rb
|
113
125
|
- test/dummy/config/environments/production.rb
|
114
126
|
- test/dummy/config/environments/test.rb
|
115
|
-
- test/dummy/config/
|
116
|
-
- test/dummy/config/
|
117
|
-
- test/dummy/config/
|
127
|
+
- test/dummy/config/database.yml
|
128
|
+
- test/dummy/config/environment.rb
|
129
|
+
- test/dummy/config/locales/en.yml
|
130
|
+
- test/dummy/config/secrets.yml
|
118
131
|
- test/dummy/config/initializers/cookies_serializer.rb
|
119
|
-
- test/dummy/config/initializers/assets.rb
|
120
|
-
- test/dummy/config/initializers/inflections.rb
|
121
132
|
- test/dummy/config/initializers/filter_parameter_logging.rb
|
122
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
123
|
-
- test/dummy/config/initializers/mime_types.rb
|
124
133
|
- test/dummy/config/initializers/session_store.rb
|
125
|
-
- test/dummy/config/
|
126
|
-
- test/dummy/config/
|
127
|
-
- test/dummy/config/
|
128
|
-
- test/dummy/
|
129
|
-
- test/dummy/
|
130
|
-
- test/dummy/
|
131
|
-
- test/dummy/
|
132
|
-
- test/dummy/config.ru
|
133
|
-
- test/dummy/app/views/layouts/application.html.erb
|
134
|
-
- test/dummy/app/controllers/application_controller.rb
|
135
|
-
- test/dummy/app/helpers/application_helper.rb
|
136
|
-
- test/dummy/app/assets/stylesheets/application.css
|
137
|
-
- test/dummy/app/assets/javascripts/application.js
|
138
|
-
- test/dummy/Rakefile
|
134
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
135
|
+
- test/dummy/config/initializers/mime_types.rb
|
136
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
137
|
+
- test/dummy/config/initializers/inflections.rb
|
138
|
+
- test/dummy/config/initializers/assets.rb
|
139
|
+
- test/dummy/config/application.rb
|
140
|
+
- test/dummy/config/boot.rb
|