as_namespace 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1a0c59658c3a32816c974ef178cc2d94e4989db9
4
+ data.tar.gz: cd5d954f655df17b00675ed6a984cc7dee6c51ca
5
+ SHA512:
6
+ metadata.gz: 6a0f0876728d84ea1a0c8c6e62f066b743123ce66ac7a8525bbe30d2c45c29774bcf63372200039b89285465eb022f12d79703f3002807992df8e25cb3f3b46d
7
+ data.tar.gz: 545e28cc952f2e556a9e6dd43197c5989e19df93972604a9d3ff8271d2bcf879967bc3da46da3178683320e085c7ad2b762d9e2a6248d73324150929b22ff60b
@@ -0,0 +1 @@
1
+ service_name: travis-ci
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /log/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+ .rbenv-gemsets
12
+ .ruby-version
13
+ *.swp
14
+ *.swo
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,22 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.3
3
+ Lint/AssignmentInCondition:
4
+ Enabled: false
5
+
6
+ Metrics/AbcSize:
7
+ Max: 20
8
+
9
+ Metrics/LineLength:
10
+ Max: 80
11
+
12
+ Metrics/MethodLength:
13
+ Max: 20
14
+
15
+ Metrics/ParameterLists:
16
+ Enabled: false
17
+
18
+ Metrics/PerceivedComplexity:
19
+ Max: 7
20
+
21
+ Style:
22
+ Enabled: false
@@ -0,0 +1,16 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.10
6
+ - 2.2.5
7
+ - 2.3.1
8
+ before_install: gem install bundler -v 1.10.4
9
+ bundler_args: "--jobs=2"
10
+ script: bundle exec rspec
11
+ branches:
12
+ only:
13
+ - master
14
+ notifications:
15
+ slack:
16
+ secure: rjIhEet4tcCF4K5b8Vs4ptvLUopmasznM9/polGcrV6RhTihRHCnGWXgfVNNhEuYrOZLDBV7R/EKoqiZ4MQywVkRBCos7X+goN+srJyVVwEEwZr9IoMFhQ/G7WpM52u94FDVwxxSzGf8RdMJXC/BZAX25bYL8KW5fSfLaupwRCkZx+ClqvDrO4/HujN8pyrVUIqG472W+8RMjuush696was8b2dPRWpqHCbYEyx5j4PmD2Tu7FvZJYvopumU1bwct5Mj53JN/mZ67n3l6OhyxC9jqh0JOs0gBv5p3h9Pnl0ByNEA9kave4EICk9CQyfwnJLc1W/U27yX4vBvPeoWJYBV/I5vJ44TCptfRzgdTHKnTKHucgQaSAyOjbfUJXFvmSEM9OzQEY72Fqhh7M3I+V6ZLNLvWFZswZBxfFM83sWD8Ory+HSG2Rr2rbh+Fo/ojVpdnNlVpUWIFjDH+D28Uz28XIaxPDtoTOSd+LO0ckZKp9ZwYEp9yozRib7vu5y57pvzrXu+L9ZQrgKtGZ1taspIB5j8RJLrgG8BPtn6eb/oZD+4WRouzSG4zWJruNJzi3f+y1PN09S7Rjnolu4GTcfyfG2MDpC4jlFTA0WU7QmZe3n6Pnq4Qdgn26AFepBc+sfSxEGz+McbNgnHTvbEbFgriFf6qCxqZRX8x688444=
@@ -0,0 +1,2 @@
1
+ --markup markdown
2
+ --private
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in as_namespace.gemspec
4
+ gemspec
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ # -*- mode: ruby -*-
3
+ # vi: set ft=ruby :
4
+
5
+ group :red_green_refactor, halt_on_fail: true do
6
+
7
+ guard :rspec, cmd: "bundle exec rspec" do
8
+ watch(%r{lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
9
+ watch(%r{spec/.+_spec\.rb$})
10
+ end
11
+
12
+ guard :yard, server: false, stdout: '/dev/null' do
13
+ watch("README.md")
14
+ watch(%r{lib/(.+)\.rb$})
15
+ watch(%r{lib/(.+)\.rake$})
16
+ end
17
+
18
+ guard :rubocop, all_on_start: false, keep_failed: false, cli: ["--format", "clang", "-l"] do
19
+ watch(%r{lib/(.+)\.rb$})
20
+ watch(%r{spec/.+_spec\.rb$})
21
+ watch(%r{lib/(.+)\.rake$})
22
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
23
+ end
24
+
25
+ end
26
+
27
+ guard :bundler, cmd: "bundle" do
28
+ watch("as_namespace.gemspec")
29
+ end
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 kitaro-tn
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
13
+ all 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
21
+ THE SOFTWARE.
@@ -0,0 +1,55 @@
1
+ # AsNamespace
2
+
3
+ [![Build Status](https://travis-ci.org/kitaro-tn/as_namespace.svg?branch=master)](https://travis-ci.org/kitaro-tn/as_namespace)
4
+ [![Coverage Status](https://coveralls.io/repos/github/kitaro-tn/as_namespace/badge.svg?branch=master)](https://coveralls.io/github/kitaro-tn/as_namespace?branch=master)
5
+ [![Code Climate](https://codeclimate.com/github/kitaro-tn/as_namespace/badges/gpa.svg)](https://codeclimate.com/github/kitaro-tn/as_namespace)
6
+
7
+ 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/as_namespace`. To experiment with that code, run `bin/console` for an interactive prompt.
8
+
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'as_namespace'
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ $ bundle
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install as_namespace
25
+
26
+ ## Usage
27
+
28
+ ```ruby
29
+ require 'as_namespace'
30
+
31
+ class TestClass
32
+
33
+ include AsNamespace
34
+
35
+ as_namespace module_obj: Parent::Child::Grandson, alias_val: :grand
36
+ as_namespace module_obj: Parent::Child, alias_val: :CHILD
37
+
38
+ end
39
+ ```
40
+
41
+ ## Development
42
+
43
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
44
+
45
+ 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`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
46
+
47
+ ## Contributing
48
+
49
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/as_namespace. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
50
+
51
+
52
+ ## License
53
+
54
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
55
+
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'as_namespace/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "as_namespace"
8
+ spec.version = AsNamespace::VERSION
9
+ spec.authors = ["tatsunori nishikori"]
10
+ spec.email = ["tora.1986.tatsu@gmail.com"]
11
+
12
+ spec.summary = %q{Omit the ruby namespace}
13
+ spec.description = %q{Omit the ruby name space by defining in the class}
14
+ spec.homepage = "https://github.com/kitaro-tn/as_namespace"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.10"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "pry"
25
+ spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "yard"
27
+ spec.add_development_dependency "rubocop"
28
+ spec.add_development_dependency "guard"
29
+ spec.add_development_dependency "guard-rspec"
30
+ spec.add_development_dependency "guard-rubocop"
31
+ spec.add_development_dependency "guard-yard"
32
+ spec.add_development_dependency "guard-bundler"
33
+ spec.add_development_dependency "coveralls"
34
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "as_namespace"
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
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,30 @@
1
+ require "as_namespace/version"
2
+
3
+ module AsNamespace
4
+
5
+ def self.included(base)
6
+ base.extend(ClassMethod)
7
+ end
8
+
9
+ module ClassMethod
10
+
11
+ ##
12
+ # @param [Module] module_obj
13
+ # @param [Object] alias_val
14
+ def as_namespace(module_obj:, alias_val:)
15
+ @module_obj = module_obj
16
+ @alias_val = alias_val
17
+ if (alias_val =~ /^[[:upper:]]/).nil?
18
+ self.class_eval <<-EOS, __FILE__, __LINE__ + 1
19
+ def #{alias_val}
20
+ #{module_obj}
21
+ end
22
+ EOS
23
+ else
24
+ self.const_set(alias_val, module_obj)
25
+ end
26
+ end
27
+
28
+ end
29
+
30
+ end
@@ -0,0 +1,3 @@
1
+ module AsNamespace
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,230 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: as_namespace
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - tatsunori nishikori
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-07-17 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.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
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: pry
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: rspec
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: yard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: guard-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard-rubocop
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: guard-yard
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: guard-bundler
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: coveralls
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ description: Omit the ruby name space by defining in the class
182
+ email:
183
+ - tora.1986.tatsu@gmail.com
184
+ executables: []
185
+ extensions: []
186
+ extra_rdoc_files: []
187
+ files:
188
+ - ".coveralls.yml"
189
+ - ".gitignore"
190
+ - ".rspec"
191
+ - ".rubocop.yml"
192
+ - ".travis.yml"
193
+ - ".yardopts"
194
+ - CODE_OF_CONDUCT.md
195
+ - Gemfile
196
+ - Guardfile
197
+ - LICENSE.txt
198
+ - README.md
199
+ - Rakefile
200
+ - as_namespace.gemspec
201
+ - bin/console
202
+ - bin/setup
203
+ - lib/as_namespace.rb
204
+ - lib/as_namespace/version.rb
205
+ homepage: https://github.com/kitaro-tn/as_namespace
206
+ licenses:
207
+ - MIT
208
+ metadata: {}
209
+ post_install_message:
210
+ rdoc_options: []
211
+ require_paths:
212
+ - lib
213
+ required_ruby_version: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - ">="
216
+ - !ruby/object:Gem::Version
217
+ version: '0'
218
+ required_rubygems_version: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ requirements: []
224
+ rubyforge_project:
225
+ rubygems_version: 2.5.1
226
+ signing_key:
227
+ specification_version: 4
228
+ summary: Omit the ruby namespace
229
+ test_files: []
230
+ has_rdoc: