whitelist_scope 0.1.2 → 0.1.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.
data/.travis.yml CHANGED
@@ -3,15 +3,30 @@ cache: bundler
3
3
  sudo: false
4
4
  script: bundle exec rspec
5
5
  rvm:
6
- - 1.9.3
7
- - 2.0.0
8
- - 2.1.0
9
- - 2.2.0
6
+ - 2.0
7
+ - 2.1
8
+ - 2.2.2
9
+ - 2.3.0
10
+
11
+ before_install:
12
+ - gem install bundler
13
+
10
14
  gemfile:
11
15
  - gemfiles/3.2.gemfile
12
16
  - gemfiles/4.0.gemfile
13
17
  - gemfiles/4.1.gemfile
14
18
  - gemfiles/4.2.gemfile
19
+ - gemfiles/5.0.gemfile
20
+
21
+ matrix:
22
+ exclude:
23
+ - rvm: 1.9
24
+ gemfile: gemfiles/5.0.gemfile
25
+ - rvm: 2.0
26
+ gemfile: gemfiles/5.0.gemfile
27
+ - rvm: 2.1
28
+ gemfile: gemfiles/5.0.gemfile
29
+
15
30
  branches:
16
31
  only:
17
32
  - stable
data/Appraisals CHANGED
@@ -13,3 +13,7 @@ end
13
13
  appraise "4.2" do
14
14
  gem "activerecord", "~> 4.2.0"
15
15
  end
16
+
17
+ appraise "5.0" do
18
+ gem "activerecord", "~> 5.0.0"
19
+ end
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Declare your gem's dependencies in whitelist_scope.gemspec.
4
4
  # Bundler will treat runtime dependencies like base dependencies, and
