gem_metadata 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: 814ea53e8508af95ce950b9c33c2a07ff3b1982e
4
+ data.tar.gz: d8837a3c9bbfc40aa516162caaaa5b6702099075
5
+ SHA512:
6
+ metadata.gz: 546b1a9085467507a6ada041968f25f1feb32aab99258ad6975c972a1a97ace3dcb1096dc756394e8e226f15a23e4c7fcc796f34223748239d4389fa53d0e335
7
+ data.tar.gz: 313cc96c897ead14b33437ee95c68b82bb59c8a098c08ddc679f49cca11241f947486b549c1777eb43b4ef4ac1fe3ca32e7292ca5b87a48ae5c2b481a39eba4a
@@ -0,0 +1 @@
1
+ service_name: travis-ci
@@ -0,0 +1,12 @@
1
+ # Project metadata
2
+ /nbproject
3
+ /.idea
4
+
5
+ /Gemfile.lock
6
+
7
+ /doc/api
8
+ /coverage
9
+ /pkg
10
+ /.yardoc
11
+ .rbx
12
+ *.rbc
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --format documentation
2
+ --color
3
+ --order random
4
+ --require spec_helper
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.0
4
+ - rbx-2
5
+ - jruby-19mode
@@ -0,0 +1,9 @@
1
+ --output-dir=doc/api
2
+ --embed-mixins
3
+ --protected
4
+ --no-private
5
+ --markup-provider=kramdown
6
+ --markup=markdown
7
+ -
8
+ HISTORY.md
9
+ LICENSE.md
data/Gemfile ADDED
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+ =begin
3
+ Copyright Alexander E. Fischer <aef@godobject.net>, 2016
4
+
5
+ This file is part of GemMetadata.
6
+
7
+ Permission to use, copy, modify, and/or distribute this software for any
8
+ purpose with or without fee is hereby granted, provided that the above
9
+ copyright notice and this permission notice appear in all copies.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
13
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
+ PERFORMANCE OF THIS SOFTWARE.
18
+ =end
19
+
20
+ source 'https://rubygems.org'
21
+
22
+ # Gem dependencies are specified in the .gemspec file
23
+ gemspec
24
+
25
+ gem 'coveralls', require: false
@@ -0,0 +1,6 @@
1
+ 0.1.0 / 2016-09-06
2
+ ==================
3
+
4
+ * 1 major enhancement
5
+
6
+ * Birthday!
@@ -0,0 +1,15 @@
1
+ Copyright Alexander E. Fischer <aef@godobject.net>, 2016
2
+
3
+ GemMetadata is licensed under the following ISC-style license:
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
11
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,217 @@
1
+ GemMetadata
2
+ ===========
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/gem_metadata.png)](https://badge.fury.io/rb/gem_metadata)
5
+ [![Dependency Status](https://gemnasium.com/godobject/gem_metadata.png)](https://gemnasium.com/godobject/gem_metadata)
6
+ [![Code Climate](https://codeclimate.com/github/godobject/gem_metadata.png)](https://codeclimate.com/github/godobject/gem_metadata)
7
+ [![Build Status](https://secure.travis-ci.org/godobject/gem_metadata.png)](https://secure.travis-ci.org/godobject/gem_metadata)
8
+ [![Coverage Status](https://coveralls.io/repos/github/godobject/gem_metadata/badge.svg?branch=master)](https://coveralls.io/github/godobject/gem_metadata?branch=master)
9
+
10
+ * [Documentation][docs]
11
+ * [Project][project]
12
+
13
+ [docs]: http://rdoc.info/github/godobject/gem_metadata/
14
+ [project]: https://github.com/godobject/gem_metadata/
15
+
16
+ Description
17
+ -----------
18
+
19
+ GemMetadata is a Ruby library that allows to filter and access gems by custom
20
+ metadata keys that their specifications contain.
21
+
22
+ Features / Problems
23
+ -------------------
24
+
25
+ This project tries to conform to:
26
+
27
+ * [Semantic Versioning (2.0.0)][semver]
28
+ * [Ruby Packaging Standard (0.5-draft)][rps]
29
+ * [Ruby Style Guide][style]
30
+ * [Gem Packaging: Best Practices][gem]
31
+
32
+ [semver]: http://semver.org/spec/v2.0.0.html
33
+ [rps]: http://chneukirchen.github.com/rps/
34
+ [style]: https://github.com/bbatsov/ruby-style-guide
35
+ [gem]: http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices
36
+
37
+ Additional facts:
38
+
39
+ * Written purely in Ruby.
40
+ * Documented with Cucumber.
41
+ * Automatically testable through Cucumber and RSpec.
42
+ * Intended to be used with Ruby 2.3.0 or higher.
43
+ * Cryptographically signed git tags.
44
+
45
+ Requirements
46
+ ------------
47
+
48
+ * Ruby 2.3.0 or higher
49
+
50
+ Installation
51
+ ------------
52
+
53
+ On *nix systems you may need to prefix the command with `sudo` to get root
54
+ privileges.
55
+
56
+ ### Gem
57
+
58
+ gem install gem_metadata
59
+
60
+ ### Automated testing
61
+
62
+ Go into the root directory of the installed gem and run the following command
63
+ to fetch all development dependencies:
64
+
65
+ bundle
66
+
67
+ Afterwards start the test runner:
68
+
69
+ rake test
70
+
71
+ If something goes wrong you should be notified through failing examples.
72
+
73
+ Usage
74
+ -----
75
+
76
+ This documentation defines the public interface of the software. The version
77
+ number of the software tracks changes to this public interface as described in
78
+ [Semantic Versioning][semver]. Do not use elements that are marked as private.
79
+ These elements are not guaranteed to exist in otherwise compatible future
80
+ versions. Should you really need some parts that are currently marked as
81
+ private, please contact us. We might be able to expose them as public
82
+ interface for your convenience.
83
+
84
+ This is still experimental software, even the public interface may change
85
+ substantially in future releases.
86
+
87
+ [semver]: http://semver.org/spec/v2.0.0.html
88
+
89
+ ### Ruby interface
90
+
91
+ #### Loading
92
+
93
+ In most cases you want to load the code by using the following command:
94
+
95
+ ~~~~~ ruby
96
+ require 'gem_metadata'
97
+ ~~~~~
98
+
99
+ In a bundler Gemfile you should use the following:
100
+
101
+ ~~~~~ ruby
102
+ gem 'gem_metadata'
103
+ ~~~~~
104
+
105
+ #### Namespace
106
+
107
+ This project is contained within a namespace to avoid name collisions with
108
+ other code. If you do not want to specifiy the namespace explicitly you can
109
+ include it into the current scope by executing the following statement:
110
+
111
+ ~~~~~ ruby
112
+ include GodObject::GemMetadata
113
+ ~~~~~
114
+
115
+ Development
116
+ -----------
117
+
118
+ ### Bug reports and feature requests
119
+
120
+ Please use the [issue tracker][issues] on github.com to let me know about errors
121
+ or ideas for improvement of this software.
122
+
123
+ [issues]: https://github.com/godobject/gem_metadata/issues/
124
+
125
+ ### Source code
126
+
127
+ #### Distribution
128
+
129
+ This software is developed in the source code management system Git. There are
130
+ several synchronized mirror repositories available:
131
+
132
+ * [GitHub][github] (located in California, USA)
133
+
134
+ URI: https://github.com/godobject/gem_metadata.git
135
+
136
+ * [GitLab][gitlab] (located in Illinois, USA)
137
+
138
+ URI: https://gitlab.com/godobject/gem_metadata.git
139
+
140
+ * [BitBucket][bitbucket] (located in California, USA)
141
+
142
+ URI: https://bitbucket.org/godobject/gem_metadata.git
143
+
144
+ * [Pikacode][pikacode] (located in France)
145
+
146
+ URI: https://pikacode.com/godobject/gem_metadata.git
147
+
148
+ [github]: https://github.com/godobject/gem_metadata/
149
+ [gitlab]: https://gitlab.com/godobject/gem_metadata/
150
+ [bitbucket]: https://bitbucket.org/godobject/gem_metadata/
151
+ [pikacode]: https://pikacode.com/godobject/gem_metadata/
152
+
153
+ You can get the latest source code with the following command, while
154
+ exchanging the placeholder for one of the mirror URIs:
155
+
156
+ git clone MIRROR_URI
157
+
158
+ #### Tags and cryptographic verification
159
+
160
+ The final commit before each released gem version will be marked by a tag
161
+ named like the version with a prefixed lower-case "v". Every tag will be signed
162
+ by Alexander E. Fischer's [OpenPGP public key][openpgp] which enables you to
163
+ verify your copy of the code cryptographically.
164
+
165
+ [openpgp]: https://aef.name/crypto/aef-openpgp.asc
166
+
167
+ Add the key to your GnuPG keyring by the following command:
168
+
169
+ gpg --import aef-openpgp.asc
170
+
171
+ This command will tell you if your code is of integrity and authentic:
172
+
173
+ git tag --verify [TAG NAME]
174
+
175
+ #### Building gems
176
+
177
+ To package your state of the source code into a gem package use the following
178
+ command:
179
+
180
+ rake build
181
+
182
+ The gem will be generated according to the .gemspec file in the project root
183
+ directory and will be placed into the pkg/ directory.
184
+
185
+ ### Contribution
186
+
187
+ Help on making this software better is always very appreciated. If you want
188
+ your changes to be included in the official release, please clone the project
189
+ on github.com, create a named branch to commit, push your changes into it and
190
+ send a pull request afterwards.
191
+
192
+ Please make sure to write tests for your changes so that no one else will break
193
+ them when changing other things. Also notice that an inclusion of your changes
194
+ cannot be guaranteed before reviewing them.
195
+
196
+ The following people were involved in development:
197
+
198
+ * Alexander E. Fischer <aef@godobject.net>
199
+
200
+ License
201
+ -------
202
+
203
+ Copyright Alexander E. Fischer <aef@godobject.net>, 2016
204
+
205
+ This file is part of GemMetadata.
206
+
207
+ Permission to use, copy, modify, and/or distribute this software for any
208
+ purpose with or without fee is hereby granted, provided that the above
209
+ copyright notice and this permission notice appear in all copies.
210
+
211
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
212
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
213
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
214
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
215
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
216
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
217
+ PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+ =begin
3
+ Copyright Alexander E. Fischer <aef@godobject.net>, 2016
4
+
5
+ This file is part of GemMetadata.
6
+
7
+ Permission to use, copy, modify, and/or distribute this software for any
8
+ purpose with or without fee is hereby granted, provided that the above
9
+ copyright notice and this permission notice appear in all copies.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
13
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
+ PERFORMANCE OF THIS SOFTWARE.
18
+ =end
19
+
20
+ require 'bundler/gem_tasks'
21
+ require 'rake'
22
+ require 'pathname'
23
+ require 'yard'
24
+ require 'rspec/core/rake_task'
25
+ require 'cucumber/rake/task'
26
+
27
+ RSpec::Core::RakeTask.new
28
+ Cucumber::Rake::Task.new
29
+
30
+ desc 'Run RSpec code examples and Cucumber features'
31
+ task test: [:spec, :cucumber]
32
+
33
+ YARD::Rake::YardocTask.new('doc')
34
+
35
+ desc 'Removes temporary project files'
36
+ task :clean do
37
+ %w(doc/api coverage pkg .yardoc .rbx Gemfile.lock).map{ |name| Pathname.new(name) }.each do |path|
38
+ path.rmtree if path.exist?
39
+ end
40
+
41
+ Pathname.glob('*.gem').each(&:delete)
42
+ Pathname.glob('**/*.rbc').each(&:delete)
43
+ end
44
+
45
+ desc 'Opens an interactive console with the project code loaded'
46
+ task :console do
47
+ Bundler.setup
48
+ require 'pry'
49
+ require 'gem_metadata'
50
+ Pry.start(GodObject::GemMetadata)
51
+ end
52
+
53
+ task default: :test
@@ -0,0 +1,55 @@
1
+ Feature: Finding gems with matching metadata
2
+
3
+ Scenario: Two gem dependencies without matching metadata
4
+ Given a dependency to a gem called "first_without_metadata" without metadata
5
+ And a dependency to a gem called "second_without_metadata" without metadata
6
+ When the following code is executed:
7
+ """
8
+ require 'gem_metadata'
9
+
10
+ metadata_service = GodObject::GemMetadata::Service.new
11
+
12
+ metadata_service.find_gems_providing('some key')
13
+ """
14
+ Then the result lists none of the gems
15
+
16
+ Scenario: One gem dependency with matching metadata and one without
17
+ Given a dependency to a gem called "with_metadata" with the following metadata definition in its gemspec:
18
+ """
19
+ gem.metadata = {
20
+ 'some key' => 'some value'
21
+ }
22
+ """
23
+ And a dependency to a gem called "without_metadata" without metadata
24
+ When the following code is executed:
25
+ """
26
+ require 'gem_metadata'
27
+
28
+ metadata_service = GodObject::GemMetadata::Service.new
29
+
30
+ metadata_service.find_gems_providing('some key')
31
+ """
32
+ Then the result lists solely the gem named "with_metadata"
33
+
34
+ Scenario: Two gem dependencies without matching metadata
35
+ Given a dependency to a gem called "first_with_metadata" with the following metadata definition in its gemspec:
36
+ """
37
+ gem.metadata = {
38
+ 'some key' => 'some value'
39
+ }
40
+ """
41
+ And a dependency to a gem called "second_with_metadata" with the following metadata definition in its gemspec:
42
+ """
43
+ gem.metadata = {
44
+ 'some key' => 'other value'
45
+ }
46
+ """
47
+ When the following code is executed:
48
+ """
49
+ require 'gem_metadata'
50
+
51
+ metadata_service = GodObject::GemMetadata::Service.new
52
+
53
+ metadata_service.find_gems_providing('some key')
54
+ """
55
+ Then the result lists the gems named "first_with_metadata" and "second_with_metadata"
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+ =begin
3
+ Copyright Alexander E. Fischer <aef@godobject.net>, 2016
4
+
5
+ This file is part of GemMetadata.
6
+
7
+ Permission to use, copy, modify, and/or distribute this software for any
8
+ purpose with or without fee is hereby granted, provided that the above
9
+ copyright notice and this permission notice appear in all copies.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
13
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
+ PERFORMANCE OF THIS SOFTWARE.
18
+ =end
19
+
20
+ Given(/^a dependency to a gem called "([^"]*)" with the following metadata definition in its gemspec:$/) do |gem_name, gem_metadata_definition|
21
+ gemspec_content = gemspec_for(gem_name: gem_name, additional_content: gem_metadata_definition)
22
+
23
+ create_gem_dependency(name: gem_name, gemspec_content: gemspec_content)
24
+ end
25
+
26
+ Given(/^a dependency to a gem called "([^"]*)" without metadata$/) do |gem_name|
27
+ create_gem_dependency(name: gem_name)
28
+ end
29
+
30
+ When(/^the following code is executed:$/) do |code_to_execute|
31
+ create_gemfile(include_gems: gem_dependencies)
32
+
33
+ code_file = write_code_as_function_into_file(code_to_execute)
34
+
35
+ evaluate_in_separate_environment("bundle exec ruby -r'#{code_file}' -e 'puts Marshal.dump(code_to_execute)'")
36
+ end
37
+
38
+ Then(/^the result lists none of the gems$/) do
39
+ expect(evaluation_result).to eql []
40
+ end
41
+
42
+ Then(/^the result lists solely the gem named "([^"]*)"$/) do |gem_name|
43
+ expect(evaluation_result).to have(1).item
44
+ expect(evaluation_result.first).to be_a Gem::Specification
45
+ expect(evaluation_result.first.name).to eql gem_name
46
+ end
47
+
48
+ Then(/^the result lists the gems named "([^"]*)" and "([^"]*)"$/) do |first_gem_name, second_gem_name|
49
+ expect(evaluation_result).to have(2).items
50
+ expect(evaluation_result[0]).to be_a Gem::Specification
51
+ expect(evaluation_result[0].name).to eql first_gem_name
52
+ expect(evaluation_result[1]).to be_a Gem::Specification
53
+ expect(evaluation_result[1].name).to eql second_gem_name
54
+ end