positive_group_support 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Capfile +33 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/config/deploy/production.rb +61 -0
- data/config/deploy/staging.rb +61 -0
- data/config/deploy.rb +38 -0
- data/exe/positive_group_support +3 -0
- data/lib/positive_group_support/array_ext.rb +139 -0
- data/lib/positive_group_support/hash_ext.rb +12 -0
- data/lib/positive_group_support/version.rb +3 -0
- data/lib/positive_group_support.rb +35 -0
- data/positive_group_support.gemspec +44 -0
- metadata +192 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7e8303d8c44211521a5d35fe831f6d7e7f4fa3e6
|
4
|
+
data.tar.gz: 4a13087d474ba57bf70f8e2c611377237ae58816
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 891c80ac45c669183d69c8b5a0f269d70563d2f8b9d382bd4b4a3e0a6d2b626a2a613e974d7491cc18ca61cf5d95ffe3abe1e9c4a83e7593ee5a43dc976ad96b
|
7
|
+
data.tar.gz: a7e38c43aa42240f4d9f59e98e0a9bdfe696e6f72e1f8c110a863b4cb70591b7e09b856241998cde73b2407830e49f4f4a328f293fda740f8d0f00992db629f4
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Capfile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Load DSL and set up stages
|
2
|
+
require 'capistrano/setup'
|
3
|
+
|
4
|
+
# Include default deployment tasks
|
5
|
+
require 'capistrano/deploy'
|
6
|
+
|
7
|
+
require 'deplo'
|
8
|
+
|
9
|
+
# Include tasks from other gems included in your Gemfile
|
10
|
+
#
|
11
|
+
# For documentation on these, see for example:
|
12
|
+
#
|
13
|
+
# https://github.com/capistrano/rvm
|
14
|
+
# https://github.com/capistrano/rbenv
|
15
|
+
# https://github.com/capistrano/chruby
|
16
|
+
# https://github.com/capistrano/bundler
|
17
|
+
# https://github.com/capistrano/rails
|
18
|
+
# https://github.com/capistrano/passenger
|
19
|
+
#
|
20
|
+
# require 'capistrano/rvm'
|
21
|
+
# require 'capistrano/rbenv'
|
22
|
+
# require 'capistrano/chruby'
|
23
|
+
# require 'capistrano/bundler'
|
24
|
+
# require 'capistrano/rails/assets'
|
25
|
+
# require 'capistrano/rails/migrations'
|
26
|
+
# require 'capistrano/passenger'
|
27
|
+
|
28
|
+
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
|
29
|
+
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
|
30
|
+
|
31
|
+
Rake::Task[:production].invoke
|
32
|
+
invoke :production
|
33
|
+
set_cap_tasks_from_deplo
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Shu Fujita
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# PositiveGroupSupport
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/positive_group_support`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'positive_group_support'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install positive_group_support
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec positive_group_support` to use the code located in this directory, ignoring other installed copies of this gem.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
1. Fork it ( https://github.com/[my-github-username]/positive_group_support/fork )
|
36
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "positive_group_support"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# server-based syntax
|
2
|
+
# ======================
|
3
|
+
# Defines a single server with a list of roles and multiple properties.
|
4
|
+
# You can define all roles on a single server, or split them:
|
5
|
+
|
6
|
+
# server 'example.com', user: 'deploy', roles: %w{app db web}, my_property: :my_value
|
7
|
+
# server 'example.com', user: 'deploy', roles: %w{app web}, other_property: :other_value
|
8
|
+
# server 'db.example.com', user: 'deploy', roles: %w{db}
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
# role-based syntax
|
13
|
+
# ==================
|
14
|
+
|
15
|
+
# Defines a role with one or multiple servers. The primary server in each
|
16
|
+
# group is considered to be the first unless any hosts have the primary
|
17
|
+
# property set. Specify the username and a domain or IP for the server.
|
18
|
+
# Don't use `:all`, it's a meta role.
|
19
|
+
|
20
|
+
# role :app, %w{deploy@example.com}, my_property: :my_value
|
21
|
+
# role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value
|
22
|
+
# role :db, %w{deploy@example.com}
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
# Configuration
|
27
|
+
# =============
|
28
|
+
# You can set any configuration variable like in config/deploy.rb
|
29
|
+
# These variables are then only loaded and set in this stage.
|
30
|
+
# For available Capistrano configuration variables see the documentation page.
|
31
|
+
# http://capistranorb.com/documentation/getting-started/configuration/
|
32
|
+
# Feel free to add new variables to customise your setup.
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
# Custom SSH Options
|
37
|
+
# ==================
|
38
|
+
# You may pass any option but keep in mind that net/ssh understands a
|
39
|
+
# limited set of options, consult the Net::SSH documentation.
|
40
|
+
# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start
|
41
|
+
#
|
42
|
+
# Global options
|
43
|
+
# --------------
|
44
|
+
# set :ssh_options, {
|
45
|
+
# keys: %w(/home/rlisowski/.ssh/id_rsa),
|
46
|
+
# forward_agent: false,
|
47
|
+
# auth_methods: %w(password)
|
48
|
+
# }
|
49
|
+
#
|
50
|
+
# The server-based syntax can be used to override options:
|
51
|
+
# ------------------------------------
|
52
|
+
# server 'example.com',
|
53
|
+
# user: 'user_name',
|
54
|
+
# roles: %w{web app},
|
55
|
+
# ssh_options: {
|
56
|
+
# user: 'user_name', # overrides user setting above
|
57
|
+
# keys: %w(/home/user_name/.ssh/id_rsa),
|
58
|
+
# forward_agent: false,
|
59
|
+
# auth_methods: %w(publickey password)
|
60
|
+
# # password: 'please use keys'
|
61
|
+
# }
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# server-based syntax
|
2
|
+
# ======================
|
3
|
+
# Defines a single server with a list of roles and multiple properties.
|
4
|
+
# You can define all roles on a single server, or split them:
|
5
|
+
|
6
|
+
# server 'example.com', user: 'deploy', roles: %w{app db web}, my_property: :my_value
|
7
|
+
# server 'example.com', user: 'deploy', roles: %w{app web}, other_property: :other_value
|
8
|
+
# server 'db.example.com', user: 'deploy', roles: %w{db}
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
# role-based syntax
|
13
|
+
# ==================
|
14
|
+
|
15
|
+
# Defines a role with one or multiple servers. The primary server in each
|
16
|
+
# group is considered to be the first unless any hosts have the primary
|
17
|
+
# property set. Specify the username and a domain or IP for the server.
|
18
|
+
# Don't use `:all`, it's a meta role.
|
19
|
+
|
20
|
+
# role :app, %w{deploy@example.com}, my_property: :my_value
|
21
|
+
# role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value
|
22
|
+
# role :db, %w{deploy@example.com}
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
# Configuration
|
27
|
+
# =============
|
28
|
+
# You can set any configuration variable like in config/deploy.rb
|
29
|
+
# These variables are then only loaded and set in this stage.
|
30
|
+
# For available Capistrano configuration variables see the documentation page.
|
31
|
+
# http://capistranorb.com/documentation/getting-started/configuration/
|
32
|
+
# Feel free to add new variables to customise your setup.
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
# Custom SSH Options
|
37
|
+
# ==================
|
38
|
+
# You may pass any option but keep in mind that net/ssh understands a
|
39
|
+
# limited set of options, consult the Net::SSH documentation.
|
40
|
+
# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start
|
41
|
+
#
|
42
|
+
# Global options
|
43
|
+
# --------------
|
44
|
+
# set :ssh_options, {
|
45
|
+
# keys: %w(/home/rlisowski/.ssh/id_rsa),
|
46
|
+
# forward_agent: false,
|
47
|
+
# auth_methods: %w(password)
|
48
|
+
# }
|
49
|
+
#
|
50
|
+
# The server-based syntax can be used to override options:
|
51
|
+
# ------------------------------------
|
52
|
+
# server 'example.com',
|
53
|
+
# user: 'user_name',
|
54
|
+
# roles: %w{web app},
|
55
|
+
# ssh_options: {
|
56
|
+
# user: 'user_name', # overrides user setting above
|
57
|
+
# keys: %w(/home/user_name/.ssh/id_rsa),
|
58
|
+
# forward_agent: false,
|
59
|
+
# auth_methods: %w(publickey password)
|
60
|
+
# # password: 'please use keys'
|
61
|
+
# }
|
data/config/deploy.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# config valid only for current version of Capistrano
|
2
|
+
lock '3.4.0'
|
3
|
+
|
4
|
+
set :application, 'gem_positive_group_support'
|
5
|
+
set :repo_url, 'https://github.com/osorubeki-fujita/positive_group_support.git'
|
6
|
+
|
7
|
+
set :pj_dir , ::File.expand_path( "#{ ::File.dirname( __FILE__ ) }/.." )
|
8
|
+
set :github_remote_name , :origin
|
9
|
+
|
10
|
+
# Default branch is :master
|
11
|
+
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
|
12
|
+
|
13
|
+
# Default deploy_to directory is /var/www/my_app_name
|
14
|
+
set :deploy_to, '/'
|
15
|
+
|
16
|
+
# Default value for :scm is :git
|
17
|
+
# set :scm, :git
|
18
|
+
|
19
|
+
# Default value for :format is :pretty
|
20
|
+
# set :format, :pretty
|
21
|
+
|
22
|
+
# Default value for :log_level is :debug
|
23
|
+
# set :log_level, :debug
|
24
|
+
|
25
|
+
# Default value for :pty is false
|
26
|
+
# set :pty, true
|
27
|
+
|
28
|
+
# Default value for :linked_files is []
|
29
|
+
# set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')
|
30
|
+
|
31
|
+
# Default value for linked_dirs is []
|
32
|
+
# set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')
|
33
|
+
|
34
|
+
# Default value for default_env is {}
|
35
|
+
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
|
36
|
+
|
37
|
+
# Default value for keep_releases is 5
|
38
|
+
# set :keep_releases, 5
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# 配列 Array への追加機能をまとめたモジュール
|
2
|
+
module PositiveGroupSupport::ArrayExt
|
3
|
+
|
4
|
+
# @!group 基礎情報
|
5
|
+
|
6
|
+
# 最後の要素の添字(長さ - 1)を取得する.
|
7
|
+
# @return [Integer (natural)]
|
8
|
+
# @example
|
9
|
+
# [0, 1, 2, 3, 4].last_index => 4
|
10
|
+
# [1, 2, 3, 4, 5].last_index => 4
|
11
|
+
# [0].last_index => 0
|
12
|
+
# [].last_index => -1
|
13
|
+
# [0, 1, 2, 3, 4, 5, 6].last_index => 6
|
14
|
+
# [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].last_index => 9
|
15
|
+
# [1, 2, 3, 4, 5, 6].last_index => 5
|
16
|
+
# [1, 2, 3, 4, 5, 6, 7, 8, 9].last_index => 8
|
17
|
+
# [2, 4, 6, 8, 10, 12, 14, 16].last_index => 7
|
18
|
+
def last_index
|
19
|
+
length - 1
|
20
|
+
end
|
21
|
+
|
22
|
+
# 長さの桁数を取得する.
|
23
|
+
# @return [Integer (natural)]
|
24
|
+
# @note {Numeric#digit} を利用する.
|
25
|
+
# @example
|
26
|
+
# ( 1..99 ).map( &:itself ).digit_of_length => 2
|
27
|
+
# ( 1..100 ).map( &:itself ).digit_of_length => 3
|
28
|
+
def digit_of_length
|
29
|
+
length.digit
|
30
|
+
end
|
31
|
+
|
32
|
+
# @!group 重複
|
33
|
+
|
34
|
+
# 重複する要素がないことを判定するメソッド
|
35
|
+
# @return [Boolean]
|
36
|
+
# @note self.length と self.uniq.length を比較することで判定する.
|
37
|
+
# @see http://takuya-1st.hatenablog.jp/entry/20100103/1262486833
|
38
|
+
# @example
|
39
|
+
# [1, 1, 2, 3, 5, 8, 13].uniq? => false
|
40
|
+
# [1, 2, 4, 6, 8, 10, 12].uniq? => true
|
41
|
+
def uniq?
|
42
|
+
length == uniq.length
|
43
|
+
end
|
44
|
+
|
45
|
+
# 重複する要素があることを判定するメソッド
|
46
|
+
# @return [Boolean]
|
47
|
+
# @example
|
48
|
+
# [1, 1, 2, 3, 5, 8, 13].duplicated? => true
|
49
|
+
# [1, 2, 4, 6, 8, 10, 12].duplicated? => false
|
50
|
+
def duplicated?
|
51
|
+
!( uniq? )
|
52
|
+
end
|
53
|
+
|
54
|
+
# 重複する要素の配列を取得するメソッド
|
55
|
+
# @return [Array]
|
56
|
+
# @see http://takuya-1st.hatenablog.jp/entry/20100103/1262486833
|
57
|
+
# @example
|
58
|
+
# [1, 1, 2, 3, 3, 3, 2, 3, 4, 3, 3, 5].duplicated_elements => [1, 2, 3]
|
59
|
+
def duplicated_elements
|
60
|
+
uniq.select{ |i| index(i) != rindex(i) }
|
61
|
+
end
|
62
|
+
|
63
|
+
# 配列内で連続して同じ要素が続いている場合,連続部分での重複を解消する.
|
64
|
+
# @todo 説明がしにくい.ドキュメントの重要性を示す例として採用する.
|
65
|
+
# @return [Array]
|
66
|
+
# @example
|
67
|
+
# [1, 1, 2, 3, 3, 3, 2, 3, 4, 3, 3, 5].unique => [1, 2, 3, 2, 3, 4, 3, 5]
|
68
|
+
#
|
69
|
+
# ☆ cf. Array#uniq との違い
|
70
|
+
# [1, 1, 2, 3, 3, 3, 2, 3, 4, 3, 3, 5].uniq => [1, 2, 3, 4, 5]
|
71
|
+
def unique
|
72
|
+
ary = ::Array.new
|
73
|
+
each_with_index{ | element , i |
|
74
|
+
unless i > 0 && self[i-1] == element
|
75
|
+
ary << element
|
76
|
+
end
|
77
|
+
}
|
78
|
+
ary
|
79
|
+
end
|
80
|
+
|
81
|
+
# 長さが n であるか否かを判定する.
|
82
|
+
# @param [Integer (natural) or nil] n 自然数を指定する.nil を指定した場合は常に true を返す.
|
83
|
+
# @return [Boolean] self の長さが n であるか否かの真偽値
|
84
|
+
# @raise [Error] n に自然数でも nil でもないものを与えたときに発生するエラー
|
85
|
+
# @example
|
86
|
+
# (1..100).map( &:itself ).length?(100) => true
|
87
|
+
# (1..100).map( &:itself ).as_long_as?(100) => true
|
88
|
+
# (1..100).map( &:itself ).length?(10) => false
|
89
|
+
# (1..100).map( &:itself ).length? => true
|
90
|
+
# (1..100).map( &:itself ).length?( nil ) => true
|
91
|
+
#
|
92
|
+
# [1, 1, 2, 3, 5, 8, 13].length?(7) => true
|
93
|
+
# [1, 1, 2, 3, 5, 8, 13].as_long_as?(7) => true
|
94
|
+
# [1, 1, 2, 3, 5, 8, 13].length?(13) => false
|
95
|
+
# [1, 1, 2, 3, 5, 8, 13].length? => true
|
96
|
+
# [1, 1, 2, 3, 5, 8, 13].length?( nil ) => true
|
97
|
+
def length?(n=nil)
|
98
|
+
if n.nil?
|
99
|
+
true
|
100
|
+
elsif n.natural_number?
|
101
|
+
length == n
|
102
|
+
else
|
103
|
+
raise "Error: The variable should be a natural number or \"nil\"."
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
alias :as_long_as? :length?
|
108
|
+
|
109
|
+
# self の各要素を + で結合して演算を行なった結果を返す.
|
110
|
+
# @return [String or Numeric]
|
111
|
+
# @note 文字列の配列などにも適用できるという点で {#sum} とは異なる.
|
112
|
+
# @example
|
113
|
+
# [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].sum_improper => 55
|
114
|
+
# ( 1..100 ).map( &:itself ).sum_improper => 5050
|
115
|
+
# ["a", "b", "c", "d", "e", "f", "g"].sum_improper => "abcdefg"
|
116
|
+
def sum_improper
|
117
|
+
self.inject(:+)
|
118
|
+
end
|
119
|
+
|
120
|
+
# 要素を重複ありで n 要素ずつに区切りまとめるメソッド
|
121
|
+
# @todo 説明がしにくい.ドキュメントの重要性を示す例として採用する.
|
122
|
+
# @return [Array]
|
123
|
+
# @example
|
124
|
+
# a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
125
|
+
#
|
126
|
+
# a.cons(2)
|
127
|
+
# => [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]]
|
128
|
+
#
|
129
|
+
# a.cons(3)
|
130
|
+
# => [[1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 6, 7], [6, 7, 8], [7, 8, 9], [8, 9, 10]]
|
131
|
+
#
|
132
|
+
# fukutoshin_line_weekday_express = [ "Wakoshi" , "Kotake-mukaihara" , "Ikebukuro" , "Shinjuku-sanchome" , "Shibuya" ]
|
133
|
+
# fukutoshin_line_weekday_express.cons(2)
|
134
|
+
# => [["Wakoshi","Kotake-mukaihara"], ["Kotake-mukaihara", "Ikebukuro"], ["Ikebukuro", "Shinjuku-sanchome"], ["Shinjuku-sanchome", "Shibuya"]]
|
135
|
+
def cons(n)
|
136
|
+
each_cons(n).map( &:itself )
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "positive_group_support/version"
|
2
|
+
|
3
|
+
require "active_support"
|
4
|
+
require "active_support/core_ext"
|
5
|
+
|
6
|
+
require "positive_basic_support"
|
7
|
+
require "positive_number_support"
|
8
|
+
|
9
|
+
if RUBY_VERSION < "2.2"
|
10
|
+
require "itself"
|
11
|
+
end
|
12
|
+
|
13
|
+
[ :array , :hash ].each do | filename |
|
14
|
+
require_relative "positive_group_support/#{ filename }_ext"
|
15
|
+
end
|
16
|
+
|
17
|
+
module PositiveGroupSupport
|
18
|
+
|
19
|
+
extend ::ActiveSupport::Concern
|
20
|
+
|
21
|
+
included do
|
22
|
+
|
23
|
+
[ :Array , :Hash ].each do | class_name |
|
24
|
+
eval <<-INCLUDE
|
25
|
+
::#{ class_name }.class_eval do
|
26
|
+
include ::PositiveGroupSupport::#{ class_name }Ext
|
27
|
+
end
|
28
|
+
INCLUDE
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
include PositiveGroupSupport
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'positive_group_support/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "positive_group_support"
|
8
|
+
spec.version = PositiveGroupSupport::VERSION
|
9
|
+
spec.authors = ["Shu Fujita"]
|
10
|
+
spec.email = ["osorubeki.fujita@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "This gem provides useful extensions to Ruby built-in classes \'Array\' and \'Hash\'."
|
13
|
+
# spec.description = %q{TODO: Write a longer description or delete this line.}
|
14
|
+
spec.homepage = "https://github.com/osorubeki-fujita/positive_group_support"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
# if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
# else
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
# end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.required_ruby_version = ">= 2.1.6"
|
31
|
+
|
32
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
33
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
34
|
+
spec.add_development_dependency "rspec"
|
35
|
+
|
36
|
+
spec.add_development_dependency "capistrano"
|
37
|
+
spec.add_development_dependency "deplo", ">= 0.1.4"
|
38
|
+
|
39
|
+
spec.add_runtime_dependency "activesupport" , ">= 4.2.1"
|
40
|
+
|
41
|
+
spec.add_runtime_dependency "positive_basic_support", ">= 0.1.2"
|
42
|
+
spec.add_runtime_dependency "positive_number_support", ">= 0.1.2"
|
43
|
+
spec.add_runtime_dependency "itself", ">= 0.0.1"
|
44
|
+
end
|
metadata
ADDED
@@ -0,0 +1,192 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: positive_group_support
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shu Fujita
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: capistrano
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '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'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: deplo
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.1.4
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.1.4
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: activesupport
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 4.2.1
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 4.2.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: positive_basic_support
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.1.2
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.1.2
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: positive_number_support
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.1.2
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.1.2
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: itself
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.0.1
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.0.1
|
139
|
+
description:
|
140
|
+
email:
|
141
|
+
- osorubeki.fujita@gmail.com
|
142
|
+
executables:
|
143
|
+
- positive_group_support
|
144
|
+
extensions: []
|
145
|
+
extra_rdoc_files: []
|
146
|
+
files:
|
147
|
+
- ".gitignore"
|
148
|
+
- ".rspec"
|
149
|
+
- ".travis.yml"
|
150
|
+
- Capfile
|
151
|
+
- Gemfile
|
152
|
+
- LICENSE
|
153
|
+
- README.md
|
154
|
+
- Rakefile
|
155
|
+
- bin/console
|
156
|
+
- bin/setup
|
157
|
+
- config/deploy.rb
|
158
|
+
- config/deploy/production.rb
|
159
|
+
- config/deploy/staging.rb
|
160
|
+
- exe/positive_group_support
|
161
|
+
- lib/positive_group_support.rb
|
162
|
+
- lib/positive_group_support/array_ext.rb
|
163
|
+
- lib/positive_group_support/hash_ext.rb
|
164
|
+
- lib/positive_group_support/version.rb
|
165
|
+
- positive_group_support.gemspec
|
166
|
+
homepage: https://github.com/osorubeki-fujita/positive_group_support
|
167
|
+
licenses:
|
168
|
+
- MIT
|
169
|
+
metadata: {}
|
170
|
+
post_install_message:
|
171
|
+
rdoc_options: []
|
172
|
+
require_paths:
|
173
|
+
- lib
|
174
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - ">="
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: 2.1.6
|
179
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - ">="
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '0'
|
184
|
+
requirements: []
|
185
|
+
rubyforge_project:
|
186
|
+
rubygems_version: 2.4.6
|
187
|
+
signing_key:
|
188
|
+
specification_version: 4
|
189
|
+
summary: This gem provides useful extensions to Ruby built-in classes 'Array' and
|
190
|
+
'Hash'.
|
191
|
+
test_files: []
|
192
|
+
has_rdoc:
|