coadjutor 0.0.4 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b9de54b9e94d4e98aeaad9a3d3de026bc7a36b2
4
- data.tar.gz: 1ccf2c5ff779a9fb53cb34bc985b4ab62624c615
3
+ metadata.gz: 41d37d3fc605732c53d3795011ce98edbeebb59b
4
+ data.tar.gz: f1fecf922bec134a43cb09c5dea4bbc354e3d842
5
5
  SHA512:
6
- metadata.gz: f28f4387d08d432793953c060a88ac305ab41494a24b88fbd271b636788b3d6b04059497881c364496d75370699092ef0928a54e96a40badeb8536af7d7eb8a9
7
- data.tar.gz: 792dae2b0298f1277467e6f3666d6f665139bb666bc727915c1c8660df1c5d6af5b9802ad7a9ee2992208c8dafd42c8998a9254b9d5273b29a4b7b90ac7c61cc
6
+ metadata.gz: fade50b362148f80e8cd6955f65746e84b6316182d4c954e607a50c84a9dd5fc890c34e46b6da6c60f8e5a8f0adb9916d0ac9f9d200bde5d46227528b380b3e8
7
+ data.tar.gz: b75254e880b4a6d66ee47591283108a1b89cd730a720afc961fff577e6a62bcbf87a0a4f126a5be3c85c2f7e2c0d48a11821559e9bcbc7ddc8827b4d09317940
data/Rakefile CHANGED
@@ -1 +1 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
@@ -1,4 +1,4 @@
1
- require "coadjutor/version"
1
+ require 'coadjutor/version'
2
2
 
3
3
  module Coadjutor
4
4
  require 'coadjutor/railtie' if defined?(Rails)
@@ -1,9 +1,12 @@
1
1
  module AuthenticationHelper
2
+ # rubocop:disable Style/GuardClause
2
3
  def authenticate_with_basic_auth
3
4
  if Chamber.env.basic_auth.enabled?
4
5
  authenticate_or_request_with_http_basic do |username, password|
5
- username == Chamber.env.basic_auth.username && password == Chamber.env.basic_auth.password
6
+ username == Chamber.env.basic_auth.username &&
7
+ password == Chamber.env.basic_auth.password
6
8
  end
7
9
  end
8
10
  end
11
+ # rubocop:enable Style/GuardClause
9
12
  end
@@ -7,7 +7,7 @@ module FlashHelper
7
7
  # TODO: If Draper ever fixes this problem, this should be converted to
8
8
  # a #content_tag
9
9
  #
10
- return <<-FLASHER.html_safe
10
+ <<-FLASHER.html_safe
11
11
  <div class="flash #{type}">
12
12
  <p class="flash_message">#{message}</p>
13
13
  </div>
@@ -2,8 +2,8 @@ module JavascriptHelper
2
2
  def js_ready(js = nil)
3
3
  javascript = '<script type="text/javascript">$(function(){ '.tap do |str|
4
4
  (str << js) if js.present?
5
- str << yield if block_given?
6
- str << ' });</script>'
5
+ str << yield if block_given?
6
+ str << ' });</script>'
7
7
  end
8
8
 
9
9
  raw javascript
@@ -1,11 +1,16 @@
1
1
  module PageTitleHelper
2
2
  def page_title(options = {})
3
- app_name = options[:app_name] || Rails.application.class.to_s.split('::').first
3
+ app_name = options[:app_name] || Rails.
4
+ application.
5
+ class.
6
+ to_s.
7
+ split('::').
8
+ first
4
9
  page_title_symbol = options[:page_title_symbol] || :page_title
5
10
  separator = options[:separator] || ' : '
6
11
 
7
12
  if content_for?(page_title_symbol)
8
- [ app_name, content_for(page_title_symbol) ].join(separator)
13
+ [app_name, content_for(page_title_symbol)].join(separator)
9
14
  else
10
15
  app_name
11
16
  end
@@ -1,20 +1,24 @@
1
1
  module Coadjutor
2
2
  module QualifiedControllerResources
3
3
  def qualified_name
4
- self.controller_path.gsub('/','-')
4
+ controller_path.gsub('/', '-')
5
5
  end
6
6
 
7
7
  def qualified_action_path
8
- "#{self.qualified_name}-#{self.action_name}"
8
+ "#{qualified_name}-#{action_name}"
9
9
  end
10
10
 
11
11
  def qualified_full_path
12
- self.request.fullpath.underscore.gsub(/[\/=]/, '-').gsub('?', '_')[1..-1]
12
+ request.fullpath.underscore.gsub(%r{[/=]}, '-').gsub('?', '_')[1..-1]
13
13
  end
14
14
 
15
15
  def qualified_layout_basename
16
- identifier = self.send(:_layout).identifier
17
- layout_path = defined?(Rails.root) ? identifier.sub("#{Rails.root}/", '') : identifier
16
+ identifier = send(:_layout).identifier
17
+ layout_path = if defined?(Rails.root)
18
+ identifier.sub("#{Rails.root}/", '')
19
+ else
20
+ identifier
21
+ end
18
22
  layout_filename = layout_path.sub('app/views/layouts/', '')
19
23
 
20
24
  layout_filename[/([^\.]+)/, 1]
@@ -10,35 +10,35 @@ require 'coadjutor/selection_helper'
10
10
 
11
11
  module Coadjutor
12
12
  class Railtie < Rails::Railtie
13
- initializer 'qualified_controller.helper' do |app|
13
+ initializer 'qualified_controller.helper' do |_app|
14
14
  ActionController::Base.send :include, QualifiedControllerResources
15
15
  end
16
16
 
17
- initializer 'authentication.helper' do |app|
17
+ initializer 'authentication.helper' do |_app|
18
18
  ActionController::Base.send :include, AuthenticationHelper
19
19
  end
20
20
 
21
- initializer 'verifiable_model.helper' do |app|
21
+ initializer 'verifiable_model.helper' do |_app|
22
22
  ActionController::Base.send :include, VerifiableModel
23
23
  end
24
24
 
25
- initializer 'css_class.helper' do |app|
25
+ initializer 'css_class.helper' do |_app|
26
26
  ActionView::Base.send :include, CssClassHelper
27
27
  end
28
28
 
29
- initializer 'page_title.helper' do |app|
29
+ initializer 'page_title.helper' do |_app|
30
30
  ActionView::Base.send :include, PageTitleHelper
31
31
  end
32
32
 
33
- initializer 'flash.helper' do |app|
33
+ initializer 'flash.helper' do |_app|
34
34
  ActionView::Base.send :include, FlashHelper
35
35
  end
36
36
 
37
- initializer 'javascript.helper' do |app|
37
+ initializer 'javascript.helper' do |_app|
38
38
  ActionView::Base.send :include, JavascriptHelper
39
39
  end
40
40
 
41
- initializer 'selection.helper' do |app|
41
+ initializer 'selection.helper' do |_app|
42
42
  ActionView::Base.send :include, SelectionHelper
43
43
  end
44
44
  end
@@ -3,15 +3,25 @@ module SelectionHelper
3
3
  current_path == path_to_match ? 'selected' : ''
4
4
  end
5
5
 
6
- def selected_if_params_match(params_to_match, options = {:default => {}})
7
- current_params = request.query_parameters.empty? ? options[:default] : request.query_parameters
6
+ def selected_if_params_match(params_to_match, options = { default: {} })
7
+ current_params = if request.query_parameters.empty?
8
+ options[:default]
9
+ else
10
+ request.query_parameters
11
+ end
8
12
 
9
13
  current_params == params_to_match ? 'selected' : ''
10
14
  end
11
15
 
12
- def selected_if_url_matches(string_to_match, options = {:default => {}})
13
- path_with_params = [request.fullpath, request.query_parameters.to_param].select(&:present?).join '?'
14
- content_to_match = path_with_params == options[:default][:if_path_equals] ? options[:default][:then_match] : path_with_params
16
+ def selected_if_url_matches(string_to_match, options = { default: {} })
17
+ path_with_params = [request.fullpath, request.query_parameters.to_param].
18
+ select(&:present?).
19
+ join '?'
20
+ content_to_match = if path_with_params == options[:default][:if_path_equals]
21
+ options[:default][:then_match]
22
+ else
23
+ path_with_params
24
+ end
15
25
 
16
26
  content_to_match.include?(string_to_match) ? 'selected' : ''
17
27
  end
@@ -4,15 +4,14 @@ module VerifiableModel
4
4
  module ClassMethods
5
5
  def verify_model_exists(model = nil, options = {})
6
6
  exceptions = options[:except] || %i{create index}
7
- model = model || self.
8
- name[/::(\w+)Controller\z/, 1].
7
+ model ||= name[/::(\w+)Controller\z/, 1].
9
8
  singularize.
10
9
  downcase
11
10
 
12
11
  before_action except: exceptions do
13
12
  model_instance = public_send(model)
14
13
 
15
- raise HumanError::Errors::ResourceNotFoundError.new(
14
+ fail HumanError::Errors::ResourceNotFoundError.new(
16
15
  resource_name: model,
17
16
  resource_id: params[:id],
18
17
  ) unless model_instance.persisted?
@@ -1,3 +1,3 @@
1
1
  module Coadjutor
2
- VERSION = "0.0.4"
2
+ VERSION = '0.0.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coadjutor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - jfelchner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-03 00:00:00.000000000 Z
11
+ date: 2015-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.2'
41
55
  description: ''
42
56
  email: accounts+git@thekompanee.com
43
57
  executables: []
@@ -80,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
94
  version: '0'
81
95
  requirements: []
82
96
  rubyforge_project: coadjutor
83
- rubygems_version: 2.2.2
97
+ rubygems_version: 2.4.6
84
98
  signing_key:
85
99
  specification_version: 4
86
100
  summary: Rails Helpers