data/Gemfile.lock CHANGED
@@ -1,86 +1,83 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- whitelist_scope (0.1.0)
4
+ whitelist_scope (0.1.2)
5
5
  activerecord (>= 3.2.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (4.2.4)
11
- activesupport (= 4.2.4)
12
- builder (~> 3.1)
13
- activerecord (4.2.4)
14
- activemodel (= 4.2.4)
15
- activesupport (= 4.2.4)
16
- arel (~> 6.0)
17
- activesupport (4.2.4)
10
+ activemodel (5.0.0.1)
11
+ activesupport (= 5.0.0.1)
12
+ activerecord (5.0.0.1)
13
+ activemodel (= 5.0.0.1)
14
+ activesupport (= 5.0.0.1)
15
+ arel (~> 7.0)
16
+ activesupport (5.0.0.1)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (~> 0.7)
19
- json (~> 1.7, >= 1.7.7)
20
19
  minitest (~> 5.1)
21
- thread_safe (~> 0.3, >= 0.3.4)
22
20
  tzinfo (~> 1.1)
23
21
  appraisal (2.1.0)
24
22
  bundler
25
23
  rake
26
24
  thor (>= 0.14.0)
27
- arel (6.0.3)
28
- builder (3.2.2)
29
- coveralls (0.8.2)
30
- json (~> 1.8)
31
- rest-client (>= 1.6.8, < 2)
32
- simplecov (~> 0.10.0)
25
+ arel (7.1.2)
26
+ ast (2.3.0)
27
+ concurrent-ruby (1.0.2)
28
+ coveralls (0.8.15)
29
+ json (>= 1.8, < 3)
30
+ simplecov (~> 0.12.0)
33
31
  term-ansicolor (~> 1.3)
34
32
  thor (~> 0.19.1)
33
+ tins (>= 1.6.0, < 2)
35
34
  diff-lcs (1.2.5)
36
35
  docile (1.1.5)
37
- domain_name (0.5.24)
38
- unf (>= 0.0.5, < 1.0.0)
39
- fuubar (2.0.0)
40
- rspec (~> 3.0)
36
+ fuubar (2.2.0)
37
+ rspec-core (~> 3.0)
41
38
  ruby-progressbar (~> 1.4)
42
- http-cookie (1.0.2)
43
- domain_name (~> 0.5)
44
39
  i18n (0.7.0)
45
- json (1.8.3)
46
- mime-types (2.6.2)
47
- minitest (5.8.1)
48
- netrc (0.10.3)
49
- rake (10.4.2)
50
- rest-client (1.8.0)
51
- http-cookie (>= 1.0.2, < 2.0)
52
- mime-types (>= 1.16, < 3.0)
53
- netrc (~> 0.7)
54
- rspec (3.3.0)
55
- rspec-core (~> 3.3.0)
56
- rspec-expectations (~> 3.3.0)
57
- rspec-mocks (~> 3.3.0)
58
- rspec-core (3.3.2)
59
- rspec-support (~> 3.3.0)
60
- rspec-expectations (3.3.1)
40
+ json (2.0.2)
41
+ minitest (5.9.0)
42
+ parser (2.3.1.2)
43
+ ast (~> 2.2)
44
+ powerpack (0.1.1)
45
+ rainbow (2.1.0)
46
+ rake (11.2.2)
47
+ rspec (3.5.0)
48
+ rspec-core (~> 3.5.0)
49
+ rspec-expectations (~> 3.5.0)
50
+ rspec-mocks (~> 3.5.0)
51
+ rspec-core (3.5.3)
52
+ rspec-support (~> 3.5.0)
53
+ rspec-expectations (3.5.0)
61
54
  diff-lcs (>= 1.2.0, < 2.0)
62
- rspec-support (~> 3.3.0)
63
- rspec-mocks (3.3.2)
55
+ rspec-support (~> 3.5.0)
56
+ rspec-mocks (3.5.0)
64
57
  diff-lcs (>= 1.2.0, < 2.0)
65
- rspec-support (~> 3.3.0)
66
- rspec-support (3.3.0)
67
- ruby-progressbar (1.7.5)
68
- simplecov (0.10.0)
58
+ rspec-support (~> 3.5.0)
59
+ rspec-support (3.5.0)
60
+ rubocop (0.42.0)
61
+ parser (>= 2.3.1.1, < 3.0)
62
+ powerpack (~> 0.1)
63
+ rainbow (>= 1.99.1, < 3.0)
64
+ ruby-progressbar (~> 1.7)
65
+ unicode-display_width (~> 1.0, >= 1.0.1)
66
+ ruby-progressbar (1.8.1)
67
+ simplecov (0.12.0)
69
68
  docile (~> 1.1.0)
70
- json (~> 1.8)
69
+ json (>= 1.8, < 3)
71
70
  simplecov-html (~> 0.10.0)
72
71
  simplecov-html (0.10.0)
73
- sqlite3 (1.3.10)
72
+ sqlite3 (1.3.11)
74
73
  term-ansicolor (1.3.2)
75
74
  tins (~> 1.0)
76
75
  thor (0.19.1)
77
76
  thread_safe (0.3.5)
78
- tins (1.6.0)
77
+ tins (1.12.0)
79
78
  tzinfo (1.2.2)
80
79
  thread_safe (~> 0.1)
81
- unf (0.1.4)
82
- unf_ext
83
- unf_ext (0.0.7.1)
80
+ unicode-display_width (1.1.0)
84
81
 
85
82
  PLATFORMS
86
83
  ruby
@@ -90,8 +87,9 @@ DEPENDENCIES
90
87
  coveralls
91
88
  fuubar
92
89
  rspec
90
+ rubocop (~> 0.42.0)
93
91
  sqlite3
94
92
  whitelist_scope!
95
93
 
96
94
  BUNDLED WITH
97
- 1.10.6
95
+ 1.12.5
data/Rakefile CHANGED
@@ -1,22 +1,17 @@
1
1
  begin
2
- require 'bundler/setup'
2
+ require "bundler/setup"
3
3
  rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
4
+ puts "You must `gem install bundler` and `bundle install` to run rake tasks"
5
5
  end
6
6
 
7
- require 'rdoc/task'
7
+ require "rdoc/task"
8
8
 
9
9
  RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'Whitelist Scope'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.md')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
10
+ rdoc.rdoc_dir = "rdoc"
11
+ rdoc.title = "Whitelist Scope"
12
+ rdoc.options << "--line-numbers"
13
+ rdoc.rdoc_files.include("README.md")
14
+ rdoc.rdoc_files.include("lib/**/*.rb")
15
15
  end
16
16
 
17
-
18
-
19
-
20
-
21
-
22
17
  Bundler::GemHelper.install_tasks
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 5.0.0"
6
+
7
+ gemspec :path => "../"
@@ -1,3 +1,3 @@
1
1
  module WhitelistScope
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3".freeze
3
3
  end
@@ -7,7 +7,7 @@ module WhitelistScope
7
7
  @whitelist ||= []
8
8
  name = name.to_sym
9
9
 
10
- if self.respond_to?(name)
10
+ if respond_to?(name)
11
11
  raise ArgumentError, "Could not create scope, There is an existing method with this name."
12
12
  end
13
13
 
@@ -16,21 +16,27 @@ module WhitelistScope
16
16
  end
17
17
 
18
18
  def call_whitelisted_scope(*scope_names)
19
- scope_results = nil
19
+ existing_scope = nil
20
20
 
21
21
  scope_names.flatten.each do |scope_name|
22
- scope_name = scope_name.to_sym unless scope_name == nil
23
-
24
- if @whitelist.include? scope_name
25
- if scope_results
26
- scope_results = scope_results.send(scope_name)
27
- else
28
- scope_results = self.send(scope_name)
29
- end
22
+ existing_scope = call_scope_by_name(existing_scope, scope_name)
23
+ end
24
+ existing_scope
25
+ end
26
+
27
+ private
28
+
29
+ def call_scope_by_name(existing_scope, scope_name)
30
+ scope_name = scope_name.to_sym unless scope_name.nil?
31
+
32
+ if @whitelist.include? scope_name
33
+ if existing_scope
34
+ existing_scope.send(scope_name)
30
35
  else
31
- raise NoMethodError, "The scope you provided, '#{scope_name}', does not exist."
36
+ send(scope_name)
32
37
  end
38
+ else
39
+ raise NoMethodError, "The scope you provided, '#{scope_name}', does not exist."
33
40
  end
34
- scope_results
35
41
  end
36
42
  end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'whitelist_scope/version'
4
+ require "whitelist_scope/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "whitelist_scope"
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_development_dependency "sqlite3"
25
25
  spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "rubocop", "~> 0.42.0"
26
27
  spec.add_development_dependency "fuubar"
27
28
  spec.add_development_dependency "coveralls"
28
29
  spec.add_development_dependency "appraisal"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whitelist_scope
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Melody
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-24 00:00:00.000000000 Z
11
+ date: 2016-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.42.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.42.0
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: fuubar
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -119,6 +133,7 @@ files:
119
133
  - gemfiles/4.0.gemfile
120
134
  - gemfiles/4.1.gemfile
121
135
  - gemfiles/4.2.gemfile
136
+ - gemfiles/5.0.gemfile
122
137
  - lib/whitelist_scope.rb
123
138
  - lib/whitelist_scope/version.rb
124
139
  - whitelist_scope.gemspec
@@ -142,10 +157,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
157
  version: '0'
143
158
  requirements: []
144
159
  rubyforge_project:
145
- rubygems_version: 2.4.5
160
+ rubygems_version: 2.5.1
146
161
  signing_key:
147
162
  specification_version: 4
148
163
  summary: whitelist_scope provides a safe way to register and call scopes inside rails
149
164
  apps
150
165
  test_files: []
151
- has_rdoc: