martinet 0.0.4 → 0.1.0

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: 1de4f471176c1c86eece0c53584cd75b1ba56da9
4
- data.tar.gz: 80bd2e824db0fb16eb38756e1ab7d4a861004a21
3
+ metadata.gz: 117c44e299449f6464a1ebceb6aeb081fb6565d6
4
+ data.tar.gz: 550da0e0724e738801bccbc3e97a72bdf4dac8c2
5
5
  SHA512:
6
- metadata.gz: 63ad172d0fbfbc13c83dc1c9793fcb56f301787d30089971f7f7198cf5af35bb5a1dcf9ca597e50d2e4502dca51bb41f01cec69b8ac2d316bb50a7f78d7af14e
7
- data.tar.gz: fc8a7dce2c1298b2999dbead463fc25138bd7641e311e5b6ba11c7868f2fe87bc53f38b733d779df02d785dbfb09c7647b21bc63638e68f6db27909b302846de
6
+ metadata.gz: 6d57017541c8ac0415ce874e2a5c3d73e06b8aa20b68efb69a0b99fad0e074158a52c10987c33253fa74dffb72641fa7a0bdf120bece38d42f407ab7a0051610
7
+ data.tar.gz: f4eae9e19800dec40300e141a86dfe1d4e6630fc6b959d71982e2e5e27f1fc3d6e53afdcd075670097453ecf906807942e5e04e95dfc2eb364e20c2988871f03
data/.milestonerrc ADDED
@@ -0,0 +1,12 @@
1
+ :git_commit_prefixes:
2
+ - Add
3
+ - Added
4
+ - Update
5
+ - Updated
6
+ - Fix
7
+ - Fixed
8
+ - Remove
9
+ - Removed
10
+ - Refactor
11
+ - Refactored
12
+ :git_tag_sign: true
data/.travis.yml CHANGED
@@ -11,6 +11,8 @@ before_install:
11
11
  - gem update bundler
12
12
  - gem cleanup bundler
13
13
 
14
+ bundler_args: --without tools --jobs=3 --retry=3
15
+
14
16
  branches:
15
17
  only:
16
18
  - master
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # v0.1.0 (2016-04-26)
2
+
3
+ - Initial version.
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,49 +1,61 @@
1
- # Contributor Code of Conduct
1
+ # Contributor Covenant Code of Conduct
2
2
 
3
- As contributors and maintainers of this project, and in the interest of
4
- fostering an open and welcoming community, we pledge to respect all people who
5
- contribute through reporting issues, posting feature requests, updating
6
- documentation, submitting pull requests or patches, and other activities.
3
+ ## Our Pledge
7
4
 
8
- We are committed to making participation in this project a harassment-free
9
- experience for everyone, regardless of level of experience, gender, gender
10
- identity and expression, sexual orientation, disability, personal appearance,
11
- body size, race, ethnicity, age, religion, or nationality.
5
+ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making
6
+ participation in our project and our community a harassment-free experience for everyone, regardless of age, body size,
7
+ disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race,
8
+ religion, or sexual identity and orientation.
9
+
10
+ ## Our Standards
11
+
12
+ Examples of behavior that contributes to creating a positive environment include:
13
+
14
+ * Using welcoming and inclusive language
15
+ * Being respectful of differing viewpoints and experiences
16
+ * Gracefully accepting constructive criticism
17
+ * Focusing on what is best for the community
18
+ * Showing empathy towards other community members
12
19
 
13
20
  Examples of unacceptable behavior by participants include:
14
21
 
15
- * The use of sexualized language or imagery
16
- * Personal attacks
17
- * Trolling or insulting/derogatory comments
22
+ * The use of sexualized language or imagery and unwelcome sexual attention or advances
23
+ * Trolling, insulting/derogatory comments, and personal or political attacks
18
24
  * Public or private harassment
19
- * Publishing other's private information, such as physical or electronic
20
- addresses, without explicit permission
21
- * Other unethical or unprofessional conduct
22
-
23
- Project maintainers have the right and responsibility to remove, edit, or
24
- reject comments, commits, code, wiki edits, issues, and other contributions
25
- that are not aligned to this Code of Conduct, or to ban temporarily or
26
- permanently any contributor for other behaviors that they deem inappropriate,
27
- threatening, offensive, or harmful.
28
-
29
- By adopting this Code of Conduct, project maintainers commit themselves to
30
- fairly and consistently applying these principles to every aspect of managing
31
- this project. Project maintainers who do not follow or enforce the Code of
32
- Conduct may be permanently removed from the project team.
33
-
34
- This code of conduct applies both within project spaces and in public spaces
35
- when an individual is representing the project or its community.
36
-
37
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
- reported by contacting a project maintainer at tangrufus@gmail.com. All
39
- complaints will be reviewed and investigated and will result in a response that
40
- is deemed necessary and appropriate to the circumstances. Maintainers are
41
- obligated to maintain confidentiality with regard to the reporter of an
42
- incident.
43
-
44
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
- version 1.3.0, available at
46
- [http://contributor-covenant.org/version/1/3/0/][version]
25
+ * Publishing others' private information, such as a physical or electronic address, without explicit permission
26
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
27
+
28
+ ## Our Responsibilities
29
+
30
+ Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take
31
+ appropriate and fair corrective action in response to any instances of unacceptable behavior.
32
+
33
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits,
34
+ issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any
35
+ contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
36
+
37
+ ## Scope
38
+
39
+ This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the
40
+ project or its community. Examples of representing a project or community include using an official project e-mail
41
+ address, posting via an official social media account, or acting as an appointed representative at an online or offline
42
+ event. Representation of a project may be further defined and clarified by project maintainers.
43
+
44
+ ## Enforcement
45
+
46
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at
47
+ [tangrufus@gmail.com](mailto:tangrufus@gmail.com). All complaints will be reviewed and
48
+ investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project
49
+ team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific
50
+ enforcement policies may be posted separately.
51
+
52
+ Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent
53
+ repercussions as determined by other members of the project's leadership.
54
+
55
+ ## Attribution
56
+
57
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
58
+ available at [http://contributor-covenant.org/version/1/4][version]
47
59
 
48
60
  [homepage]: http://contributor-covenant.org
49
- [version]: http://contributor-covenant.org/version/1/3/0/
61
+ [version]: http://contributor-covenant.org/version/1/4/
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,35 @@
1
+ # Overview
2
+
3
+ Thanks for taking an interest in this open source project. Your support and involvement is greatly appreciated. The
4
+ following details what you need to know in order to contribute.
5
+
6
+ # Requirements
7
+
8
+ - Follow these [Basic Programming Styles](https://github.com/bkuhlmann/style_guides/blob/master/programming/basic.md).
9
+ - Follow these [Code Review Styles](https://github.com/bkuhlmann/style_guides/blob/master/programming/code_reviews.md).
10
+ - Follow these [Git Styles](https://github.com/bkuhlmann/style_guides/blob/master/programming/git.md).
11
+ - Follow these [Bash Styles](https://github.com/bkuhlmann/style_guides/blob/master/programming/languages/bash.md).
12
+ - Follow these [CSS Styles](https://github.com/bkuhlmann/style_guides/blob/master/programming/languages/css.md).
13
+ - Follow these [Ruby Styles](https://github.com/bkuhlmann/style_guides/blob/master/programming/languages/ruby/ruby.md).
14
+
15
+ # Contributing Code
16
+
17
+ 0. Read the project README thoroughly before starting.
18
+ 0. Fork the master branch of the repository.
19
+ 0. Ensure there are no setup, usage, and/or test issues (again, follow the README).
20
+ 0. Add tests for new functionality (refactoring and documentation changes can be excluded).
21
+ 0. Ensure all tests pass.
22
+ 0. Push your feature branch and submit a pull request.
23
+
24
+ # Submitting Issues
25
+
26
+ 0. Submit an issue via the GitHub Issues tab (assuming one does not already exist).
27
+ 0. Clearly describe the issue (including steps to reproduce).
28
+ 0. Specify your enviroment setup (OS, browser, language, etc. with version info).
29
+ 0. Provide a stack dump (if possible).
30
+ 0. Explain any additional details that might help diagnose the problem quickly.
31
+
32
+ # Feedback
33
+
34
+ Expect a response within one to three business days.
35
+ Changes, alternatives, and/or improvements might be suggested upon review.
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in martinet.gemspec
4
4
  gemspec
5
+
6
+ group :tools do
7
+ gem 'gemsmith', '~> 7.6'
8
+ end
File without changes
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Martinet
1
+ # martinet
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/martinet.svg)](https://badge.fury.io/rb/martinet)
4
4
  [![Gem](https://img.shields.io/gem/dt/martinet.svg?maxAge=2592000)](https://rubygems.org/gems/martinet)
@@ -9,54 +9,80 @@
9
9
  [![GitHub issues](https://img.shields.io/github/issues/TangRufus/martinet.svg)](https://github.com/TangRufus/martinet/issues)
10
10
  [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/TangRufus/martinet/master/LICENSE.txt)
11
11
 
12
+ <!-- Tocer[start]: Auto-generated, don't remove. -->
12
13
 
14
+ # Table of Contents
13
15
 
16
+ - [Features](#features)
17
+ - [Screencasts](#screencasts)
18
+ - [Requirements](#requirements)
19
+ - [Setup](#setup)
20
+ - [Usage](#usage)
21
+ - [Versioning](#versioning)
22
+ - [Code of Conduct](#code-of-conduct)
23
+ - [Contributions](#contributions)
24
+ - [License](#license)
25
+ - [History](#history)
26
+ - [Credits](#credits)
14
27
 
15
- TODO: Add impersonate functions
28
+ <!-- Tocer[finish]: Auto-generated, don't remove. -->
16
29
 
17
- TODO: Add tests
30
+ # Features
18
31
 
19
- TODO: Publish 0.3.0
32
+ # Screencasts
20
33
 
21
- TODO: Write usage instructions
34
+ # Requirements
22
35
 
23
- TODO: Add roadmap
36
+ 0. [MRI 2.3.0](https://www.ruby-lang.org)
24
37
 
25
- TODO: Add testing instructions
38
+ # Setup
26
39
 
27
- TODO: Add Contributing instructions
40
+ For a secure install, type the following (recommended):
28
41
 
29
- TODO: Add sites using martinet section
42
+ gem cert --add <(curl --location --silent /gem-public.pem)
43
+ gem install martinet --trust-policy MediumSecurity
30
44
 
31
- TODO: Add example apps
45
+ NOTE: A HighSecurity trust policy would be best but MediumSecurity enables signed gem verification while
46
+ allowing the installation of unsigned dependencies since they are beyond the scope of this gem.
32
47
 
33
- ## Installation
48
+ For an insecure install, type the following (not recommended):
34
49
 
35
- Add this line to your application's Gemfile:
50
+ gem install martinet
36
51
 
37
- ```ruby
38
- gem 'martinet'
39
- ```
52
+ Add the following to your Gemfile:
40
53
 
41
- And then execute:
54
+ gem "martinet"
42
55
 
43
- $ bundle
56
+ # Usage
44
57
 
45
- Or install it yourself as:
46
58
 
47
- $ gem install martinet
59
+ # Versioning
48
60
 
49
- ## Usage
61
+ Read [Semantic Versioning](http://semver.org) for details. Briefly, it means:
50
62
 
51
- TODO: Write usage instructions here
63
+ - Patch (x.y.Z) - Incremented for small, backwards compatible bug fixes.
64
+ - Minor (x.Y.z) - Incremented for new, backwards compatible public API enhancements and/or bug fixes.
65
+ - Major (X.y.z) - Incremented for any backwards incompatible public API changes.
52
66
 
53
- ## Development
67
+ # Code of Conduct
54
68
 
55
- ## Contributing
69
+ Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By participating in this project
70
+ you agree to abide by its terms.
56
71
 
57
- Bug reports and pull requests are welcome on GitHub at [https://github.com/tangrufus/martinet](https://github.com/tangrufus/martinet). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
72
+ # Contributions
58
73
 
74
+ Read [CONTRIBUTING](CONTRIBUTING.md) for details.
59
75
 
60
- ## License
76
+ # License
61
77
 
62
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
78
+ Copyright (c) 2016 []().
79
+ Read the [LICENSE](LICENSE.md) for details.
80
+
81
+ # History
82
+
83
+ Read the [CHANGELOG](CHANGELOG.md) for details.
84
+ Built with [Gemsmith](https://github.com/bkuhlmann/gemsmith).
85
+
86
+ # Credits
87
+
88
+ Developed by [Tang Rufus](https://www.github.com/tangrufus) at []().
data/Rakefile CHANGED
@@ -1,3 +1,8 @@
1
+ if defined? Gemsmith
2
+ require 'gemsmith/rake/setup'
3
+ Dir.glob('lib/tasks/*.rake').each { |file| load file }
4
+ end
5
+
1
6
  require 'bundler/gem_tasks'
2
7
  require 'rake/testtask'
3
8
 
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #! /bin/bash
2
+
3
+ set -o nounset # Exit, with error message, when attempting to use an undefined variable.
4
+ set -o errexit # Abort script at first error, when a command exits with non-zero status.
5
+ set -o pipefail # Return exit status of the last command in the pipe that returned a non-zero return value.
6
+ IFS=$'\n\t' # Defines newlines and tabs as delimiters for splitting words and iterating arrays.
7
+
8
+ bundle install
@@ -19,7 +19,7 @@ module Martinet
19
19
  attr_accessor :enable_impersonation
20
20
 
21
21
  def initialize
22
- @enable_impersonation = false
22
+ @enable_impersonation = true
23
23
  end
24
24
  end
25
25
  end
@@ -17,3 +17,9 @@ module Martinet
17
17
  end
18
18
  end
19
19
  end
20
+
21
+ if Martinet.configuration.enable_impersonation
22
+ Martinet::Session.class_eval do
23
+ include Martinet::Impersonation
24
+ end
25
+ end
@@ -2,11 +2,6 @@ module Martinet
2
2
  # HTTP/Warden session-specific behavior.
3
3
  class Session
4
4
  def initialize(warden)
5
- # TODO: Move this to Martinet::Impersonation class
6
- if Martinet.configuration.enable_impersonation
7
- class << self; include Impersonation; end
8
- end
9
-
10
5
  @warden = warden
11
6
  end
12
7
 
@@ -1,3 +1,3 @@
1
1
  module Martinet
2
- VERSION = '0.0.4'.freeze
2
+ VERSION = '0.1.0'.freeze
3
3
  end
data/lib/martinet.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  require 'martinet/version'
2
2
  require 'martinet/configuration'
3
3
  require 'martinet/session'
4
- require 'martinet/impersonation'
4
+
5
+ require 'martinet/impersonation' if Martinet.configuration.enable_impersonation
5
6
 
6
7
  module Martinet
7
8
  end
data/martinet.gemspec CHANGED
@@ -4,15 +4,15 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'martinet/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = 'martinet'
8
- spec.version = Martinet::VERSION
9
- spec.authors = ['Tang Rufus']
10
- spec.email = ['tangrufus@gmail.com']
11
-
12
- spec.summary = 'Authorization component for warden'
13
- spec.description = 'Authorization component for warden'
14
- spec.homepage = 'https://github.com/TangRufus/martinet'
15
- spec.license = 'MIT'
7
+ spec.name = 'martinet'
8
+ spec.version = Martinet::VERSION
9
+ spec.platform = Gem::Platform::RUBY
10
+ spec.authors = ['Tang Rufus']
11
+ spec.email = ['tangrufus@gmail.com']
12
+ spec.homepage = 'https://github.com/TangRufus/martinet'
13
+ spec.summary = 'Authorization component for warden'
14
+ spec.description = 'Authorization component for warden'
15
+ spec.license = 'MIT'
16
16
 
17
17
  spec.metadata['allowed_push_host'] = 'https://rubygems.org'
18
18
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: martinet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tang Rufus
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-23 00:00:00.000000000 Z
11
+ date: 2016-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: warden
@@ -114,13 +114,17 @@ files:
114
114
  - ".codeclimate.yml"
115
115
  - ".gitignore"
116
116
  - ".hound.yml"
117
+ - ".milestonerrc"
117
118
  - ".rubocop.yml"
118
119
  - ".travis.yml"
120
+ - CHANGELOG.md
119
121
  - CODE_OF_CONDUCT.md
122
+ - CONTRIBUTING.md
120
123
  - Gemfile
121
- - LICENSE.txt
124
+ - LICENSE.md
122
125
  - README.md
123
126
  - Rakefile
127
+ - bin/setup
124
128
  - lib/martinet.rb
125
129
  - lib/martinet/configuration.rb
126
130
  - lib/martinet/impersonation.rb