titleist 0.1.0 → 0.1.1

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
- SHA1:
3
- metadata.gz: 90873ada754915c66697e0e34345b70b6bbccc42
4
- data.tar.gz: 1c6320f8d4f050b56c459f775118a94704748f8f
2
+ SHA256:
3
+ metadata.gz: 42df92f4c0e44490b8c02b56ff36ad5c3e66dad1ec9ed63c8fb59179e54806ae
4
+ data.tar.gz: 1addf48188b2446fb2dddd3bb353f40c9a279b9cd9f65034a6448e94db12815a
5
5
  SHA512:
6
- metadata.gz: dc54ebf325f9c2e4e617576bb2c3751594b6436c2ade7927c27bdaf9f14c67579d42c15cfe866b9cd129ed3567290c595b3932889f18b1bb2fe6d0e2eeb5051b
7
- data.tar.gz: fd7b6fe3fc6892e8180cc83571a251d927dd3f357e78be11f78c822de4eabdbe844d4800ee73bf9b161019f766eba98b1378bc60cc68f2bc831d97df3c40fb44
6
+ metadata.gz: 7f737f1811c17b6122d0b0efc54b27914d63ade1543e6cd2b5e3075ed3e8c74b50251b2d753d1c2a7871f151956a32fb474f7a1258ee793aa8924d776800db32
7
+ data.tar.gz: 76b42a7bc0047d9f3930c829027e8692eb89584a4f10ac9d88f251622f1e5180efac6a9d227d30dbf7a6374647b6673c1e2847c6d103a26e58b93ae3085249da
data/.gitignore CHANGED
@@ -1,11 +1,11 @@
1
1
  .bundle/
2
2
  log/*.log
3
3
  pkg/
4
- spec/dummy/db/*.sqlite3
5
- spec/dummy/db/*.sqlite3-journal
6
- spec/dummy/log/*.log
7
- spec/dummy/tmp/
8
- spec/examples.txt
4
+ test/dummy/db/*.sqlite3
5
+ test/dummy/db/*.sqlite3-journal
6
+ test/dummy/log/*.log
7
+ test/dummy/tmp/
8
+ test/examples.txt
9
9
  vendor/
10
10
  Gemfile.lock
11
11
  .yardoc/
data/.rubocop.yml CHANGED
@@ -1,11 +1,16 @@
1
+ AllCops:
2
+ Exclude:
3
+ - test/dummy/**/*
4
+ - vendor/**/*
5
+
1
6
  Style/StringLiterals:
2
7
  Enabled: false
3
8
 
9
+ Style/FrozenStringLiteralComment:
10
+ Enabled: false
11
+
4
12
  Metrics/LineLength:
5
13
  Exclude:
6
- - spec/**/*
7
- - bin/**/*
8
14
  - titleist.gemspec
9
-
10
- Style/FrozenStringLiteralComment:
11
- Enabled: false
15
+ - test/test_helper.rb
16
+ - bin/rails
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.6.2
data/.travis.yml CHANGED
@@ -1,11 +1,29 @@
1
1
  # set up the container
2
+ sudo: false
2
3
  language: ruby
3
4
  rvm:
4
- - 2.3.1
5
- cache: bundle
5
+ - 2.3
6
+ - 2.4
7
+ - 2.5
8
+ - 2.6
6
9
 
7
- # test the build
8
- script: bin/rake
10
+ # cache dependencies
11
+ cache: bundler
12
+
13
+ # install the codeclimate test reporter
14
+ before_script:
15
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
16
+ - chmod +x ./cc-test-reporter
17
+ - ./cc-test-reporter before-build
18
+
19
+ # run all tests
20
+ script:
21
+ - bin/rails test
22
+ - bin/rails test test/system
23
+
24
+ # build the .gem package
25
+ after_success:
26
+ - bin/rails build
9
27
 
10
28
  # deploy tags to rubygems
11
29
  deploy:
@@ -14,7 +32,14 @@ deploy:
14
32
  tags: true
15
33
  api_key:
16
34
  secure: RtW6VGSMsO7Lz53VEL5moSiFPjdM7IP8tj0oSkg0AJcBzdI6AQdy4C3mFB84GXf7BJ7fVYdkWHNA3wEpD5XeAMRTMjNh8gsygdBepQ90r3NvPGiusrpyfrPEUD2Tm0RJh1AJTYLPi1snUktMemM75J0xhYvkeXEmtS5WrfbNtJOkNvPSJODSnPWQVf6++Q26JfT7IbVXzdXYmCbsZPDd/E9Q3Sxd3kgsIA3RMf4/jaoffGHpGbYL4+zhZyXZTgmOzw+6TuCMPVfHPWisRdoqQ75vcjVvXjePxZNBXB2Ap4biGXT78kTb2zOOM4ZxUAq8fFxF3sELMiKs/AhDGtUfhi8fRjJl6fes1NW6ONMvMbLkkk3puzu2i/fuwXpFLhr54d7OIhkDpjukadz7/vI+UescojA+kr5HwY1zKG6hbi7ayaMXaF1CNZk+ivB2yadvv0et7upoAmFSwEfAtN34mFlgLFAgn2U+MByl4OvZW87ndF4XvRthpNX4KgyGKhYenBHKgPZswvvsbsymOCxh217P0VFM7kuUv7lrF1WyraJbxPQPHgIS+JXDFhkgLFwTmZw9OccQx+E/czE1P6Ou2V5jcKk6tG/6YaEn/I0u5jeYdkstAsNEnaIO7fhjEE12BOrPn6myBps67KdjJdN9i0Q/cFtnc7A1EP5JbVZqqYE=
35
+
36
+ # report code coverage results to codeclimate
37
+ after_script:
38
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
39
+
40
+ # analyze the codebase and coverage with codeclimate
17
41
  addons:
42
+ chrome: stable
18
43
  code_climate:
19
44
  repo_token:
20
45
  secure: ED+KEjC0xp89malnpkDPAMh9AyNK+1XE+wb8j8cXRheGHSMgLrDFw1cL6q+fyMuSGd56ITaqER86FuThHhH7YYEyd+x9ySf5j013u7CAKkXzkwqinT9Z3YK+LRC6OlELn88PDrvwN+Pc+2KhqusFDPcog9BizxcxiNXv0iOIIVqCnthZ5P+227K6TDwwwJO2NuL6V3IFl2YtlxC0Nze063/D/7H+U15Bnzt4XZJYkYmv7Q2G8dV0czymAhBGZ4okiht/pMrJiHlp3Qr8hO3U9A6sJXKMgkrhfn50VSsSLXqeLm0qnDshQArNrakeAAei5ZFCTgpUvJjrpQA1lPhA/IKtgFd57JRMUKqDuh8q497VgphEaOAbB0Z2hs3oFFCEq+lTD+cOQ5q5aQHXMOwKGVDCgnFRaR7ZYScJwCpMV4syse1HsjnEDOr5ELCwVIElw36xjFRTz3tfThn2eu2QFLskuatFhk+yhvHzrvwVopZFMpuj855kYjJeu5+Kkek9lzjKieXOry4ByiisclszLZ4Xll7QSWiTyeTCDVZ+igOb9nxOBsFgjYaFIBiFFWx2GOVPToPt/MYQEgmfq+VZbgncOvl2yeoCYSMZUlPDO7n3w/UTWmIMfh+vGwccsBm0siT3mhDcN+asqbkjiXF3B+afoaFyMNKVlR4Zpor/GqY=
data/Rakefile CHANGED
@@ -1,10 +1,10 @@
1
1
  require 'bundler/setup'
2
2
  require 'yard'
3
- require 'rspec/core/rake_task'
4
3
  require 'rubocop/rake_task'
5
4
  require 'travis/release'
5
+ require 'rake/testtask'
6
6
 
7
- APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
7
+ APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
8
8
 
9
9
  load 'rails/tasks/engine.rake'
10
10
  load 'rails/tasks/statistics.rake'
@@ -12,9 +12,6 @@ load 'rails/tasks/statistics.rake'
12
12
  desc 'Generate documentation'
13
13
  YARD::Rake::YardocTask.new :doc
14
14
 
15
- desc 'Run all tests'
16
- RSpec::Core::RakeTask.new :test
17
-
18
15
  desc 'Run lint checks'
19
16
  RuboCop::RakeTask.new :lint
20
17
 
@@ -23,5 +20,3 @@ RuboCop::RakeTask.new :lint
23
20
  Travis::Release::Task.new
24
21
 
25
22
  Bundler::GemHelper.install_tasks
26
-
27
- task default: %i(test build)
@@ -18,7 +18,8 @@ module TitleistHelper
18
18
  @title ||= Titleist::Title.new(
19
19
  controller: controller.controller_name,
20
20
  action: controller.action_name,
21
- context: context
21
+ context: context,
22
+ root: current_page?(root_path)
22
23
  )
23
24
  end
24
25
 
data/bin/rails CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
  # This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
3
3
 
4
- ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
- ENGINE_PATH = File.expand_path('../../lib/titleist/engine', __FILE__)
4
+ ENGINE_ROOT = File.expand_path('..', __dir__)
5
+ ENGINE_PATH = File.expand_path('../lib/titleist/engine', __dir__)
6
6
 
7
7
  # Set up gems listed in the Gemfile.
8
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
8
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
9
9
  require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
10
10
 
11
11
  require 'rails/all'
@@ -1,6 +1,6 @@
1
1
  # Generate initial files for the gem to work.
2
2
  class TitleistGenerator < Rails::Generators::Base
3
- source_root File.expand_path('../templates', __FILE__)
3
+ source_root File.expand_path('templates', __dir__)
4
4
 
5
5
  def copy_locale
6
6
  template 'locale.yml.erb', 'config/locales/titleist.en.yml'
@@ -20,10 +20,12 @@ module Titleist
20
20
  # @param controller [String] Current request controller name.
21
21
  # @param action [String] Current request action name.
22
22
  # @param context [Hash] Optional params passed in from the helper.
23
- def initialize(controller: '', action: '', context: {})
23
+ # @param root [Boolean] Whether this is the root path
24
+ def initialize(controller: '', action: '', context: {}, root: false)
24
25
  @controller = controller
25
26
  @action = action
26
27
  @context = context
28
+ @root = root
27
29
  end
28
30
 
29
31
  # Global application title.
@@ -56,6 +58,7 @@ module Titleist
56
58
  # @return [String]
57
59
  def to_s
58
60
  return app if root?
61
+
59
62
  I18n.t :format, to_h
60
63
  end
61
64
 
@@ -70,9 +73,13 @@ module Titleist
70
73
  }
71
74
  end
72
75
 
73
- # TODO: Necessary?
76
+ # Whether the page we're generating a title for is the root path.
77
+ # This will cause no page title to display, and is set when the
78
+ # title object is instantiated.
79
+ #
80
+ # @return [Boolean]
74
81
  def root?
75
- false
82
+ @root
76
83
  end
77
84
 
78
85
  private
@@ -101,6 +108,7 @@ module Titleist
101
108
  # @return [String] Action title combined with resource title.
102
109
  def default_page_title
103
110
  return controller.titleize if action == 'index'
111
+
104
112
  [action_title, resource_title].join(' ')
105
113
  end
106
114
 
@@ -132,7 +140,11 @@ module Titleist
132
140
  # @private
133
141
  # @return [Array] Derived i18n scope.
134
142
  def scope
135
- @scope ||= [ROOT_SCOPE, controller]
143
+ @scope ||= [ROOT_SCOPE, *demodulized_controller]
144
+ end
145
+
146
+ def demodulized_controller
147
+ controller.split('/').map(&:to_sym)
136
148
  end
137
149
  end
138
150
  end
@@ -1,3 +1,3 @@
1
1
  module Titleist
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
data/titleist.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- $LOAD_PATH.push File.expand_path('../lib', __FILE__)
1
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
2
2
 
3
3
  # Maintain your gem's version:
4
4
  require 'titleist/version'
@@ -9,20 +9,23 @@ Gem::Specification.new do |s|
9
9
  s.version = Titleist::VERSION
10
10
  s.authors = ['Tom Scott']
11
11
  s.email = ['tscott@weblinc.com']
12
- s.homepage = 'https://github.com/tubbo/titleist.git'
12
+ s.homepage = 'https://tubbo.github.io/titleist'
13
13
  s.summary = 'Powerful, i18n-abusing title helper for Rails apps'
14
14
  s.description = "#{s.description}. Improve your swing."
15
15
  s.license = 'MIT'
16
- s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
16
+ s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test)/}) }
17
17
 
18
18
  s.add_dependency 'rails'
19
19
 
20
- s.add_development_dependency 'pg'
21
- s.add_development_dependency 'rspec-rails'
22
- s.add_development_dependency 'capybara'
23
- s.add_development_dependency 'rubocop'
24
- s.add_development_dependency 'yard'
20
+ s.add_development_dependency 'capybara', '~> 3'
25
21
  s.add_development_dependency 'codeclimate-test-reporter'
26
- s.add_development_dependency 'generator_spec'
22
+ s.add_development_dependency 'minitest', '~> 5'
23
+ s.add_development_dependency 'mocha'
24
+ s.add_development_dependency 'puma'
25
+ s.add_development_dependency 'rubocop', '~> 0.71'
26
+ s.add_development_dependency 'selenium-webdriver'
27
+ s.add_development_dependency 'sqlite3'
27
28
  s.add_development_dependency 'travis-release'
29
+ s.add_development_dependency 'webdrivers'
30
+ s.add_development_dependency 'yard', '~> 0.9'
28
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: titleist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Scott
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-23 00:00:00.000000000 Z
11
+ date: 2019-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -25,7 +25,21 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: pg
28
+ name: capybara
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: codeclimate-test-reporter
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - ">="
@@ -39,7 +53,21 @@ dependencies:
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
- name: rspec-rails
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5'
69
+ - !ruby/object:Gem::Dependency
70
+ name: mocha
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
73
  - - ">="
