finishing_moves 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dcac065bb1179f4a20504dfa28a865c8dabd537d
4
- data.tar.gz: 69dcdfb5bc2d249cc69cf59feb5ea8abd02ee22a
3
+ metadata.gz: d56bf8257e6c87e6b608472cb3aa7aaafe5aa921
4
+ data.tar.gz: e0f8790fb33d1b2b613429a133cb77725a90d011
5
5
  SHA512:
6
- metadata.gz: 94dc40dac77c92b1d1f046c309d3c04e7a7e50a3b7bd173906ad39be08d4a39b68e501a53d34d2a097ef79c5157753f61b05a71c06009c48e36a199c5ff10c64
7
- data.tar.gz: 6886af0eda4b7aa7cb864d740744518be9f50930b9b775e871397ee678f120a1b4bbd8469c51ebaf07280652b0ce97452560149fded283be37e46f054775cd6a
6
+ metadata.gz: f406d28dbe0a08825c828aa3c856a7e7fd3910fc20cbda106babb058e4fff488feec211d0dceb06044f7e72978203034219c8b13a64db583d7122536ddae8aae
7
+ data.tar.gz: eb8715f761ddb6a4b7871591ab8e5118901736f1b6371305bfaccca7be01f972b892cf4610444c8097ca4e282b8bb9ba047a81fd073eb7df9efbc9c534bfd3e5
data/.travis.yml CHANGED
@@ -7,6 +7,7 @@ rvm:
7
7
  - 2.1.0
8
8
  - 2.2.0
9
9
  - 2.2.1
10
+ - 2.2.2
10
11
  - ruby-head
11
12
 
