scad_bundler 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 +7 -0
- data/.gitignore +8 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +22 -0
- data/LICENSE.txt +21 -0
- data/README.md +88 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/scad_bundle +49 -0
- data/bin/setup +8 -0
- data/lib/scad_bundler/version.rb +3 -0
- data/lib/scad_bundler.rb +5 -0
- data/scad_bundler.gemspec +25 -0
- metadata +73 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1304333190d408399a3a705c5e1185c7876b8d94804487a4187604545adb960b
|
4
|
+
data.tar.gz: 64dcf78eb0c410f83574ebfb6d29fc91028ac20e7f47e931a2ddc7b81873676a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ed938e5c2e190795c0be88e8e95a017f20833bc594958e74c54b99f2f2aabe247d1301c752aa1d5d978fba56fc2678dffcf529831cabd001678c847b9a65be95
|
7
|
+
data.tar.gz: b055b7aa77639fe1cc719a389374f07f595a07f8fc9fc34edc05e7ae194cc839f7b21b9c17e15b9113a53df03068443dce10240024cf71f1aefd041b12b71a5b
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
scad_bundler (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
minitest (5.11.1)
|
10
|
+
rake (10.5.0)
|
11
|
+
|
12
|
+
PLATFORMS
|
13
|
+
ruby
|
14
|
+
|
15
|
+
DEPENDENCIES
|
16
|
+
bundler (~> 1.16)
|
17
|
+
minitest (~> 5.0)
|
18
|
+
rake (~> 10.0)
|
19
|
+
scad_bundler!
|
20
|
+
|
21
|
+
BUNDLED WITH
|
22
|
+
1.16.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Joe Francis
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# scad_bundler
|
2
|
+
|
3
|
+
scad_bundler is a package manager for [OpenSCAD](http://openscad.org). It's based on [RubyGems](https://rubygems.org) and uses [Bundler](https://bundler.io) under the hood.
|
4
|
+
|
5
|
+
scad_bundler is a fully-featured package manager that:
|
6
|
+
|
7
|
+
* downloads and installs OpenSCAD libraries needed by your project
|
8
|
+
* resolves compatible versions of dependencies of your libraries
|
9
|
+
* modifies environment variables to tell OpenSCAD where to find your libraries
|
10
|
+
* is capable of downloading libraries directly GitHub, off rubygems.org, from a private repository, or local files on your computer
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
You will need to have Ruby and RubyGems installed to use scad_bundler.
|
15
|
+
|
16
|
+
Once RubyGems is installed, install `scad_bundler`:
|
17
|
+
|
18
|
+
$ gem install scad_bundler
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
Similar to how bundler works, scad_bundler dependencies are defined in a Scadfile and resolved versions are locked in a Scadfile.lock. To initialize your project and create and empty `Scadfile`
|
23
|
+
|
24
|
+
$ scad_bundle init
|
25
|
+
|
26
|
+
Dependencies can be declared inside your `scadfile` using bundler's [full capabilities](https://bundler.io/gemfile.html) for a Gemfile. FIXME: add a simple example, and go into how version constraints work.
|
27
|
+
|
28
|
+
Once your dependencies have been listed, you can install them via:
|
29
|
+
|
30
|
+
$ scad_bundle install
|
31
|
+
|
32
|
+
scad_bundler will then work out compatible versions of the libraries and install them on your system. Then to fire up OpenSCAD:
|
33
|
+
|
34
|
+
$ scad_bundle exec openscad
|
35
|
+
|
36
|
+
scad_bundler will then start `openscad` with the `OPENSCADPATH` environment set properly to use all of your libraries.
|
37
|
+
|
38
|
+
To upgrade libraries, simple call:
|
39
|
+
|
40
|
+
$ scad_bundle update
|
41
|
+
|
42
|
+
## Conventions and Best Practices for creating OpenSCAD Libraries
|
43
|
+
|
44
|
+
FIXME: explain how to create a library and what conventions is should follow.
|
45
|
+
|
46
|
+
## Motivation
|
47
|
+
|
48
|
+
The motivation for scad_bundler is simple - create a first-class package manager for OpenSCAD to help advance the entire OpenSCAD ecosystem.
|
49
|
+
|
50
|
+
Having a package manager is an essential feature of modern languages, and OpenSCAD should be no different. A really solid package manager will allow us to build up components and utilities to simplify designs, so that users need not choose between starting at zero and manually wrangling files from Thingiverse. Having this base of knowledge will also help the OpenSCAD community to better identify and codify best practices for sharing code and designing models.
|
51
|
+
|
52
|
+
That package manager needs to support versioning and version constraints, so that packages can evolve over time and ship breaking changes rather than stagnate on the first API to coalesce.
|
53
|
+
|
54
|
+
It is my hope that building this knowledge base will also help the community hash out common problems "in userspace" either completely or substantially, so that the scope of changes proposed for OpenSCAD itself can be smaller, more focused, and better tested than many proposals that come up now.
|
55
|
+
|
56
|
+
|
57
|
+
## FAQ
|
58
|
+
|
59
|
+
#### Why build on RubyGems and bundler?
|
60
|
+
|
61
|
+
RubyGems and bundler are a very stable base to build upon, and include very advanced support for specifying compatible library versions and then resolving those dependencies. Using this foundation is much more expedient than starting from scratch.
|
62
|
+
|
63
|
+
#### Why host openscad packages on rubygems.org?
|
64
|
+
|
65
|
+
Hosting a package repository is *hard* work and very security sensitive. Using another open source project's repository get us going from day one, and frees us from all of the infrastructure and security headaches hosting our own would entail. If you don't want to post your package as a gem on rubygems.org, it's perfectly fine to post it on github and direct people to use that. Long term, it would be ideal to host a separate package repository but there's nothing wrong with starting out like this.
|
66
|
+
|
67
|
+
#### Why pass library information via an environment variable?
|
68
|
+
|
69
|
+
The initial goal of scad_bundler was to create a package manager that worked without requiring any modifications to OpenSCAD. Long-term, we would love to integrate more tightly with OpenSCAD, but this absolutely works for now.
|
70
|
+
|
71
|
+
## Contributing
|
72
|
+
|
73
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/lostapathy/scad_bundler.
|
74
|
+
|
75
|
+
## TODO
|
76
|
+
|
77
|
+
* Better docs on how to package a new library
|
78
|
+
* Completely abstract away the fact that this is ruby-based over the long-term.
|
79
|
+
* Change the 'gem' declaration in Scadfile to something that isn't a ruby-centric.
|
80
|
+
* Decouple us from the 'gemspec' format. In a perfect world, we'd have our own simplified package format that generated all the extra stuff RubyGems needs but scad_bundler does not. It would also apply some conventions and best practices to the libraries to make other goals easier to accomplish.
|
81
|
+
* Long term, create an alternate package repository from RubyGems.org that only lists OpenSCAD packages and adds functionality more applicable to 3d modeling.
|
82
|
+
* Figure out a cleaner way to integrate this with OpenSCAD than just setting an environment variable on OpenSCAD startup.
|
83
|
+
* Better define what features we could add to OpenSCAD to better support libraries (i.e., namespacing support).
|
84
|
+
* Provide a hook in the library spec to specify a minimum OpenSCAD version to use the library.
|
85
|
+
|
86
|
+
## License
|
87
|
+
|
88
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "scad_bundler"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/scad_bundle
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Use Scadfile instead of Gemfile
|
5
|
+
# FIXME: could this be done in a less hacked way?
|
6
|
+
ENV['BUNDLE_GEMFILE'] = 'Scadfile'
|
7
|
+
|
8
|
+
require 'bundler'
|
9
|
+
require 'shellwords'
|
10
|
+
|
11
|
+
|
12
|
+
# FIXME: ideally we would delegate this all directly to bundler
|
13
|
+
# We do want to wrap bundler and not just use it directly, to limit
|
14
|
+
# what aspects of bundler are exposed and keep our options open for
|
15
|
+
# different implementations later.
|
16
|
+
command = ARGV.shift
|
17
|
+
|
18
|
+
if command != 'init' && ! File.exists?('Scadfile')
|
19
|
+
puts 'Could not find Scadfile'
|
20
|
+
exit(1)
|
21
|
+
end
|
22
|
+
|
23
|
+
case command
|
24
|
+
when 'init'
|
25
|
+
# Setup new Scadfile
|
26
|
+
if File.exists?('Scadfile')
|
27
|
+
puts 'Scadfile already exists!'
|
28
|
+
exit(1)
|
29
|
+
end
|
30
|
+
|
31
|
+
File.open('Scadfile', 'w') { |file| file.write("source \"https://rubygems.org\"\n\n# gem 'openscad_util', git: 'https://github.com/lostapathy/openscad-libs'\n") }
|
32
|
+
when 'exec'
|
33
|
+
# Run the specified command with OPENSCADPATH set in the environment
|
34
|
+
specs = Bundler.load.specs.reject {|s| s.name == "bundler" }.sort_by(&:name)
|
35
|
+
lib_paths = specs.map { |spec| spec.full_gem_path }
|
36
|
+
env = {'OPENSCADPATH' => lib_paths.join(':')}
|
37
|
+
|
38
|
+
args = ARGV.map { |x| Shellwords.escape(x) }
|
39
|
+
exec( env, args.join(' ') )
|
40
|
+
when 'update'
|
41
|
+
# Update packages
|
42
|
+
exec( { 'BUNDLE_GEMFILE' => 'Scadfile' }, %w[bundle update])
|
43
|
+
when 'install'
|
44
|
+
# Install packages
|
45
|
+
exec( { 'BUNDLE_GEMFILE' => 'Scadfile' }, %w[bundle install])
|
46
|
+
else
|
47
|
+
puts "Invalid command: #{command}"
|
48
|
+
exit(1)
|
49
|
+
end
|
data/bin/setup
ADDED
data/lib/scad_bundler.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "scad_bundler/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "scad_bundler"
|
8
|
+
spec.version = ScadBundler::VERSION
|
9
|
+
spec.authors = ["Joe Francis"]
|
10
|
+
spec.email = ["joe@lostapathy.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{A package manager for OpenSCAD}
|
13
|
+
spec.description = %q{A package manager that leverages the power of RubyGems to package OpenSCAD libraries.}
|
14
|
+
spec.homepage = "https://github.com/lostapathy/scad_bundler"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
#spec.bindir = "exe"
|
21
|
+
spec.executables = ['scad_bundle']
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: scad_bundler
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Joe Francis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-03-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
description: A package manager that leverages the power of RubyGems to package OpenSCAD
|
28
|
+
libraries.
|
29
|
+
email:
|
30
|
+
- joe@lostapathy.com
|
31
|
+
executables:
|
32
|
+
- scad_bundle
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- ".gitignore"
|
37
|
+
- ".travis.yml"
|
38
|
+
- Gemfile
|
39
|
+
- Gemfile.lock
|
40
|
+
- LICENSE.txt
|
41
|
+
- README.md
|
42
|
+
- Rakefile
|
43
|
+
- bin/console
|
44
|
+
- bin/scad_bundle
|
45
|
+
- bin/setup
|
46
|
+
- lib/scad_bundler.rb
|
47
|
+
- lib/scad_bundler/version.rb
|
48
|
+
- scad_bundler.gemspec
|
49
|
+
homepage: https://github.com/lostapathy/scad_bundler
|
50
|
+
licenses:
|
51
|
+
- MIT
|
52
|
+
metadata: {}
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
requirements: []
|
68
|
+
rubyforge_project:
|
69
|
+
rubygems_version: 2.7.3
|
70
|
+
signing_key:
|
71
|
+
specification_version: 4
|
72
|
+
summary: A package manager for OpenSCAD
|
73
|
+
test_files: []
|