@@ -53,7 +81,7 @@ dependencies:
53
81
  - !ruby/object:Gem::Version
54
82
  version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
- name: capybara
84
+ name: puma
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
87
  - - ">="
@@ -70,18 +98,18 @@ dependencies:
70
98
  name: rubocop
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
- - - ">="
101
+ - - "~>"
74
102
  - !ruby/object:Gem::Version
75
- version: '0'
103
+ version: '0.71'
76
104
  type: :development
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
- - - ">="
108
+ - - "~>"
81
109
  - !ruby/object:Gem::Version
82
- version: '0'
110
+ version: '0.71'
83
111
  - !ruby/object:Gem::Dependency
84
- name: yard
112
+ name: selenium-webdriver
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
115
  - - ">="
@@ -95,7 +123,7 @@ dependencies:
95
123
  - !ruby/object:Gem::Version
96
124
  version: '0'
97
125
  - !ruby/object:Gem::Dependency
98
- name: codeclimate-test-reporter
126
+ name: sqlite3
99
127
  requirement: !ruby/object:Gem::Requirement
100
128
  requirements:
101
129
  - - ">="
@@ -109,7 +137,7 @@ dependencies:
109
137
  - !ruby/object:Gem::Version
110
138
  version: '0'
111
139
  - !ruby/object:Gem::Dependency
112
- name: generator_spec
140
+ name: travis-release
113
141
  requirement: !ruby/object:Gem::Requirement
114
142
  requirements:
115
143
  - - ">="
@@ -123,7 +151,7 @@ dependencies:
123
151
  - !ruby/object:Gem::Version
124
152
  version: '0'
125
153
  - !ruby/object:Gem::Dependency
126
- name: travis-release
154
+ name: webdrivers
127
155
  requirement: !ruby/object:Gem::Requirement
128
156
  requirements:
129
157
  - - ">="
@@ -136,6 +164,20 @@ dependencies:
136
164
  - - ">="
137
165
  - !ruby/object:Gem::Version
138
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: yard
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '0.9'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '0.9'
139
181
  description: ". Improve your swing."
140
182
  email:
141
183
  - tscott@weblinc.com
@@ -145,7 +187,6 @@ extra_rdoc_files: []
145
187
  files:
146
188
  - ".codeclimate.yml"
147
189
  - ".gitignore"
148
- - ".rspec"
149
190
  - ".rubocop.yml"
150
191
  - ".ruby-version"
151
192
  - ".travis.yml"
@@ -160,8 +201,6 @@ files:
160
201
  - app/models/.keep
161
202
  - app/views/.keep
162
203
  - bin/rails
163
- - bin/rake
164
- - bin/rspec
165
204
  - lib/generators/titleist/USAGE
166
205
  - lib/generators/titleist/templates/locale.yml.erb
167
206
  - lib/generators/titleist/titleist_generator.rb
@@ -171,7 +210,7 @@ files:
171
210
  - lib/titleist/title.rb
172
211
  - lib/titleist/version.rb
173
212
  - titleist.gemspec
174
- homepage: https://github.com/tubbo/titleist.git
213
+ homepage: https://tubbo.github.io/titleist
175
214
  licenses:
176
215
  - MIT
177
216
  metadata: {}
@@ -190,10 +229,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
229
  - !ruby/object:Gem::Version
191
230
  version: '0'
192
231
  requirements: []
193
- rubyforge_project:
194
- rubygems_version: 2.5.1
232
+ rubygems_version: 3.0.3
195
233
  signing_key:
196
234
  specification_version: 4
197
235
  summary: Powerful, i18n-abusing title helper for Rails apps
198
236
  test_files: []
199
- has_rdoc:
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --require spec_helper
data/bin/rake DELETED
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
- #
4
- # This file was generated by Bundler.
5
- #
6
- # The application 'rake' is installed as part of a gem, and
7
- # this file is here to facilitate running it.
8
- #
9
-
10
- require 'pathname'
11
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
12
- Pathname.new(__FILE__).realpath)
13
-
14
- require 'rubygems'
15
- require 'bundler/setup'
16
-
17
- load Gem.bin_path('rake', 'rake')
data/bin/rspec DELETED
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
- #
4
- # This file was generated by Bundler.
5
- #
6
- # The application 'rspec' is installed as part of a gem, and
7
- # this file is here to facilitate running it.
8
- #
9
-
10
- require 'pathname'
11
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
12
- Pathname.new(__FILE__).realpath)
13
-
14
- require 'rubygems'
15
- require 'bundler/setup'
16
-
17
- load Gem.bin_path('rspec-core', 'rspec')