cocov_plugin_kit 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: 40112f205669ad015d2fd5a49b1391820633eff66544fdd927d6e1cca210def1
4
- data.tar.gz: 3a0a3faa3e564fe377d6595522aa7ae68e28bd312f54b7caa85c9d32cbb5fde1
3
+ metadata.gz: 1a8273e71e6a782ac8eb359fe94f8a4f36214122d738f462427dc0db7ac30d99
4
+ data.tar.gz: 4cb89031486138bd9893297792db58e92fe6099a4ffa43f067635683cf0c8f78
5
5
  SHA512:
6
- metadata.gz: 034064d2eeb761d390912e9beb0f0f8acd09305663480e924e0a949f2bdf2aa9b437cc5a2c77323226fd15abd19f9753adc6301fc97f692718831bbff146c1ab
7
- data.tar.gz: 328f90eaa0a1bc264d7270aaaf920c87c4b7b8cdc526694a1eb4bb5904aa5c47ed45d7f46d993cca82fa10daa0e4f12f9d2076dbebed6318354281431793f33d
6
+ metadata.gz: 3b59f4546faf3f18b6c45805352f6050f70b3c1cf0b8b436ce4bcbcef6e7fe2ec7a64c3f8c0faf8c0806d244d754ac286c835dac9938a4552153025835d688f9
7
+ data.tar.gz: 751d2360770a35d2e565142d12e502dd1932cc14c26357a305760e7ef95c6a4aae9c63d005f7657630225661014238c015907ae398ac760e0c2ff6ed7dd9440a
data/.rubocop.yml CHANGED
@@ -31,3 +31,6 @@ Metrics/BlockLength:
31
31
  Lint/RescueException:
32
32
  Exclude:
33
33
  - lib/cocov/plugin_kit.rb
34
+
35
+ Layout/FirstHashElementIndentation:
36
+ EnforcedStyle: consistent
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocov_plugin_kit (0.1.2)
4
+ cocov_plugin_kit (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,33 +1,69 @@
1
1
  # PluginKit
2
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/plugin_kit`. 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
3
+ PluginKit implements a utility library to help the development of Cocov Plugins using the Ruby programming language.
6
4
 
7
5
  ## Installation
8
6
 
9
- Install the gem and add to the application's Gemfile by executing:
7
+ Cocov plugins should not contain Gemfiles. Instead, install the library directly
8
+ using the `gem install` command, providing a specific version. For instance,
9
+
10
+ ```
11
+ gem install cocov_plugin_kit -v 0.1.2
12
+ ```
10
13
 
11
- $ bundle add plugin_kit
14
+ ## Usage
12
15
 
13
- If bundler is not being used to manage dependencies, install the gem by executing:
16
+ ### For simple plugins
14
17
 
15
- $ gem install plugin_kit
18
+ When implementing simple plugins, like for example, [brakeman](https://github.com/cocov-ci/brakeman/blob/master/plugin.rb),
19
+ the block-based usage of PluginKit can be used:
16
20
 
17
- ## Usage
21
+ ```ruby
22
+ Cocov::PluginKit.run do
23
+ output = JSON.parse(exec(["my", "plugin", "--format", "json"], env: ENV))
24
+ # Process output...
25
+ emit_issue kind: # ...
26
+ end
27
+ ```
28
+
29
+ ### For elaborate plugins
30
+
31
+ For plugins requiring more organization or several internal methods, like [rubocop](https://github.com/cocov-ci/rubocop/blob/master/plugin.rb),
32
+ `Cocov::PluginKit::Run` can be inherited into a new class, and `#run` can be
33
+ overridden to be used as the plugin entrypoint, followed by a call to
34
+ `Cocov::PluginKit.run`:
35
+
36
+ ```ruby
37
+ class ElaboratePlugin < Cocov::PluginKit::Run
38
+ def run
39
+ output = JSON.parse(exec(["my", "plugin", "--format", "json"], env: ENV))
40
+ # Process output...
41
+ emit_issue kind: # ...
42
+ end
43
+ end
18
44
 
19
- TODO: Write usage instructions here
45
+ Cocov::PluginKit.run(ElaboratePlugin)
46
+ ```
20
47
 
21
48
  ## Development
22
49
 
23
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
50
+ A `docker-compose.yaml` is provided for allowing Ruby 2.6 to be used without
51
+ requiring developers to install that version on their machines. When writing
52
+ Dockerfiles, developers are advised to use the latest version available when
53
+ building plugins.
24
54
 
25
- 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
55
+ Use `docker compose run --rm -it ruby bash` to get a shell on the container;
56
+ `bin/setup` can be used to install dependencies, `rspec` to run tests,
57
+ `rubocop` to lint the codebase, and `bin/console` to get an interactive console
58
+ that allows you to experiment.
26
59
 
27
60
  ## Contributing
28
61
 
29
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/plugin_kit. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/plugin_kit/blob/master/CODE_OF_CONDUCT.md).
62
+ Bug reports and pull requests are welcome on GitHub at https://github.com/cocov-ci/plugin_kit.
63
+ This project is intended to be a safe, welcoming space for collaboration, and
64
+ contributors are expected to adhere to the [Cocov's code of conduct](https://github.com/cocov-ci/.github/blob/main/CODE_OF_CONDUCT.md).
30
65
 
31
66
  ## Code of Conduct
32
67
 
33
- Everyone interacting in the PluginKit project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/plugin_kit/blob/master/CODE_OF_CONDUCT.md).
68
+ Everyone interacting in the Cocov project's codebases, issue trackers, chat rooms
69
+ and mailing lists is expected to follow the [Cocov's code of conduct](https://github.com/cocov-ci/.github/blob/main/CODE_OF_CONDUCT.md).
data/cocov.output.bin ADDED
File without changes
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cocov
4
+ module PluginKit
5
+ # :nodoc:
6
+ class Realloc
7
+ def self.bindings
8
+ secrets_path = Pathname.new("/secrets")
9
+ bindings_path = secrets_path.join("bindings")
10
+ return {} if !bindings_path.exist? || bindings_path.directory?
11
+
12
+ bindings_path.read.split("\0").to_h do |entry|
13
+ from, to = entry.split("=", 2)
14
+ from_path = secrets_path.join(from)
15
+ to_path = Pathname.new(File.expand_path(to))
16
+ [from_path, to_path]
17
+ end
18
+ end
19
+
20
+ def self.mounts!
21
+ bindings.each do |from_path, to_path|
22
+ unless from_path.exist?
23
+ puts "Expected binding of #{from_path} to exist, but could not locate it"
24
+ exit 1
25
+ end
26
+
27
+ to_path.dirname.mkpath
28
+
29
+ FileUtils.cp from_path, to_path
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Cocov
4
4
  module PluginKit
5
- VERSION = "0.1.2"
5
+ VERSION = "0.1.3"
6
6
  end
7
7
  end
@@ -8,8 +8,9 @@ require "tempfile"
8
8
  require "tmpdir"
9
9
 
10
10
  require_relative "plugin_kit/version"
11
- require_relative "plugin_kit/run"
12
11
  require_relative "plugin_kit/exec"
12
+ require_relative "plugin_kit/realloc"
13
+ require_relative "plugin_kit/run"
13
14
 
14
15
  module Cocov
15
16
  # PluginKit implements helpers for implementing Cocov Plugins in Ruby. The
@@ -29,6 +30,7 @@ module Cocov
29
30
  klass ||= Run
30
31
  instance = klass.new(output_file)
31
32
  Dir.chdir(instance.workdir) do
33
+ Realloc.mounts!
32
34
  if block_given?
33
35
  instance.instance_exec(&block)
34
36
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocov_plugin_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Gama
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-04 00:00:00.000000000 Z
11
+ date: 2023-01-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: PluginKit implements helpers for running Cocov plugins
14
14
  email:
@@ -21,15 +21,16 @@ files:
21
21
  - ".editorconfig"
22
22
  - ".rspec"
23
23
  - ".rubocop.yml"
24
- - CODE_OF_CONDUCT.md
25
24
  - Gemfile
26
25
  - Gemfile.lock
27
26
  - LICENSE
28
27
  - README.md
29
28
  - Rakefile
29
+ - cocov.output.bin
30
30
  - exe/cocov
31
31
  - lib/cocov/plugin_kit.rb
32
32
  - lib/cocov/plugin_kit/exec.rb
33
+ - lib/cocov/plugin_kit/realloc.rb
33
34
  - lib/cocov/plugin_kit/run.rb
34
35
  - lib/cocov/plugin_kit/version.rb
35
36
  homepage: https://github.com/cocov-ci/plugin_kit
data/CODE_OF_CONDUCT.md DELETED
@@ -1,84 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
-
7
- We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
-
9
- ## Our Standards
10
-
11
- Examples of behavior that contributes to a positive environment for our community include:
12
-
13
- * Demonstrating empathy and kindness toward other people
14
- * Being respectful of differing opinions, viewpoints, and experiences
15
- * Giving and gracefully accepting constructive feedback
16
- * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
- * Focusing on what is best not just for us as individuals, but for the overall community
18
-
19
- Examples of unacceptable behavior include:
20
-
21
- * The use of sexualized language or imagery, and sexual attention or
22
- advances of any kind
23
- * Trolling, insulting or derogatory comments, and personal or political attacks
24
- * Public or private harassment
25
- * Publishing others' private information, such as a physical or email
26
- address, without their explicit permission
27
- * Other conduct which could reasonably be considered inappropriate in a
28
- professional setting
29
-
30
- ## Enforcement Responsibilities
31
-
32
- Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
-
34
- Community leaders 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, and will communicate reasons for moderation decisions when appropriate.
35
-
36
- ## Scope
37
-
38
- This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
-
40
- ## Enforcement
41
-
42
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at hey@vito.io. All complaints will be reviewed and investigated promptly and fairly.
43
-
44
- All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
-
46
- ## Enforcement Guidelines
47
-
48
- Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
-
50
- ### 1. Correction
51
-
52
- **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
-
54
- **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
-
56
- ### 2. Warning
57
-
58
- **Community Impact**: A violation through a single incident or series of actions.
59
-
60
- **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
-
62
- ### 3. Temporary Ban
63
-
64
- **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
-
66
- **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
-
68
- ### 4. Permanent Ban
69
-
70
- **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
-
72
- **Consequence**: A permanent ban from any sort of public interaction within the community.
73
-
74
- ## Attribution
75
-
76
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
- available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
-
79
- Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
-
81
- [homepage]: https://www.contributor-covenant.org
82
-
83
- For answers to common questions about this code of conduct, see the FAQ at
84
- https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.