solve 4.0.0 → 4.0.1

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
- SHA1:
3
- metadata.gz: af5099b9f2b7ff996d32e8082de7f3f8085bf5aa
4
- data.tar.gz: 8b6541e4ce764b2c1db8ade3c8b1ba5a19060c47
2
+ SHA256:
3
+ metadata.gz: 2716c3058f3990b8bfa27bb8961e0204a086ea8e9353eec03e39ba84e0877613
4
+ data.tar.gz: c9bb41f43375181e4431d215b613dcddf5d2ea2043217ffb5ff87e2505d78881
5
5
  SHA512:
6
- metadata.gz: 21fc447438917b86a09f5741b0b325ba030d4f654b1831806bb987c68bbc22975c83725fa1e5845f22cd1b35a7ecbcc8dbf56d6f44ec3c09ec97113199c7263d
7
- data.tar.gz: b8862c18f07f3fea2c0033f54848a073ab387edc1b9f489439ee2b088ff78cdb36cf7f97d98cdb66396771f6990d4ee44004a7047c081f33f17291d25b5c2a67
6
+ metadata.gz: 911f81ecfcd431abcac7bdc7a307ad4acba9c77e328e3aac6ed594ecd2535a4947ddbf1fe37a4a7c7f0b1e6f3a33ca4dbc3219d5874c5ba5ad841658b96c3788
7
+ data.tar.gz: d50980103fd7b23e03964a3b0b5d639f5f4cce4673d9a4e44894d1e09c702be155041cb85d47e70464df1d3686f0c09aff3e000e50447d4b47a9132a6cafdcdd
@@ -185,7 +185,7 @@ module Solve
185
185
 
186
186
  # @return [Symbol]
187
187
  def operator_type
188
- unless type = OPERATOR_TYPES.fetch(operator)
188
+ unless ( type = OPERATOR_TYPES.fetch(operator) )
189
189
  raise "unknown operator type: #{operator}"
190
190
  end
191
191
 
@@ -10,7 +10,7 @@ module Solve
10
10
  #
11
11
  # @return [Integer]
12
12
  def timeout
13
- seconds = 30 unless seconds = ENV["SOLVE_TIMEOUT"]
13
+ seconds = 30 unless ( seconds = ENV["SOLVE_TIMEOUT"] )
14
14
  seconds.to_i * 1_000
15
15
  end
16
16
 
@@ -11,7 +11,7 @@ module Solve
11
11
  #
12
12
  # @return [Integer]
13
13
  def timeout
14
- seconds = 30 unless seconds = ENV["SOLVE_TIMEOUT"]
14
+ seconds = 30 unless ( seconds = ENV["SOLVE_TIMEOUT"] )
15
15
  seconds.to_i * 1_000
16
16
  end
17
17
 
@@ -1,3 +1,3 @@
1
1
  module Solve
2
- VERSION = "4.0.0"
2
+ VERSION = "4.0.1".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solve
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Winsor
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-08-11 00:00:00.000000000 Z
13
+ date: 2018-12-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: semverse
@@ -111,15 +111,7 @@ executables: []
111
111
  extensions: []
112
112
  extra_rdoc_files: []
113
113
  files:
114
- - ".gitignore"
115
- - ".travis.yml"
116
- - Gemfile
117
- - Guardfile
118
114
  - LICENSE
119
- - NoGecode.gemfile
120
- - README.md
121
- - Rakefile
122
- - Thorfile
123
115
  - lib/solve.rb
124
116
  - lib/solve/artifact.rb
125
117
  - lib/solve/constraint.rb
@@ -131,24 +123,9 @@ files:
131
123
  - lib/solve/ruby_solver.rb
132
124
  - lib/solve/solver/serializer.rb
133
125
  - lib/solve/version.rb
134
- - solve.gemspec
135
- - spec/acceptance/benchmark.rb
136
- - spec/acceptance/large_graph_no_solution.rb
137
- - spec/acceptance/opscode_ci_graph.rb
138
- - spec/acceptance/ruby_solver_solutions_spec.rb
139
- - spec/acceptance/solutions_spec.rb
140
- - spec/spec_helper.rb
141
- - spec/unit/solve/artifact_spec.rb
142
- - spec/unit/solve/demand_spec.rb
143
- - spec/unit/solve/dependency_spec.rb
144
- - spec/unit/solve/gecode_solver_spec.rb
145
- - spec/unit/solve/graph_spec.rb
146
- - spec/unit/solve/ruby_solver_spec.rb
147
- - spec/unit/solve/solver/serializer_spec.rb
148
- - spec/unit/solve_spec.rb
149
126
  homepage: https://github.com/berkshelf/solve
150
127
  licenses:
151
- - Apache 2.0
128
+ - Apache-2.0
152
129
  metadata: {}
153
130
  post_install_message:
154
131
  rdoc_options: []
@@ -166,22 +143,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
143
  version: '0'
167
144
  requirements: []
168
145
  rubyforge_project:
169
- rubygems_version: 2.6.11
146
+ rubygems_version: 2.7.7
170
147
  signing_key:
171
148
  specification_version: 4
172
149
  summary: A Ruby version constraint solver implementing Semantic Versioning 2.0.0-rc.1
173
- test_files:
174
- - spec/acceptance/benchmark.rb
175
- - spec/acceptance/large_graph_no_solution.rb
176
- - spec/acceptance/opscode_ci_graph.rb
177
- - spec/acceptance/ruby_solver_solutions_spec.rb
178
- - spec/acceptance/solutions_spec.rb
179
- - spec/spec_helper.rb
180
- - spec/unit/solve/artifact_spec.rb
181
- - spec/unit/solve/demand_spec.rb
182
- - spec/unit/solve/dependency_spec.rb
183
- - spec/unit/solve/gecode_solver_spec.rb
184
- - spec/unit/solve/graph_spec.rb
185
- - spec/unit/solve/ruby_solver_spec.rb
186
- - spec/unit/solve/solver/serializer_spec.rb
187
- - spec/unit/solve_spec.rb
150
+ test_files: []
data/.gitignore DELETED
@@ -1,20 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- NoGecode.gemfile.lock
8
- InstalledFiles
9
- _yardoc
10
- coverage
11
- doc/
12
- lib/bundler/man
13
- pkg
14
- rdoc
15
- spec/reports
16
- test/tmp
17
- test/version_tmp
18
- tmp
19
- .ruby-version
20
- .rspec
@@ -1,25 +0,0 @@
1
- language: ruby
2
- cache:
3
- - apt
4
- - bundler
5
-
6
- before_install:
7
- - sudo apt-get update
8
- - gem install bundler --no-ri --no-rdoc
9
-
10
- install: travis_wait bundle install --without guard --jobs 7 --retry=3
11
- script: "bundle exec thor spec"
12
- # prevent PR branches from running travis twice
13
- branches:
14
- only:
15
- - master
16
-
17
- matrix:
18
- include:
19
- - rvm: 2.3.3
20
- - rvm: 2.4.1
21
- - rvm: ruby-head
22
- - rvm: 2.4.1
23
- env:
24
- CHEFSTYLE: 1
25
- script: bundle exec rake style
data/Gemfile DELETED
@@ -1,36 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec
4
-
5
- group :gecode do
6
- gem "dep_selector", "~> 1.0"
7
- end
8
-
9
- # If this group is named "development", then `bundle install --without
10
- # development` automagically excludes development dependencies that are listed
11
- # in the gemspec, which will skip installing rspec and then we can't run tests.
12
- group :development do
13
- gem "fuubar"
14
- gem "yard"
15
- gem "redcarpet"
16
- gem "chefstyle", git: "https://github.com/chef/chefstyle"
17
- end
18
-
19
- group :guard do
20
- gem "guard-rspec"
21
- gem "guard-spork"
22
- gem "guard-yard"
23
- gem "coolline"
24
-
25
- require "rbconfig"
26
-
27
- if RbConfig::CONFIG["target_os"] =~ /darwin/i
28
- gem "ruby_gntp", require: false
29
-
30
- elsif RbConfig::CONFIG["target_os"] =~ /linux/i
31
- gem "libnotify", require: false
32
-
33
- elsif RbConfig::CONFIG["target_os"] =~ /mswin|mingw/i
34
- gem "win32console", require: false
35
- end
36
- end
data/Guardfile DELETED
@@ -1,17 +0,0 @@
1
- guard "spork", rspec_port: 8991 do
2
- watch("Gemfile")
3
- watch("spec/spec_helper.rb") { :rspec }
4
- end
5
-
6
- guard "yard", port: 8809, stdout: "/dev/null", stderr: "/dev/null" do
7
- watch(%r{app/.+\.rb})
8
- watch(%r{lib/.+\.rb})
9
- watch(%r{ext/.+\.c})
10
- end
11
-
12
- guard "rspec", cli: "--color --drb --drb-port 8991 --format Fuubar", all_on_start: false, all_after_pass: false, notification: false do
13
- watch(%r{^spec/acceptance/.+_spec\.rb$})
14
- watch(%r{^spec/unit/.+_spec\.rb$})
15
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
16
- watch("spec/spec_helper.rb") { "spec" }
17
- end
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
data/README.md DELETED
@@ -1,85 +0,0 @@
1
- # Solve
2
-
3
- [![Gem Version](http://img.shields.io/gem/v/solve.svg)][gem] [![Build Status](http://img.shields.io/travis/berkshelf/solve.svg)][travis]
4
-
5
- A Ruby versioning constraint solver implementing [Semantic Versioning 2.0.0](http://semver.org).
6
-
7
- ## Installation
8
-
9
- ```shell
10
- $ gem install solve
11
- ```
12
-
13
- ## Usage
14
-
15
- Create a new graph
16
-
17
- ```ruby
18
- graph = Solve::Graph.new
19
- ```
20
-
21
- Add an artifact to the graph
22
-
23
- ```ruby
24
- graph.artifact("nginx", "1.0.0")
25
- ```
26
-
27
- Now add another artifact that has a dependency
28
-
29
- ```ruby
30
- graph.artifact("mysql", "1.2.4-alpha.1").depends("openssl", "~> 1.0.0")
31
- ```
32
-
33
- Dependencies can be chained, too
34
-
35
- ```ruby
36
- graph.artifact("ntp", "1.0.0").depends("build-essential").depends("yum")
37
- ```
38
-
39
- And now solve the graph with some demands
40
-
41
- ```ruby
42
- Solve.it!(graph, [['nginx', '>= 0.100.0']])
43
- ```
44
-
45
- Or, if you want a topologically sorted solution NOTE: This will raise Solve::Errors::UnsortableSolutionError if the solution contains a cycle (which can happen with ruby packages)
46
-
47
- ```ruby
48
- Solve.it!(graph, [['nginx', '>= 0.100.0']], sorted: true)
49
- ```
50
-
51
- ### Selecting A Resolver
52
-
53
- Solve supports two different resolvers. A pure Ruby solver implemented using [Molinillo](https://github.com/CocoaPods/Molinillo) and the same dependency resolver the Chef Server uses, [dep-selector](https://github.com/chef/dep-selector), which is a Ruby C extension for [Gecode](https://github.com/ampl/gecode).
54
-
55
- You can set the resolver by calling `Solver.engine=` with the symbol `:ruby` or `:gecode`.
56
-
57
- ```ruby
58
- Solver.engine = :ruby
59
- Solver.engine = :gecode
60
- ```
61
-
62
- The Ruby solver is installed and enabled by default. If you'd like to use the Gecode solver you can do so by installing the dep-selector gem or adding it to your Gemfile:
63
-
64
- ```shell
65
- $ gem install dep_selector
66
- ```
67
-
68
- ### Increasing the solver's timeout
69
-
70
- By default the solver will wait 30 seconds before giving up on finding a solution. Under certain conditions a graph may be too complicated to solve within the alotted time. To increase the timeout you can set the "SOLVE_TIMEOUT" environment variable to the amount of seconds desired.
71
-
72
- ```shell
73
- $ export SOLVE_TIMEOUT=60
74
- ```
75
-
76
- This will set the timeout to 60 seconds instead of the default 30 seconds.
77
-
78
- ## Authors
79
-
80
- - [Jamie Winsor](https://github.com/reset) ([jamie@vialstudios.com](mailto:jamie@vialstudios.com))
81
- - [Andrew Garson](andrewGarson) ([agarson@riotgames.com](mailto:agarson@riotgames.com))
82
- - [Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](http://twitter.com/thibaudgg))
83
-
84
- [gem]: https://rubygems.org/gems/solve
85
- [travis]: http://travis-ci.org/berkshelf/solve
data/Rakefile DELETED
@@ -1,11 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
3
- begin
4
- require "chefstyle"
5
- require "rubocop/rake_task"
6
- RuboCop::RakeTask.new(:style) do |task|
7
- task.options += ["--display-cop-names", "--no-color"]
8
- end
9
- rescue LoadError
10
- puts "chefstyle/rubocop is not available. gem install chefstyle to do style checking."
11
- end
data/Thorfile DELETED
@@ -1,36 +0,0 @@
1
- # encoding: utf-8
2
- $:.push File.expand_path("../lib", __FILE__)
3
-
4
- require "bundler"
5
- require "bundler/setup"
6
- require "thor/rake_compat"
7
-
8
- class Default < Thor
9
- include Thor::RakeCompat
10
- Bundler::GemHelper.install_tasks
11
-
12
- desc "build", "Build Solve-#{Solve::VERSION}.gem into the pkg directory"
13
- def build
14
- Rake::Task["build"].invoke
15
- end
16
-
17
- desc "install", "Build and install Solve-#{Solve::VERSION}.gem into system gems"
18
- def install
19
- Rake::Task["install"].invoke
20
- end
21
-
22
- desc "release", "Create tag v#{Solve::VERSION} and build and push Solve-#{Solve::VERSION}.gem to Rubygems"
23
- def release
24
- Rake::Task["release"].invoke
25
- end
26
-
27
- desc "spec", "Run RSpec code examples"
28
- def spec
29
- exec "rspec --color --format=documentation spec"
30
- end
31
-
32
- desc "spec", "Run RSpec code examples"
33
- def nogecode_spec
34
- exec "rspec -t '~gecode' --color --format=documentation spec"
35
- end
36
- end
@@ -1,26 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path("../lib/solve/version", __FILE__)
3
-
4
- Gem::Specification.new do |s|
5
- s.authors = ["Jamie Winsor", "Andrew Garson", "Thibaud Guillaume-Gentil"]
6
- s.email = ["jamie@vialstudios.com", "agarson@riotgames.com", "thibaud@thibaud.me"]
7
- s.description = %q{A Ruby version constraint solver}
8
- s.summary = %q{A Ruby version constraint solver implementing Semantic Versioning 2.0.0-rc.1}
9
- s.homepage = "https://github.com/berkshelf/solve"
10
- s.license = "Apache 2.0"
11
- s.files = `git ls-files`.split($\)
12
- s.executables = s.files.grep(%r{^bin/}).map { |f| File.basename(f) }
13
- s.test_files = s.files.grep(%r{^spec/})
14
- s.name = "solve"
15
- s.require_paths = ["lib"]
16
- s.version = Solve::VERSION
17
- s.required_ruby_version = ">= 2.1.0"
18
-
19
- s.add_dependency "semverse", ">= 1.1", "< 3.0"
20
- s.add_dependency "molinillo", "~> 0.6"
21
-
22
- s.add_development_dependency "thor"
23
- s.add_development_dependency "rake"
24
- s.add_development_dependency "spork"
25
- s.add_development_dependency "rspec"
26
- end
@@ -1,59 +0,0 @@
1
- require "benchmark"
2
- require "solve"
3
- require "solve/gecode_solver"
4
- require File.expand_path("../large_graph_no_solution", __FILE__)
5
- require File.expand_path("../opscode_ci_graph", __FILE__)
6
-
7
- PROBLEM = OpscodeCiGraph
8
- #PROBLEM = LargeGraphNoSolution
9
- N = 100
10
-
11
- def demands
12
- PROBLEM::DEMANDS
13
- end
14
-
15
- def artifacts
16
- PROBLEM::ARTIFACTS
17
- end
18
-
19
- require "pp"
20
-
21
- def create_graph
22
- graph = Solve::Graph.new
23
- artifacts.each do |name, all_artifact_versions|
24
- all_artifact_versions.each do |artifact|
25
- graph.artifact(name, artifact[:version])
26
- artifact[:dependencies].each do |dep|
27
- dep_name, dep_constraint = dep
28
- graph.artifact(name, artifact[:version])
29
- .depends(dep_name, dep_constraint)
30
- end
31
- end
32
- end
33
-
34
- graph
35
- end
36
-
37
- STATIC_GRAPH = create_graph
38
-
39
- def solve_gecode
40
- Solve::GecodeSolver.new(STATIC_GRAPH, demands).resolve({})
41
- rescue Solve::Errors::NoSolutionError => e
42
- # Uncomment to look at the error messages. Probably only useful if N == 1
43
- #puts e
44
- e
45
- end
46
-
47
- def solve_ruby
48
- Solve::RubySolver.new(STATIC_GRAPH, demands).resolve({})
49
- rescue Solve::Errors::NoSolutionError => e
50
- # Uncomment to look at the error messages. Probably only useful if N == 1
51
- #puts e
52
- e
53
- end
54
-
55
- Benchmark.bm(12) do |x|
56
- x.report("Create graph") { N.times { create_graph } }
57
- x.report("Solve Gecode") { N.times { solve_gecode } }
58
- x.report("Solve Ruby") { N.times { solve_ruby } }
59
- end