12
13
  script: bundle exec rspec spec
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Finishing Moves
2
- [![Gem Version](https://badge.fury.io/rb/finishing_moves.svg)](http://badge.fury.io/rb/finishing_moves)
3
- [![Build Status](https://travis-ci.org/forgecrafted/finishing_moves.svg?branch=master)](https://travis-ci.org/forgecrafted/finishing_moves.svg?branch=master)
2
+ [![Gem Version](https://badge.fury.io/rb/finishing_moves.svg)](https://rubygems.org/gems/finishing_moves)
3
+ [![Build Status](https://travis-ci.org/forgecrafted/finishing_moves.svg?branch=master)](https://travis-ci.org/forgecrafted/finishing_moves)
4
+ [![Coverage Status](https://coveralls.io/repos/forgecrafted/finishing_moves/badge.svg?branch=master)](https://coveralls.io/r/forgecrafted/finishing_moves?branch=master)
4
5
  [![Hire Us!](https://img.shields.io/badge/pros-for%20hire-F7931E.svg)](http://www.forgecrafted.com)
5
6
 
6
7
  Ruby includes a huge amount of default awesomeness that tackles most common development challenges. But every now and then, you find yourself in a situation where an **elaborate-yet-precise** coding maneuver wins the day. Finishing Moves is a collection of methods designed to assist in those just-typical-enough-to-be-annoying scenarios.
@@ -25,6 +26,7 @@ gem install 'finishing_moves'
25
26
  Tested against **`2.0.0` and above**. Probably works in `1.9.3`.
26
27
 
27
28
  ## List of Methods
29
+ ###### Complete documentation in the [GitHub wiki](https://github.com/forgecrafted/finishing_moves/wiki)
28
30
 
29
31
  **Not sure if this gem is for you?** Check out the methods marked with a :boom: first.
30
32
 
@@ -37,7 +39,7 @@ Tested against **`2.0.0` and above**. Probably works in `1.9.3`.
37
39
  - [`Hash#delete_each`](https://github.com/forgecrafted/finishing_moves/wiki/Hash#hashdelete_each)
38
40
  - [`Hash#delete_each!`](https://github.com/forgecrafted/finishing_moves/wiki/Hash#hashdelete_each-1)
39
41
  - [`Integer#length`](https://github.com/forgecrafted/finishing_moves/wiki/Numeric#integerlength)
40
- - [`Kernel#nil_chain`](https://github.com/forgecrafted/finishing_moves/wiki/Kernel#kernelnil_chain) :boom:
42
+ - [`Kernel#nil_chain`](https://github.com/forgecrafted/finishing_moves/wiki/Kernel#kernelnil_chain) :boom::boom:
41
43
  - [`Kernel#cascade`](https://github.com/forgecrafted/finishing_moves/wiki/Kernel#kernelcascade)
42
44
  - [`Kernel#class_exists?`](https://github.com/forgecrafted/finishing_moves/wiki/Kernel#kernelclass_exists)
43
45
  - [`Numeric#add_percent`](https://github.com/forgecrafted/finishing_moves/wiki/Numeric#numericadd_percent)
@@ -51,9 +53,11 @@ Tested against **`2.0.0` and above**. Probably works in `1.9.3`.
51
53
  - [`String#nl2br`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringnl2br)
52
54
  - [`String#remove_whitespace`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringremove_whitespace)
53
55
  - [`String#strip_all`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringstrip_all) :boom:
54
- - [Boolean Typecasting](https://github.com/forgecrafted/finishing_moves/wiki/Boolean-Typecasting)
55
56
 
56
- ###### Complete documentation can be found in the [GitHub wiki](https://github.com/forgecrafted/finishing_moves/wiki)
57
+ *Multi-class logic enhancements*
58
+
59
+ - [Fiscal Calendar Calculations](https://github.com/forgecrafted/finishing_moves/wiki/Fiscal-Calendar-Calculations) :boom:
60
+ - [Boolean Typecasting](https://github.com/forgecrafted/finishing_moves/wiki/Boolean-Typecasting)
57
61
 
58
62
  ## Development approach
59
63
 
data/Vagrantfile CHANGED
@@ -9,6 +9,10 @@ Vagrant.configure("2") do |config|
9
9
  config.vm.box = "trusty32"
10
10
  config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-i386-vagrant-disk1.box"
11
11
 
12
+ # Use the normal insecure key
13
+ # https://github.com/mitchellh/vagrant/issues/2608
14
+ config.ssh.insert_key = false
15
+
12
16
  config.vm.provider :virtualbox do |vb|
13
17
  vb.customize ["modifyvm", :id,
14
18
  # Basics.
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.add_development_dependency 'priscilla', '>= 0'
25
25
  s.add_development_dependency 'pry-byebug', '>= 0'
26
26
  s.add_development_dependency 'fuubar', '>= 0'
27
+ s.add_development_dependency 'coveralls', '>= 0.8.0'
27
28
 
28
29
  s.required_ruby_version = '>= 2.0.0'
29
30
 
@@ -21,4 +21,8 @@ class Object
21
21
  name.keyify
22
22
  end
23
23
 
24
+ def self.slugify
25
+ name.slugify
26
+ end
27
+
24
28
  end
@@ -39,6 +39,14 @@ class String
39
39
  result
40
40
  end
41
41
 
42
+ def slugify
43
+ _slugify_gsub(self.keyify)
44
+ end
45
+
46
+ def slugify!
47
+ _slugify_gsub(self.keyify!)
48
+ end
49
+
42
50
  def strip_all(chars = nil)
43
51
  expr = _strip_all_prep(chars)
44
52
  gsub Regexp.union(_lstrip_all_regex(expr), _rstrip_all_regex(expr)), ''
@@ -114,6 +122,11 @@ class String
114
122
  expr << ' '
115
123
  end
116
124
 
125
+ def _slugify_gsub(str)
126
+ return nil if str.nil?
127
+ str.to_s.gsub('_', '-')
128
+ end
129
+
117
130
  end
118
131
 
119
132
  # We aren't reopening Symbol class for anything else yet, so we'll just define
@@ -124,4 +137,8 @@ class Symbol
124
137
  to_s.keyify
125
138
  end
126
139
 
140
+ def slugify
141
+ to_s.slugify
142
+ end
143
+
127
144
  end
@@ -1,3 +1,3 @@
1
1
  module FinishingMoves
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
data/provision.sh CHANGED
@@ -3,7 +3,7 @@
3
3
  # Shell user settings.
4
4
  USER_NAME=vagrant
5
5
  USER_HOME=/home/$USER_NAME
6
- DEFAULT_RUBY='2.2.1'
6
+ DEFAULT_RUBY='2.2.2'
7
7
 
8
8
  ###############################################################################
9
9
  # Functions
@@ -14,12 +14,6 @@ as_user() {
14
14
  su -l $USER_NAME -c "$*"
15
15
  }
16
16
 
17
- # Install the requested version of Ruby, with Bundler.
18
- install_ruby() {
19
- as_user "rbenv install -s $1"
20
- as_user "RBENV_VERSION=$1 gem install bundler"
21
- }
22
-
23
17
  ###############################################################################
24
18
  # Base System
25
19
  ###############################################################################
@@ -57,14 +51,11 @@ truncate -s 0 $USER_HOME/.bashrc
57
51
  echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> $USER_HOME/.bashrc
58
52
  echo 'eval "$(rbenv init -)"' >> $USER_HOME/.bashrc
59
53
  echo 'cd /vagrant' >> $USER_HOME/.bashrc
60
- echo 'gem: --no-document' >> $USER_HOME/.gemrc
61
54
 
62
- # Install Ruby for $USER_NAME.
63
- install_ruby $DEFAULT_RUBY
64
- /home/$USER_NAME/.rbenv/bin/rbenv global $DEFAULT_RUBY
55
+ echo 'gem: --no-document' > $USER_HOME/.gemrc
65
56
 
66
- ###############################################################################
67
- # EDIT HERE!
68
- # Install any Rubies (other than $DEFAULT_RUBY) required for individual apps.
69
- ###############################################################################
70
- # e.g. `install_ruby 2.1.4`
57
+ # Install the requested version of Ruby, with Bundler.
58
+ as_user "rbenv install -s $DEFAULT_RUBY"
59
+ as_user "rbenv global $DEFAULT_RUBY"
60
+ as_user "RBENV_VERSION=$DEFAULT_RUBY gem install bundler"
61
+ as_user "cd /vagrant && bundle"
data/spec/spec_helper.rb CHANGED
@@ -6,6 +6,10 @@ Bundler.setup
6
6
  require 'priscilla'
7
7
  require 'pry'
8
8
  require 'byebug'
9
+
10
+ require 'coveralls'
11
+ Coveralls.wear!
12
+
9
13
  require 'finishing_moves'
10
14
 
11
15
  # This file was generated by the `rspec --init` command. Conventionally, all
data/spec/string_spec.rb CHANGED
@@ -155,4 +155,30 @@ describe String do
155
155
  expect('1 2 3 4 5'.dedupe(' ').remove_whitespace('+')).to eq '1+2+3+4+5'
156
156
  end
157
157
 
158
+ it '#slugify' do
159
+ expect(Integer.slugify).to eq 'integer'
160
+ expect(Math::DomainError.slugify).to eq 'math-domain-error'
161
+ expect('FooBarBaz'.slugify).to eq 'foo-bar-baz'
162
+ expect(:FooBarBaz.slugify).to eq 'foo-bar-baz'
163
+ expect("Foo-Bar'Baz".slugify).to eq 'foo-bar-baz'
164
+ expect('(Foo*&Bar!Baz?'.slugify).to eq 'foo-bar-baz'
165
+ expect('1234FooBAR'.slugify).to eq 'foo-bar'
166
+ expect('!@#$Foo0987'.slugify).to eq 'foo0987'
167
+ expect('!@#$%^'.slugify).to eq nil
168
+ expect('12345678'.slugify).to eq nil
169
+ expect("Bill O'Shea".slugify).to eq 'bill-o-shea'
170
+ expect("Bill O Shea".slugify).to eq 'bill-o-shea'
171
+ expect("Bill O Shea".slugify).to eq 'bill-o-shea'
172
+
173
+ # make sure we're not performing in place
174
+ str = 'FooBarBaz'
175
+ expect(str.slugify).to eq 'foo-bar-baz'
176
+ expect(str).to eq 'FooBarBaz'
177
+ end
178
+
179
+ it '#slugify!' do
180
+ expect{ '!@#$%^'.slugify! }.to raise_error(ArgumentError)
181
+ expect{ '12345678'.slugify! }.to raise_error(ArgumentError)
182
+ end
183
+
158
184
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finishing_moves
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Koehl
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-17 00:00:00.000000000 Z
12
+ date: 2015-06-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rb-readline
@@ -81,6 +81,20 @@ dependencies:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: coveralls
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: 0.8.0
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: 0.8.0
84
98
  description: |2
85
99
  Ruby includes a huge amount of default awesomeness that tackles most common development challenges. But every now and then, you find yourself in a situation where an elaborate-yet-precise coding maneuver wins the day. Finishing Moves is a collection of methods designed to assist in those just-typical-enough-to-be-annoying scenarios.
86
100
  email: