elm_install 0.3.1 → 1.0.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 +4 -4
- data/.reek +4 -0
- data/.rspec +1 -0
- data/.rubocop.yml +4 -0
- data/Gemfile.lock +30 -25
- data/Rakefile +2 -2
- data/Readme.md +85 -23
- data/bin/elm-install +5 -2
- data/elm_install.gemspec +2 -0
- data/lib/elm_install.rb +18 -1
- data/lib/elm_install/base.rb +3 -46
- data/lib/elm_install/dependency.rb +37 -0
- data/lib/elm_install/directory_source.rb +66 -0
- data/lib/elm_install/ext.rb +23 -0
- data/lib/elm_install/git_source.rb +173 -0
- data/lib/elm_install/identifier.rb +133 -0
- data/lib/elm_install/installer.rb +38 -96
- data/lib/elm_install/populator.rb +54 -75
- data/lib/elm_install/repository.rb +82 -0
- data/lib/elm_install/resolver.rb +48 -118
- data/lib/elm_install/source.rb +18 -0
- data/lib/elm_install/types.rb +43 -0
- data/lib/elm_install/utils.rb +14 -20
- data/lib/elm_install/version.rb +1 -1
- data/package.json +1 -1
- data/packaging/Gemfile +1 -1
- data/packaging/Gemfile.lock +8 -4
- data/scripts/install.js +4 -4
- data/scripts/run.js +4 -4
- data/spec/directory_source_spec.rb +37 -0
- data/spec/{eml_install_spec.rb → elm_install_spec.rb} +6 -3
- data/spec/git_source_spec.rb +115 -0
- data/spec/identifer_spec.rb +53 -0
- data/spec/installer_spec.rb +57 -26
- data/spec/repository_spec.rb +44 -0
- data/spec/resolver_spec.rb +0 -73
- data/spec/spec_helper.rb +3 -1
- data/spec/utils_spec.rb +10 -15
- metadata +43 -17
- data/docs/How it works.md +0 -54
- data/lib/elm_install/cache.rb +0 -52
- data/lib/elm_install/elm_package.rb +0 -119
- data/lib/elm_install/git_resolver.rb +0 -129
- data/lib/elm_install/graph_builder.rb +0 -73
- data/spec/elm_package_spec.rb +0 -73
- data/spec/fixtures/cache.json +0 -8
- data/spec/fixtures/elm-package.json +0 -12
- data/spec/fixtures/invalid-elm-package.json +0 -6
- data/spec/fixtures/mismatched-elm-package.json +0 -9
- data/spec/fixtures/ref-cache.json +0 -4
- data/spec/git_resolver_spec.rb +0 -103
- data/spec/graph_builder_spec.rb +0 -36
- data/spec/populator_spec.rb +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 135de9d0626d6405f8a3d794d61c61df46a82691
|
4
|
+
data.tar.gz: 7b19ca3f3f7ccdb6f08bcfc25173ffe6eacb5e4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2cec562fdb050f6d5094b734fd6a1bd9af060770ff4e6d8acbc63ac5bf7d5ba925084a8b52d42c4ca8498e1b87bae30959e474977837f97d0487b3311bc7224
|
7
|
+
data.tar.gz: 72c6dcbb7b493af368540289eb996e6ccd36239072b0aed5f090578b33d874858714ce7f366fb01e221088430717b9e2e081ccc3a6edf09cd6fe83c902dcd181
|
data/.reek
CHANGED
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
elm_install (0.
|
4
|
+
elm_install (1.0.0)
|
5
|
+
adts (~> 0.1.2)
|
5
6
|
commander (~> 4.4, >= 4.4.2)
|
7
|
+
contracts (~> 0.16.0)
|
6
8
|
git (~> 1.3)
|
7
9
|
git_clone_url (~> 2.0)
|
8
10
|
hashdiff (~> 0.3.1)
|
@@ -13,8 +15,9 @@ PATH
|
|
13
15
|
GEM
|
14
16
|
remote: https://rubygems.org/
|
15
17
|
specs:
|
16
|
-
addressable (2.5.
|
18
|
+
addressable (2.5.1)
|
17
19
|
public_suffix (~> 2.0, >= 2.0.2)
|
20
|
+
adts (0.1.2)
|
18
21
|
ast (2.3.0)
|
19
22
|
axiom-types (0.1.1)
|
20
23
|
descendants_tracker (~> 0.0.4)
|
@@ -22,32 +25,33 @@ GEM
|
|
22
25
|
thread_safe (~> 0.3, >= 0.3.1)
|
23
26
|
codeclimate-engine-rb (0.4.0)
|
24
27
|
virtus (~> 1.0)
|
25
|
-
codeclimate-test-reporter (1.0.
|
26
|
-
simplecov
|
28
|
+
codeclimate-test-reporter (1.0.8)
|
29
|
+
simplecov (<= 0.13)
|
27
30
|
coderay (1.1.1)
|
28
31
|
coercible (1.0.0)
|
29
32
|
descendants_tracker (~> 0.0.1)
|
30
|
-
commander (4.4.
|
33
|
+
commander (4.4.3)
|
31
34
|
highline (~> 1.7.2)
|
35
|
+
contracts (0.16.0)
|
32
36
|
descendants_tracker (0.0.4)
|
33
37
|
thread_safe (~> 0.3, >= 0.3.1)
|
34
|
-
diff-lcs (1.
|
38
|
+
diff-lcs (1.3)
|
35
39
|
docile (1.1.5)
|
36
40
|
equalizer (0.0.11)
|
37
41
|
erubis (2.7.0)
|
38
|
-
flay (2.
|
42
|
+
flay (2.9.0)
|
39
43
|
erubis (~> 2.7.0)
|
40
44
|
path_expander (~> 1.0)
|
41
45
|
ruby_parser (~> 3.0)
|
42
46
|
sexp_processor (~> 4.0)
|
43
|
-
flog (4.
|
47
|
+
flog (4.6.1)
|
44
48
|
path_expander (~> 1.0)
|
45
49
|
ruby_parser (~> 3.1, > 3.1.0)
|
46
|
-
sexp_processor (~> 4.
|
50
|
+
sexp_processor (~> 4.8)
|
47
51
|
git (1.3.0)
|
48
52
|
git_clone_url (2.0.0)
|
49
53
|
uri-ssh_git (>= 2.0)
|
50
|
-
hashdiff (0.3.
|
54
|
+
hashdiff (0.3.4)
|
51
55
|
highline (1.7.8)
|
52
56
|
ice_nine (0.11.2)
|
53
57
|
inch (0.7.1)
|
@@ -56,12 +60,12 @@ GEM
|
|
56
60
|
term-ansicolor
|
57
61
|
yard (~> 0.8.7.5)
|
58
62
|
indentation (0.1.1)
|
59
|
-
json (2.0
|
63
|
+
json (2.1.0)
|
60
64
|
launchy (2.4.3)
|
61
65
|
addressable (~> 2.3)
|
62
66
|
method_source (0.8.2)
|
63
|
-
molinillo (0.5.
|
64
|
-
parser (2.
|
67
|
+
molinillo (0.5.7)
|
68
|
+
parser (2.4.0.0)
|
65
69
|
ast (~> 2.2)
|
66
70
|
path_expander (1.0.1)
|
67
71
|
powerpack (0.1.1)
|
@@ -69,12 +73,13 @@ GEM
|
|
69
73
|
coderay (~> 1.1.0)
|
70
74
|
method_source (~> 0.8.1)
|
71
75
|
slop (~> 3.4)
|
72
|
-
public_suffix (2.0.
|
73
|
-
rainbow (2.
|
76
|
+
public_suffix (2.0.5)
|
77
|
+
rainbow (2.2.2)
|
78
|
+
rake
|
74
79
|
rake (12.0.0)
|
75
|
-
reek (4.
|
80
|
+
reek (4.6.2)
|
76
81
|
codeclimate-engine-rb (~> 0.4.0)
|
77
|
-
parser (
|
82
|
+
parser (>= 2.4.0.0, < 2.5)
|
78
83
|
rainbow (~> 2.0)
|
79
84
|
rspec (3.5.0)
|
80
85
|
rspec-core (~> 3.5.0)
|
@@ -96,19 +101,19 @@ GEM
|
|
96
101
|
ruby-progressbar (~> 1.7)
|
97
102
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
98
103
|
ruby-progressbar (1.8.1)
|
99
|
-
ruby_parser (3.
|
104
|
+
ruby_parser (3.9.0)
|
100
105
|
sexp_processor (~> 4.1)
|
101
|
-
rubycritic (3.
|
106
|
+
rubycritic (3.2.0)
|
102
107
|
flay (~> 2.8)
|
103
108
|
flog (~> 4.4)
|
104
109
|
launchy (= 2.4.3)
|
105
|
-
parser (= 2.
|
110
|
+
parser (= 2.4.0)
|
106
111
|
rainbow (~> 2.1)
|
107
112
|
reek (~> 4.4)
|
108
113
|
ruby_parser (~> 3.8)
|
109
114
|
virtus (~> 1.0)
|
110
115
|
semverse (2.0.0)
|
111
|
-
sexp_processor (4.
|
116
|
+
sexp_processor (4.9.0)
|
112
117
|
simplecov (0.12.0)
|
113
118
|
docile (~> 1.1.0)
|
114
119
|
json (>= 1.8, < 3)
|
@@ -120,11 +125,11 @@ GEM
|
|
120
125
|
molinillo (>= 0.5)
|
121
126
|
semverse (>= 1.1, < 3.0)
|
122
127
|
sparkr (0.4.1)
|
123
|
-
term-ansicolor (1.
|
128
|
+
term-ansicolor (1.6.0)
|
124
129
|
tins (~> 1.0)
|
125
|
-
thread_safe (0.3.
|
126
|
-
tins (1.13.
|
127
|
-
unicode-display_width (1.1
|
130
|
+
thread_safe (0.3.6)
|
131
|
+
tins (1.13.2)
|
132
|
+
unicode-display_width (1.2.1)
|
128
133
|
uri-ssh_git (2.0.0)
|
129
134
|
virtus (1.0.5)
|
130
135
|
axiom-types (~> 0.1)
|
data/Rakefile
CHANGED
data/Readme.md
CHANGED
@@ -7,10 +7,12 @@
|
|
7
7
|
[](http://inch-ci.org/github/gdotdesign/elm-github-install)
|
8
8
|
[](https://travis-ci.org/gdotdesign/elm-github-install)
|
9
9
|
|
10
|
-
This gem allows you to install Elm packages **
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
This gem/npm-package allows you to install Elm packages **in a decentralized way from Git repositories**, this allows:
|
11
|
+
* installing of **effect manager** and **native** packages
|
12
|
+
* installing **forks of packages** for testing or unreleased features
|
13
|
+
* using packages from **local directories**
|
14
|
+
* installing **private packages** using private git repositories
|
15
|
+
* installing packages **offline** (packages are cached)
|
14
16
|
|
15
17
|
## Installation
|
16
18
|
|
@@ -58,27 +60,39 @@ Resolving packages...
|
|
58
60
|
▶ Package: https://github.com/elm-lang/virtual-dom not found in cache, cloning...
|
59
61
|
▶ Package: https://github.com/elm-lang/dom not found in cache, cloning...
|
60
62
|
Solving dependencies...
|
61
|
-
|
62
|
-
● elm-lang/
|
63
|
-
● elm-lang/
|
64
|
-
● elm-lang/
|
65
|
-
● elm-lang/
|
66
|
-
● elm-lang/virtual-dom - 2.0.3 (2.0.3)
|
63
|
+
● elm-lang/core - https://github.com/elm-lang/core (5.1.1)
|
64
|
+
● elm-lang/svg - https://github.com/elm-lang/svg (2.0.0)
|
65
|
+
● elm-lang/dom - https://github.com/elm-lang/dom (1.1.1)
|
66
|
+
● elm-lang/html - https://github.com/elm-lang/html (2.0.0)
|
67
|
+
● elm-lang/virtual-dom - https://github.com/elm-lang/virtual-dom (2.0.4)
|
67
68
|
Packages configured successfully!
|
68
69
|
```
|
69
70
|
|
70
71
|
## Advanced Usage
|
71
|
-
Sources
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
72
|
+
Sources can be defined in the `dependency-sources` field in `elm-package.json`
|
73
|
+
for any package defined in the `dependencies` field.
|
74
|
+
|
75
|
+
The source can be defined as:
|
76
|
+
* an URL pointing to a Git repository:
|
77
|
+
```
|
78
|
+
"elm-lang/core": "git@github.com:someuser/core"
|
79
|
+
```
|
80
|
+
* a hash containing the URL and the reference (tag, commit hash, branch) to use:
|
81
|
+
```
|
82
|
+
"gdotdesign/elm-install-test": {
|
83
|
+
"url": "gdotdesign@bitbucket.org:gdotdesign/elm-install-test",
|
84
|
+
"ref": "master"
|
85
|
+
}
|
86
|
+
```
|
87
|
+
* an absolute or relative path to the package in your hard drive:
|
88
|
+
```
|
89
|
+
"elm-lang/dom": "../elm-lang/dom"
|
90
|
+
```
|
76
91
|
|
77
|
-
|
78
|
-
|
79
|
-
the version in the `dependencies` field is ignored and the **version will be
|
80
|
-
used from the `elm-package.json` at that reference**.
|
92
|
+
If a reference or a path is defined then the version in the `dependencies` field is
|
93
|
+
ignored and the **version will be used from the `elm-package.json` at that source**.
|
81
94
|
|
95
|
+
Examples:
|
82
96
|
```
|
83
97
|
...
|
84
98
|
"dependencies": {
|
@@ -88,7 +102,8 @@ used from the `elm-package.json` at that reference**.
|
|
88
102
|
"elm-lang/dom": "1.1.1 <= v < 2.0.0"
|
89
103
|
},
|
90
104
|
"dependency-sources": {
|
91
|
-
"elm-lang/core": "git@github.com:
|
105
|
+
"elm-lang/core": "git@github.com:someuser/core",
|
106
|
+
"elm-lang/dom": "../elm-lang/dom",
|
92
107
|
"gdotdesign/elm-install-test": {
|
93
108
|
"url": "gdotdesign@bitbucket.org:gdotdesign/elm-install-test",
|
94
109
|
"ref": "master"
|
@@ -97,6 +112,56 @@ used from the `elm-package.json` at that reference**.
|
|
97
112
|
...
|
98
113
|
```
|
99
114
|
|
115
|
+
### CLI
|
116
|
+
Help for the `elm-install` command:
|
117
|
+
```
|
118
|
+
NAME:
|
119
|
+
|
120
|
+
elm-install
|
121
|
+
|
122
|
+
DESCRIPTION:
|
123
|
+
|
124
|
+
Install Elm packages from Git repositories.
|
125
|
+
|
126
|
+
COMMANDS:
|
127
|
+
|
128
|
+
help Display global or [command] help documentation
|
129
|
+
install Install Elm packages from the elm-package.json file.
|
130
|
+
|
131
|
+
GLOBAL OPTIONS:
|
132
|
+
|
133
|
+
-h, --help
|
134
|
+
Display help documentation
|
135
|
+
|
136
|
+
-v, --version
|
137
|
+
Display version information
|
138
|
+
|
139
|
+
-t, --trace
|
140
|
+
Display backtrace when an error occurs
|
141
|
+
```
|
142
|
+
|
143
|
+
Help for the `elm-install install` command.
|
144
|
+
```
|
145
|
+
NAME:
|
146
|
+
|
147
|
+
install
|
148
|
+
|
149
|
+
SYNOPSIS:
|
150
|
+
|
151
|
+
elm-install install
|
152
|
+
|
153
|
+
DESCRIPTION:
|
154
|
+
|
155
|
+
Install Elm packages from the elm-package.json file.
|
156
|
+
|
157
|
+
OPTIONS:
|
158
|
+
|
159
|
+
--cache-directory STRING
|
160
|
+
Specifies where the cache is stored
|
161
|
+
|
162
|
+
--verbose
|
163
|
+
```
|
164
|
+
|
100
165
|
## FAQ
|
101
166
|
|
102
167
|
#### Do I need to use SSH keys?
|
@@ -115,6 +180,3 @@ The following protocols can be used:
|
|
115
180
|
#### Can I install from private repositories?
|
116
181
|
Yes private repositories are supported provided you have authentication
|
117
182
|
(for example SSH keys).
|
118
|
-
|
119
|
-
## How is it work exactly?
|
120
|
-
You can read more about it [here](docs/How it works.md).
|
data/bin/elm-install
CHANGED
@@ -15,8 +15,11 @@ command :install do |c|
|
|
15
15
|
'Specifies where the cache is stored'
|
16
16
|
c.option '--verbose'
|
17
17
|
c.action do |_args, options|
|
18
|
-
ElmInstall.install
|
19
|
-
|
18
|
+
ElmInstall.install(
|
19
|
+
verbose: options.verbose,
|
20
|
+
cache_directory: options.cache_directory ||
|
21
|
+
File.join(Dir.home, '.elm-install')
|
22
|
+
)
|
20
23
|
end
|
21
24
|
end
|
22
25
|
|
data/elm_install.gemspec
CHANGED
@@ -25,6 +25,8 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_dependency 'smart_colored', '~> 1.1', '>= 1.1.1'
|
26
26
|
s.add_dependency 'hashdiff', '~> 0.3.1'
|
27
27
|
s.add_dependency 'indentation', '~> 0.1.1'
|
28
|
+
s.add_dependency 'contracts', '~> 0.16.0'
|
29
|
+
s.add_dependency 'adts', '~> 0.1.2'
|
28
30
|
|
29
31
|
s.extra_rdoc_files = ['Readme.md']
|
30
32
|
end
|
data/lib/elm_install.rb
CHANGED
@@ -3,12 +3,29 @@ require 'git_clone_url'
|
|
3
3
|
require 'forwardable'
|
4
4
|
require 'indentation'
|
5
5
|
require 'fileutils'
|
6
|
+
require 'contracts'
|
6
7
|
require 'hashdiff'
|
7
|
-
require 'solve'
|
8
8
|
require 'json'
|
9
|
+
require 'adts'
|
9
10
|
require 'git'
|
10
11
|
|
12
|
+
require 'solve/constraint'
|
13
|
+
require 'solve'
|
14
|
+
|
11
15
|
require_relative './elm_install/version'
|
16
|
+
require_relative './elm_install/utils'
|
17
|
+
require_relative './elm_install/logger'
|
18
|
+
require_relative './elm_install/ext'
|
19
|
+
require_relative './elm_install/base'
|
20
|
+
require_relative './elm_install/types'
|
21
|
+
require_relative './elm_install/source'
|
22
|
+
require_relative './elm_install/directory_source'
|
23
|
+
require_relative './elm_install/repository'
|
24
|
+
require_relative './elm_install/git_source'
|
25
|
+
require_relative './elm_install/dependency'
|
26
|
+
require_relative './elm_install/identifier'
|
27
|
+
require_relative './elm_install/resolver'
|
28
|
+
require_relative './elm_install/populator'
|
12
29
|
require_relative './elm_install/installer'
|
13
30
|
|
14
31
|
# The main module for the gem.
|
data/lib/elm_install/base.rb
CHANGED
@@ -1,50 +1,7 @@
|
|
1
1
|
module ElmInstall
|
2
|
-
#
|
2
|
+
# Base class that contains contracts.
|
3
3
|
class Base
|
4
|
-
|
5
|
-
|
6
|
-
# @return [Hash] The current cache
|
7
|
-
attr_reader :cache
|
8
|
-
|
9
|
-
def_delegators :@cache, :each, :key?
|
10
|
-
|
11
|
-
# Initializes a new base for a cache.
|
12
|
-
#
|
13
|
-
# @param options [Hash] The options
|
14
|
-
def initialize(options = {})
|
15
|
-
@options = options
|
16
|
-
@cache = {}
|
17
|
-
load
|
18
|
-
end
|
19
|
-
|
20
|
-
# Saves the cache into the json file.
|
21
|
-
#
|
22
|
-
# @return [void]
|
23
|
-
def save
|
24
|
-
File.binwrite(file, JSON.pretty_generate(@cache))
|
25
|
-
end
|
26
|
-
|
27
|
-
# Loads a cache from the json file.
|
28
|
-
#
|
29
|
-
# @return [void]
|
30
|
-
def load
|
31
|
-
@cache = JSON.parse(File.read(file))
|
32
|
-
rescue
|
33
|
-
@cache = {}
|
34
|
-
end
|
35
|
-
|
36
|
-
# Returns the patch of the cache file.
|
37
|
-
#
|
38
|
-
# @return [String] The path
|
39
|
-
def file
|
40
|
-
File.join(directory, @file)
|
41
|
-
end
|
42
|
-
|
43
|
-
# Returns the path of the directory where the cache is stored.
|
44
|
-
#
|
45
|
-
# @return [String] The path
|
46
|
-
def directory
|
47
|
-
@options[:directory]
|
48
|
-
end
|
4
|
+
include Contracts::Core
|
5
|
+
include Contracts::Builtin
|
49
6
|
end
|
50
7
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module ElmInstall
|
2
|
+
# Represents a dependency
|
3
|
+
class Dependency < Base
|
4
|
+
extend Forwardable
|
5
|
+
|
6
|
+
# @return [Array] The constraints for the dependency
|
7
|
+
attr_reader :constraints
|
8
|
+
|
9
|
+
# @overload version
|
10
|
+
# @return [Semverse::Version] The version
|
11
|
+
# @overload version=(value)
|
12
|
+
# Sets the version
|
13
|
+
# @param [Semverse::Version] The version
|
14
|
+
attr_accessor :version
|
15
|
+
|
16
|
+
# @return [Source] The source to use for resolving (Git, Directory)
|
17
|
+
attr_reader :source
|
18
|
+
|
19
|
+
# @return [String] The name of the dependency
|
20
|
+
attr_reader :name
|
21
|
+
|
22
|
+
Contract String, Source, ArrayOf[Solve::Constraint] => Dependency
|
23
|
+
# Initializes a new dependency.
|
24
|
+
#
|
25
|
+
# @param constraints [Array<Solve::Constraint>] The contraints
|
26
|
+
# @param source [Source] The source
|
27
|
+
# @param name [String] The name
|
28
|
+
#
|
29
|
+
# @return [Dependency] The dependency instance
|
30
|
+
def initialize(name, source, constraints)
|
31
|
+
@constraints = constraints
|
32
|
+
@source = source
|
33
|
+
@name = name
|
34
|
+
self
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|