rip-package 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cfd9ea46391aaf01c002186693439deeda2455c6
4
+ data.tar.gz: 807341e123044cef2597804bd30721c8ad47b252
5
+ SHA512:
6
+ metadata.gz: 8b71c92612bb63aa2767fa5aa17acaf3b99a5394279824c7ae21385633082bf4aa0f757162b9c843b8a5cae5cf5262431a826912b141b30a7f50cd3920b0f711
7
+ data.tar.gz: 3508632490b3e18f82826508fb9079aff2eafc9445169dd671ff3462f4c13a3b99ff092aaea0c38ffd24ab2fac75f7baa682ec5523f99cb5fe956499e6b2d742
data/.editorconfig ADDED
@@ -0,0 +1,19 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ insert_final_newline = true
7
+ trim_trailing_whitespace = true
8
+
9
+ [*.md]
10
+ indent_style = space
11
+ indent_size = 2
12
+
13
+ [{Gemfile,*.gemspec,*.rb}]
14
+ indent_style = space
15
+ indent_size = 2
16
+
17
+ [*.toml]
18
+ indent_style = space
19
+ indent_size = 2
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ .bundle/
2
+ .yardoc
3
+ Gemfile.lock
4
+ _yardoc/
5
+ coverage/
6
+ doc/
7
+ pkg/
8
+ spec/reports/
9
+ tmp/
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.3.1
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ rvm:
5
+ - 2.3.1
6
+ before_install: gem install bundler -v 1.12.5
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org/'
2
+
3
+ gemspec
data/README.md ADDED
@@ -0,0 +1,13 @@
1
+ ## Rip Package
2
+
3
+ This project parses and validates a given [Rip](http://www.rip-lang.org/) package metadata file (`package.toml`).
4
+
5
+
6
+ ### Usage
7
+
8
+ ```ruby
9
+ require 'rip-package'
10
+
11
+ package_root = Pathname.new(__dir__)
12
+ metadata = Rip::Package.load_file(package_root + 'package.toml')
13
+ ```
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs = []
6
+ t.pattern = 'test/**/test_*.rb'
7
+ end
8
+
9
+ task default: :test
data/bin/console ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'pry'
5
+
6
+ require 'rip-package'
7
+
8
+ Pry.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,24 @@
1
+ require_relative './source/rip/package/about'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'rip-package'
5
+ spec.version = Rip::Package::About.version
6
+ spec.author = 'Thomas Ingram'
7
+ spec.license = 'MIT'
8
+ spec.summary = 'Ruby package metadata for Rip'
9
+ spec.homepage = 'http://www.rip-lang.org/'
10
+
11
+ spec.files = `git ls-files -z`.split("\x0")
12
+ spec.require_paths = [ 'source' ]
13
+
14
+ spec.add_runtime_dependency 'hashie'
15
+ spec.add_runtime_dependency 'parslet'
16
+ spec.add_runtime_dependency 'semverse'
17
+ spec.add_runtime_dependency 'tomlrb'
18
+
19
+ spec.add_development_dependency 'minitest'
20
+ spec.add_development_dependency 'pry'
21
+ spec.add_development_dependency 'pry-doc'
22
+ spec.add_development_dependency 'rake'
23
+ spec.add_development_dependency 'ruby-prof'
24
+ end
@@ -0,0 +1,78 @@
1
+ AAL
2
+ AFL-3.0
3
+ AGPL-3.0
4
+ AGPL-3.0
5
+ APL-1.0
6
+ APSL-2.0
7
+ Apache-2.0
8
+ Artistic-2.0
9
+ BSD-2-Clause
10
+ BSD-3-Clause
11
+ BSL-1.0
12
+ CATOSL-1.1
13
+ CDDL-1.0
14
+ CECILL-2.1
15
+ CNRI-Python
16
+ CPAL-1.0
17
+ CUA-OPL-1.0
18
+ ECL-2.0
19
+ EFL-2.0
20
+ EPL-1.0
21
+ EUDatagrid
22
+ EUPL-1.1
23
+ Entessa
24
+ FPL-1.0.0
25
+ FPL-1.0.0
26
+ Fair
27
+ Frameworx-1.0
28
+ GPL-2.0
29
+ GPL-3.0
30
+ HPND
31
+ IPA
32
+ IPL-1.0
33
+ ISC
34
+ LGPL-2.1
35
+ LGPL-3.0
36
+ LPL-1.02
37
+ LPPL-1.3c
38
+ LiLiQ-P-1.1
39
+ LiLiQ-R-1.1
40
+ LiLiQ-Rplus-1.1
41
+ MIT
42
+ MPL-2.0
43
+ MS-PL
44
+ MS-RL
45
+ MirOS
46
+ Motosoto
47
+ Multics
48
+ NASA-1.3
49
+ NCSA
50
+ NGPL
51
+ NPOSL-3.0
52
+ NTP
53
+ Naumen
54
+ Nokia
55
+ OCLC-2.0
56
+ OFL-1.1
57
+ OGTSL
58
+ OPL-2.1
59
+ OSL-3.0
60
+ PHP-3.0
61
+ PostgreSQL
62
+ Python-2.0
63
+ QPL-1.0
64
+ RPL-1.5
65
+ RPSL-1.0
66
+ RSCPL
67
+ SPL-1.0
68
+ SimPL-2.0
69
+ Sleepycat
70
+ UPL
71
+ VSL-1.0
72
+ W3C
73
+ WXwindows
74
+ Watcom-1.0
75
+ Xnet
76
+ ZPL-2.0
77
+ Zlib
78
+ eCos-2.0
@@ -0,0 +1 @@
1
+ require_relative './rip/package'
@@ -0,0 +1,50 @@
1
+ require 'tomlrb'
2
+
3
+ module Rip
4
+ module Package
5
+ InvalidMetadata = Class.new(StandardError)
6
+
7
+ def self.load_file(metadata_path)
8
+ details = Tomlrb.load_file(metadata_path, symbolize_keys: true)
9
+ package_root = Pathname.new(metadata_path).dirname
10
+
11
+ if details.key?(:license_file) && !Pathname.new(details[:license_file]).absolute?
12
+ details = details.merge(license_file: package_root.join(details[:license_file]).to_s)
13
+ end
14
+
15
+ if details.key?(:executables)
16
+ details[:executables][:_package_root] = package_root
17
+ end
18
+
19
+ if details.key?(:dependencies)
20
+ details[:dependencies] = details[:dependencies].map do |name, options|
21
+ case options
22
+ when String
23
+ [ name, { version: options } ]
24
+ when Hash
25
+ _options = options.key?(:path) ? options.merge(package_root: package_root) : options
26
+ [ name, _options ]
27
+ end
28
+ end
29
+ end
30
+
31
+ begin
32
+ Rip::Package::Metadata.new(details)
33
+ rescue ArgumentError
34
+ raise Rip::Package::InvalidMetadata, 'invalid package metadata'
35
+ end
36
+ end
37
+
38
+ def self.root
39
+ Pathname.new(__dir__).parent.parent
40
+ end
41
+ end
42
+ end
43
+
44
+ require_relative './package/about'
45
+ require_relative './package/author'
46
+ require_relative './package/dependency'
47
+ require_relative './package/executable'
48
+ require_relative './package/license'
49
+ require_relative './package/metadata'
50
+ require_relative './package/version'
@@ -0,0 +1,9 @@
1
+ module Rip
2
+ module Package
3
+ module About
4
+ def self.version
5
+ '0.1.0'
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,26 @@
1
+ module Rip::Package
2
+ class Author
3
+ attr_reader :name
4
+ attr_reader :email
5
+
6
+ def initialize(name:, email:)
7
+ raise Rip::Package::InvalidMetadata, 'author `name` is required' if name.nil?
8
+ raise Rip::Package::InvalidMetadata, 'author `email` is required' if email.nil?
9
+
10
+ @name = name
11
+ @email = email
12
+ end
13
+
14
+ def inspect
15
+ "#<#{self.class.name} #{to_s}>"
16
+ end
17
+
18
+ def to_s
19
+ "\"#{name}\" <#{email}>"
20
+ end
21
+
22
+ def self.extract(authors)
23
+ authors.map(&method(:new))
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,88 @@
1
+ module Rip::Package
2
+ class Dependency
3
+ attr_reader :name
4
+
5
+ def initialize(name)
6
+ @name = name
7
+ end
8
+
9
+ def inspect
10
+ "#<#{self.class.name} #{to_s}>"
11
+ end
12
+
13
+ def self.extract(dependencies)
14
+ dependencies.map do |name, options|
15
+ expand_constraints(name, options)
16
+ end
17
+ end
18
+
19
+ protected
20
+
21
+ def self.expand_constraints(name, options)
22
+ case
23
+ when options.include?(:version)
24
+ Rip::Package::VersionDependency.new(name, options)
25
+ when options.include?(:git)
26
+ Rip::Package::GitDependency.new(name, options)
27
+ when options.include?(:path)
28
+ Rip::Package::PathDependency.new(name, options)
29
+ end
30
+ end
31
+ end
32
+
33
+ class VersionDependency < Dependency
34
+ VARY_OPTIONS = [
35
+ :major,
36
+ :minor,
37
+ :patch,
38
+ :pre_release,
39
+ :build,
40
+ :exact
41
+ ]
42
+
43
+ attr_reader :version
44
+ attr_reader :vary
45
+ attr_reader :repository
46
+
47
+ def initialize(name, version:, vary: :minor, repository: nil)
48
+ raise Rip::Package::InvalidMetadata, "`vary` must be one of #{VARY_OPTIONS.join(', ')} exactly" unless VARY_OPTIONS.include?(vary.to_sym)
49
+ super(name)
50
+ @version = Rip::Package::Version.extract(version)
51
+ @vary = vary.to_sym
52
+ @repository = repository
53
+ end
54
+
55
+ def to_s
56
+ repo = " #{repository}" if repository
57
+ "#{name} #{version} [#{vary}]#{repo}"
58
+ end
59
+ end
60
+
61
+ class GitDependency < Dependency
62
+ attr_reader :repository
63
+ attr_reader :commit
64
+
65
+ def initialize(name, git:, commit: 'master')
66
+ super(name)
67
+ @repository = git
68
+ @commit = commit
69
+ end
70
+
71
+ def to_s
72
+ "#{name} #{repository}##{commit}"
73
+ end
74
+ end
75
+
76
+ class PathDependency < Dependency
77
+ attr_reader :package_root
78
+
79
+ def initialize(name, package_root:, path:)
80
+ super(name)
81
+ @package_root = package_root.join(path).expand_path
82
+ end
83
+
84
+ def to_s
85
+ "#{name} #{package_root}"
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,30 @@
1
+ module Rip::Package
2
+ class Executable
3
+ attr_reader :root_module
4
+ attr_reader :output
5
+
6
+ def initialize(root_module, output)
7
+ @root_module = root_module
8
+ @output = output
9
+ end
10
+
11
+ def inspect
12
+ "#<#{self.class.name} #{to_s}>"
13
+ end
14
+
15
+ def to_s
16
+ "#{root_module} => #{output}"
17
+ end
18
+
19
+ def self.extract(executables)
20
+ project_root = executables.delete(:_package_root)
21
+
22
+ executables.map do |root_module, output|
23
+ new(
24
+ project_root.join(root_module.to_s).expand_path,
25
+ project_root.join(output.to_s).expand_path
26
+ )
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,45 @@
1
+ module Rip::Package
2
+ class License
3
+ OSI_LICENSES = Rip::Package.root.join('source/osi_licenses.txt').read.lines.map(&:strip)
4
+ KNOWN_LICENSES = [
5
+ 'proprietary'
6
+ ] + OSI_LICENSES
7
+
8
+ attr_reader :name
9
+ attr_reader :path
10
+
11
+ def initialize(name, path, is_osi)
12
+ @name = name
13
+ @path = path
14
+ @is_osi = is_osi
15
+ end
16
+
17
+ def osi?
18
+ @is_osi
19
+ end
20
+
21
+ def inspect
22
+ approval = ' [osi]' if osi?
23
+ "#<#{self.class.name} #{to_s}#{approval}>"
24
+ end
25
+
26
+ def to_s
27
+ osi? ? name : path
28
+ end
29
+
30
+ def self.extract(license)
31
+ case license
32
+ when Pathname
33
+ raise Rip::Package::InvalidMetadata, 'path to license_file not valid' unless license.file?
34
+ new(license.basename.to_s, license, false)
35
+ when String
36
+ raise Rip::Package::InvalidMetadata, 'invalid or unknown license' unless known_license?(license)
37
+ new(license, nil, true)
38
+ end
39
+ end
40
+
41
+ def self.known_license?(license_name)
42
+ KNOWN_LICENSES.include?(license_name)
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,44 @@
1
+ require 'hashie'
2
+
3
+ module Rip::Package
4
+ class Metadata
5
+ attr_reader :authors
6
+ attr_reader :dependencies
7
+ attr_reader :description
8
+ attr_reader :executables
9
+ attr_reader :homepage
10
+ attr_reader :license
11
+ attr_reader :extra
12
+ attr_reader :name
13
+ attr_reader :version
14
+
15
+ def initialize(author: nil, authors: nil, dependencies: {}, description: nil, executables: {}, homepage: nil, license: nil, license_file: nil, extra: nil, name:, version:)
16
+ raise Rip::Package::InvalidMetadata, 'an author is required' if author.nil? && authors.nil?
17
+ raise Rip::Package::InvalidMetadata, 'must use `[[authors]]` when specifying more than one author' if author && authors
18
+ @authors = Rip::Package::Author.extract(author ? [ author ] : authors)
19
+
20
+ @dependencies = Rip::Package::Dependency.extract(dependencies)
21
+
22
+ @description = description
23
+
24
+ @executables = Rip::Package::Executable.extract(executables)
25
+
26
+ @homepage = URI.parse(homepage) if homepage
27
+
28
+ raise Rip::Package::InvalidMetadata, 'a license is required' if license.nil? && license_file.nil?
29
+ raise Rip::Package::InvalidMetadata, 'must specify a single license' if license && license_file
30
+ @license = if license_file
31
+ Rip::Package::License.extract(Pathname.new(license_file).expand_path)
32
+ else
33
+ Rip::Package::License.extract(license)
34
+ end
35
+
36
+ @extra = Hashie::Mash.new(extra) if extra
37
+
38
+ raise Rip::Package::InvalidMetadata, '`name` must follow the rules for references' unless /\A[a-zA-Z_]+\z/ =~ name
39
+ @name = name
40
+
41
+ @version = Rip::Package::Version.extract(version)
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,46 @@
1
+ require 'semverse'
2
+
3
+ module Rip::Package
4
+ class Version
5
+ attr_reader :major
6
+ attr_reader :minor
7
+ attr_reader :patch
8
+ attr_reader :pre_release
9
+ attr_reader :build
10
+
11
+ def initialize(parts)
12
+ @major = parts.major
13
+ @minor = parts.minor
14
+ @patch = parts.patch
15
+ @pre_release = parts.pre_release
16
+ @build = parts.build
17
+ end
18
+
19
+ def inspect
20
+ "#<#{self.class.name} #{to_s}>"
21
+ end
22
+
23
+ def to_s
24
+ base = "#{major}.#{minor}.#{patch}"
25
+
26
+ case
27
+ when pre_release && build
28
+ "#{base}-#{pre_release}+#{build}"
29
+ when pre_release
30
+ "#{base}-#{pre_release}"
31
+ when build
32
+ "#{base}+#{build}"
33
+ else
34
+ base
35
+ end
36
+ end
37
+
38
+ def self.extract(version)
39
+ begin
40
+ new(Semverse::Version.new(version))
41
+ rescue Semverse::InvalidVersionFormat
42
+ raise Rip::Package::InvalidMetadata, '`version` must follow semver'
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1 @@
1
+ copyright <year> <somebody>
@@ -0,0 +1,103 @@
1
+ # package_details = TOML.load_file(package_path)
2
+
3
+
4
+ # package name
5
+ # this is the name dependent packages should import
6
+ name = "specification" # required
7
+
8
+
9
+ # version must be a SemVer 2 compatible version string
10
+ version = "0.1.0" # required
11
+
12
+
13
+ # any name recognized by OSI may be used
14
+ # the special name "proprietary" may also be used
15
+ license = "MIT"
16
+
17
+ # alternatively specify any arbitrary license in a file
18
+ # license_file = "LICENSE.txt"
19
+
20
+ # one of `license` or `license_file` is required
21
+
22
+
23
+ homepage = "http://www.rip-lang.org/"
24
+
25
+ description = """
26
+ Describe the package here. Optionally use markdown.
27
+ """
28
+
29
+
30
+ # at least one author is required
31
+ # if you just have a single author, use `[author]`
32
+ [author]
33
+ name = "Thomas Ingram" # required
34
+ email = "code@example.com" # required
35
+
36
+ # multiple authors may be specified by duplicating this block and changing the values
37
+ # [[authors]]
38
+ # name = "Thomas Ingram" # required
39
+ # email = "code@example.com" # required
40
+
41
+ # [[authors]]
42
+ # name = "Allea Ingram"
43
+ # email = "she@example.com"
44
+
45
+ # it is an error to specify both `[author]` and `[[authors]]`
46
+
47
+
48
+ # output executables when running `$ rip compile`
49
+ # the starting source file is on the left
50
+ # the output binary name is on the right
51
+ # this section is optional and is meant for application developers
52
+ [executables]
53
+ "source/main.rip" = "build/rip-spec"
54
+
55
+
56
+ # extra metadata specific to this project. put whatever you want in here
57
+ [extra]
58
+
59
+ # everything in here will wrapped with Hashie::Mash
60
+ answer = { life = 42, universe = 42, everything = 42 }
61
+
62
+
63
+ # technically optional. if you have no dependencies, just leave this out
64
+ [dependencies]
65
+
66
+ # simplest version constraint
67
+ # this will search the public repository for `foo`
68
+ # `vary` option (below) defaults to "minor"
69
+ foo = "2.0.1"
70
+
71
+ # this is the expanded way to write the same version as above
72
+ # it will match the greatest version possible, with the following constraints
73
+ # 1) may be equal to `2.0.1`, exactly
74
+ # 2) any version greater than `2.0.1`
75
+ # 3) any version less that `3.0.0`
76
+ # 4) stable releases only
77
+ # you can also set `vary` to "patch", which changes constraint 3 above to any version less than `2.1.0`
78
+ bar = { version = "2.0.1", vary = "minor" }
79
+
80
+ # match the version exactly
81
+ baz = { version = "2.0.1", vary = "exact" }
82
+
83
+ # use a alternative repository and only accept patch-level changes
84
+ bax = { version = "0.1.2", vary = "patch", repository = "https://packages.example.com/" }
85
+
86
+ # pull code from a git server
87
+ rip = { git = "git@github.com:rip-lang/rip.git" }
88
+
89
+ # you can be more specific with `commit`. set it to a branch or tag
90
+ # if a branch, use the most recent commit on branch
91
+ # defaults to master branch
92
+ nip = { git = "git@github.com:rip-lang/rip.git", commit = "special-feature" }
93
+ tip = { git = "git@github.com:rip-lang/rip.git", commit = "v1.2.3" }
94
+
95
+ # point to an exact commit
96
+ sip = { git = "git@github.com:rip-lang/rip.git", commit = "7913a93d" }
97
+
98
+ # you can also point git to a local directory containing a git checkout
99
+ # commit works here too
100
+ fip = { git = "../rip-rip" }
101
+
102
+ # you can also specify a local path to a dependency
103
+ xxx = { path = "../bax-core" }
@@ -0,0 +1,45 @@
1
+ name = "mighty_foo"
2
+
3
+ version = "1.3.8"
4
+
5
+ license_file = "LICENSE.txt"
6
+
7
+ homepage = "http://www.rip-lang.org/"
8
+
9
+ description = """
10
+ Describe the package here. Optionally use markdown.
11
+ """
12
+
13
+ [[authors]]
14
+ name = "Thomas Ingram"
15
+ email = "first@example.com"
16
+
17
+ [[authors]]
18
+ name = "Allea Ingram"
19
+ email = "second@example.com"
20
+
21
+ [executables]
22
+ "source/main.rip" = "build/rip-spec"
23
+
24
+ [extra]
25
+ answer = { life = 42, universe = 42, everything = 42 }
26
+
27
+ [dependencies]
28
+ foo = "2.0.1"
29
+
30
+ bar = { version = "2.0.1", vary = "minor" }
31
+
32
+ baz = { version = "2.0.1", vary = "exact" }
33
+
34
+ bax = { version = "0.1.2", vary = "patch", repository = "https://packages.example.com/" }
35
+
36
+ rip = { git = "git@github.com:rip-lang/rip.git" }
37
+
38
+ nip = { git = "git@github.com:rip-lang/rip.git", commit = "special-feature" }
39
+ tip = { git = "git@github.com:rip-lang/rip.git", commit = "v1.2.3" }
40
+
41
+ sip = { git = "git@github.com:rip-lang/rip.git", commit = "7913a93d" }
42
+
43
+ fip = { git = "../rip-rip" }
44
+
45
+ xxx = { path = "../bax-core" }
@@ -0,0 +1,7 @@
1
+ name = "foo"
2
+
3
+ version = "1.2.3"
4
+
5
+ license = "MIT"
6
+
7
+ author = { name = "Thomas Ingram", email = "author@example.com" }
@@ -0,0 +1,6 @@
1
+ require 'minitest/autorun'
2
+ require 'pry'
3
+
4
+ Minitest::Test.make_my_diffs_pretty!
5
+
6
+ require_relative '../source/rip-package'
@@ -0,0 +1,65 @@
1
+ require_relative '../../test_helper'
2
+
3
+ describe Rip::Package do
4
+ let(:fixtures) { Rip::Package.root + 'test' + 'fixtures' }
5
+ let(:metadata) { Rip::Package.load_file(fixtures + metadata_name) }
6
+
7
+ describe '.load_file' do
8
+ describe 'simple package' do
9
+ let(:metadata_name) { 'minimal.toml' }
10
+
11
+ specify { expect(metadata.name).must_equal('foo') }
12
+
13
+ specify { expect(metadata.version.major).must_equal(1) }
14
+ specify { expect(metadata.version.minor).must_equal(2) }
15
+ specify { expect(metadata.version.patch).must_equal(3) }
16
+
17
+ specify { expect(metadata.license.name).must_equal('MIT') }
18
+ specify { expect(metadata.license).must_be(:osi?) }
19
+
20
+ specify { expect(metadata.authors.count).must_equal(1) }
21
+ specify { expect(metadata.authors.first.name).must_equal('Thomas Ingram') }
22
+ specify { expect(metadata.authors.first.email).must_equal('author@example.com') }
23
+
24
+ specify { expect(metadata.homepage).must_be_nil }
25
+
26
+ specify { expect(metadata.description).must_be_nil }
27
+
28
+ specify { expect(metadata.executables.count).must_equal(0) }
29
+
30
+ specify { expect(metadata.extra).must_be_nil }
31
+
32
+ specify { expect(metadata.dependencies.count).must_equal(0) }
33
+ end
34
+
35
+ describe 'complex package' do
36
+ let(:metadata_name) { 'full.toml' }
37
+
38
+ specify { expect(metadata.name).must_equal('mighty_foo') }
39
+
40
+ specify { expect(metadata.version.major).must_equal(1) }
41
+ specify { expect(metadata.version.minor).must_equal(3) }
42
+ specify { expect(metadata.version.patch).must_equal(8) }
43
+
44
+ specify { expect(metadata.license.name).must_equal('LICENSE.txt') }
45
+ specify { expect(metadata.license.path).must_equal(fixtures + 'LICENSE.txt') }
46
+ specify { expect(metadata.license).wont_be(:osi?) }
47
+
48
+ specify { expect(metadata.authors.count).must_equal(2) }
49
+ specify { expect(metadata.authors.first.name).must_equal('Thomas Ingram') }
50
+ specify { expect(metadata.authors.last.email).must_equal('second@example.com') }
51
+
52
+ specify { expect(metadata.homepage).wont_be_nil }
53
+
54
+ specify { expect(metadata.description).wont_be_nil }
55
+
56
+ specify { expect(metadata.executables.count).must_equal(1) }
57
+
58
+ specify { expect(metadata.extra).wont_be_nil }
59
+ specify { expect(metadata.extra).must_be_kind_of(Hashie::Mash) }
60
+ specify { expect(metadata.extra).must_include(:answer) }
61
+
62
+ specify { expect(metadata.dependencies.count).must_equal(10) }
63
+ end
64
+ end
65
+ end
metadata ADDED
@@ -0,0 +1,196 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rip-package
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Thomas Ingram
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-07-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: hashie
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: parslet
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: semverse
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
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: tomlrb
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
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: minitest
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: pry
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: pry-doc
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: rake
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: ruby-prof
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
+ description:
140
+ email:
141
+ executables: []
142
+ extensions: []
143
+ extra_rdoc_files: []
144
+ files:
145
+ - ".editorconfig"
146
+ - ".gitignore"
147
+ - ".ruby-version"
148
+ - ".travis.yml"
149
+ - Gemfile
150
+ - README.md
151
+ - Rakefile
152
+ - bin/console
153
+ - bin/setup
154
+ - rip-package.gemspec
155
+ - source/osi_licenses.txt
156
+ - source/rip-package.rb
157
+ - source/rip/package.rb
158
+ - source/rip/package/about.rb
159
+ - source/rip/package/author.rb
160
+ - source/rip/package/dependency.rb
161
+ - source/rip/package/executable.rb
162
+ - source/rip/package/license.rb
163
+ - source/rip/package/metadata.rb
164
+ - source/rip/package/version.rb
165
+ - test/fixtures/LICENSE.txt
166
+ - test/fixtures/annotated.toml
167
+ - test/fixtures/full.toml
168
+ - test/fixtures/minimal.toml
169
+ - test/test_helper.rb
170
+ - test/unit/rip/test_package.rb
171
+ homepage: http://www.rip-lang.org/
172
+ licenses:
173
+ - MIT
174
+ metadata: {}
175
+ post_install_message:
176
+ rdoc_options: []
177
+ require_paths:
178
+ - source
179
+ required_ruby_version: !ruby/object:Gem::Requirement
180
+ requirements:
181
+ - - ">="
182
+ - !ruby/object:Gem::Version
183
+ version: '0'
184
+ required_rubygems_version: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: '0'
189
+ requirements: []
190
+ rubyforge_project:
191
+ rubygems_version: 2.5.1
192
+ signing_key:
193
+ specification_version: 4
194
+ summary: Ruby package metadata for Rip
195
+ test_files: []
196
+ has_rdoc: