elm_install 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -3
- data/Gemfile.lock +1 -1
- data/Readme.md +6 -0
- data/bin/elm-install +4 -0
- data/lib/elm_install/git_source.rb +10 -4
- data/lib/elm_install/installer.rb +3 -1
- data/lib/elm_install/repository.rb +21 -12
- data/lib/elm_install/resolver.rb +10 -3
- data/lib/elm_install/version.rb +1 -1
- data/package.json +1 -1
- data/packaging/Gemfile +1 -1
- data/packaging/Gemfile.lock +2 -2
- data/spec/git_source_spec.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bf6faaacd71f18c899968687b3075919b8a100f
|
4
|
+
data.tar.gz: 03225cc158d380f2fcfc0f6d46d77cab10eec11f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0be587f84093f0166054966faee8865063e239973c33d92a71c82b3cefb56058ad8855975e8825bde2abdea80d4172ed0f56c254779bbc0819c07418f85c7554
|
7
|
+
data.tar.gz: d960525811786839601e2ad9616cf64cb334b8e4fd1ecab6952200ba0917f0175ce978e9abade0ca1d9c5fb4fa1e0f1acea5b9b8b7364cf898525a488a3e0ca3
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
data/Readme.md
CHANGED
data/bin/elm-install
CHANGED
@@ -13,10 +13,14 @@ command :install do |c|
|
|
13
13
|
c.summary = 'Install Elm packages from the elm-package.json file.'
|
14
14
|
c.option '--cache-directory STRING', String,
|
15
15
|
'Specifies where the cache is stored'
|
16
|
+
c.option '--skip-update', 'Skips the update stage of packages'
|
17
|
+
c.option '--only-update STRING', 'Only updates the given package'
|
16
18
|
c.option '--verbose'
|
17
19
|
c.action do |_args, options|
|
18
20
|
ElmInstall.install(
|
19
21
|
verbose: options.verbose,
|
22
|
+
skip_update: options.skip_update,
|
23
|
+
only_update: options.only_update,
|
20
24
|
cache_directory: options.cache_directory ||
|
21
25
|
File.join(Dir.home, '.elm-install')
|
22
26
|
)
|
@@ -80,15 +80,21 @@ module ElmInstall
|
|
80
80
|
@@elm_versions[url][ref] ||= identifier.elm_version(fetch(ref))
|
81
81
|
end
|
82
82
|
|
83
|
-
Contract ArrayOf[Solve::Constraint],
|
83
|
+
Contract ArrayOf[Solve::Constraint],
|
84
|
+
String,
|
85
|
+
Bool,
|
86
|
+
Or[String, NilClass] => ArrayOf[Semverse::Version]
|
84
87
|
# Returns the available versions for a repository
|
85
88
|
#
|
86
89
|
# @param constraints [Array] The constraints
|
87
90
|
# @param elm_version [String] The Elm version to match against
|
88
91
|
#
|
89
92
|
# @return [Array] The versions
|
90
|
-
def versions(constraints, elm_version)
|
91
|
-
if repository.cloned? &&
|
93
|
+
def versions(constraints, elm_version, should_update, only_update)
|
94
|
+
if repository.cloned? &&
|
95
|
+
!repository.fetched &&
|
96
|
+
should_update &&
|
97
|
+
(!only_update || only_update == package_name)
|
92
98
|
# Get updates from upstream
|
93
99
|
Logger.arrow "Getting updates for: #{package_name.bold}"
|
94
100
|
repository.fetch
|
@@ -167,7 +173,7 @@ module ElmInstall
|
|
167
173
|
#
|
168
174
|
# @return [Repository] The repository
|
169
175
|
def repository
|
170
|
-
@repository ||= Repository.
|
176
|
+
@repository ||= Repository.of url, path
|
171
177
|
end
|
172
178
|
|
173
179
|
Contract None => Or[String, NilClass]
|
@@ -2,6 +2,8 @@ module ElmInstall
|
|
2
2
|
# Installer class
|
3
3
|
class Installer < Base
|
4
4
|
Contract KeywordArgs[cache_directory: Or[String, NilClass],
|
5
|
+
skip_update: Or[Bool, NilClass],
|
6
|
+
only_update: Or[String, NilClass],
|
5
7
|
verbose: Or[Bool, NilClass]] => Installer
|
6
8
|
# Initializes an installer with the given options
|
7
9
|
#
|
@@ -10,7 +12,7 @@ module ElmInstall
|
|
10
12
|
# @return [Installer] The installer instance
|
11
13
|
def initialize(options = {})
|
12
14
|
@identifier = Identifier.new Dir.new(Dir.pwd), options
|
13
|
-
@resolver = Resolver.new @identifier
|
15
|
+
@resolver = Resolver.new @identifier, options
|
14
16
|
self
|
15
17
|
end
|
16
18
|
|
@@ -11,7 +11,21 @@ module ElmInstall
|
|
11
11
|
# @return [String]
|
12
12
|
attr_reader :path
|
13
13
|
|
14
|
-
|
14
|
+
# Whether or not the repository has been fetched (updated)
|
15
|
+
# @return [Bool]
|
16
|
+
attr_reader :fetched
|
17
|
+
|
18
|
+
Contract String, String => Repository
|
19
|
+
# Returns the repository for the given url and path
|
20
|
+
#
|
21
|
+
# @param url [String] The url
|
22
|
+
# @param path [String] The path
|
23
|
+
#
|
24
|
+
# @return [Repository] The repository
|
25
|
+
def self.of(url, path)
|
26
|
+
@repositories ||= {}
|
27
|
+
@repositories[url] ||= new url, path
|
28
|
+
end
|
15
29
|
|
16
30
|
Contract String, String => Repository
|
17
31
|
# Initializes a repository.
|
@@ -21,6 +35,7 @@ module ElmInstall
|
|
21
35
|
#
|
22
36
|
# @return [Repository] The repository instance
|
23
37
|
def initialize(url, path)
|
38
|
+
@fetched = false
|
24
39
|
@path = path
|
25
40
|
@url = url
|
26
41
|
self
|
@@ -51,7 +66,8 @@ module ElmInstall
|
|
51
66
|
#
|
52
67
|
# @return [Array<Semverse::Version>] The versions
|
53
68
|
def versions
|
54
|
-
|
69
|
+
@versions ||=
|
70
|
+
repo
|
55
71
|
.tags
|
56
72
|
.map(&:name)
|
57
73
|
.select { |tag| tag =~ /(.*\..*\..*)/ }
|
@@ -77,20 +93,13 @@ module ElmInstall
|
|
77
93
|
Dir.exist?(path)
|
78
94
|
end
|
79
95
|
|
80
|
-
# Returns if the repository has been fetched yet or not.
|
81
|
-
#
|
82
|
-
# @return [Bool]
|
83
|
-
def fetched?
|
84
|
-
@@fetched.key?(url)
|
85
|
-
end
|
86
|
-
|
87
96
|
# Fetches changes from a repository
|
88
97
|
#
|
89
98
|
# @return [Void]
|
90
99
|
def fetch
|
91
|
-
return if fetched
|
100
|
+
return if fetched
|
92
101
|
repo.fetch
|
93
|
-
|
102
|
+
@fetched = true
|
94
103
|
end
|
95
104
|
|
96
105
|
Contract None => Git::Base
|
@@ -100,7 +109,7 @@ module ElmInstall
|
|
100
109
|
def clone
|
101
110
|
Logger.arrow "Package: #{url.bold} not found in cache, cloning..."
|
102
111
|
FileUtils.mkdir_p path
|
103
|
-
|
112
|
+
@fetched = true
|
104
113
|
@repo = Git.clone(url, path)
|
105
114
|
end
|
106
115
|
end
|
data/lib/elm_install/resolver.rb
CHANGED
@@ -4,16 +4,18 @@ module ElmInstall
|
|
4
4
|
# @return [Array<Dependency>] The dependencies
|
5
5
|
attr_reader :dependencies
|
6
6
|
|
7
|
-
Contract Identifier => Resolver
|
7
|
+
Contract Identifier, Hash => Resolver
|
8
8
|
# Initializes a resolver
|
9
9
|
#
|
10
10
|
# @param identifier [Identifier] The identifier
|
11
|
+
# @param options [Hash] The options
|
11
12
|
#
|
12
13
|
# @return [Resolver]
|
13
|
-
def initialize(identifier)
|
14
|
+
def initialize(identifier, options = {})
|
14
15
|
@graph = Solve::Graph.new
|
15
16
|
@identifier = identifier
|
16
17
|
@dependencies = {}
|
18
|
+
@options = options
|
17
19
|
self
|
18
20
|
end
|
19
21
|
|
@@ -40,7 +42,12 @@ module ElmInstall
|
|
40
42
|
|
41
43
|
dependency
|
42
44
|
.source
|
43
|
-
.versions(
|
45
|
+
.versions(
|
46
|
+
dependency.constraints,
|
47
|
+
@identifier.initial_elm_version,
|
48
|
+
!@options[:skip_update],
|
49
|
+
@options[:only_update]
|
50
|
+
)
|
44
51
|
.each do |version|
|
45
52
|
next if @graph.artifact?(dependency.name, version)
|
46
53
|
resolve_dependencies(dependency, version)
|
data/lib/elm_install/version.rb
CHANGED
data/package.json
CHANGED
data/packaging/Gemfile
CHANGED
data/packaging/Gemfile.lock
CHANGED
@@ -5,7 +5,7 @@ GEM
|
|
5
5
|
commander (4.4.3)
|
6
6
|
highline (~> 1.7.2)
|
7
7
|
contracts (0.16.0)
|
8
|
-
elm_install (1.
|
8
|
+
elm_install (1.5.0)
|
9
9
|
adts (~> 0.1.2)
|
10
10
|
commander (~> 4.4, >= 4.4.2)
|
11
11
|
contracts (~> 0.16.0)
|
@@ -32,7 +32,7 @@ PLATFORMS
|
|
32
32
|
ruby
|
33
33
|
|
34
34
|
DEPENDENCIES
|
35
|
-
elm_install (= 1.
|
35
|
+
elm_install (= 1.5.0)
|
36
36
|
|
37
37
|
RUBY VERSION
|
38
38
|
ruby 2.2.2p95
|
data/spec/git_source_spec.rb
CHANGED
@@ -51,7 +51,7 @@ describe ElmInstall::GitSource do
|
|
51
51
|
.to receive(:fetch)
|
52
52
|
|
53
53
|
expect(repository)
|
54
|
-
.to receive(:fetched
|
54
|
+
.to receive(:fetched)
|
55
55
|
.and_return(false)
|
56
56
|
|
57
57
|
expect(repository)
|
@@ -67,7 +67,7 @@ describe ElmInstall::GitSource do
|
|
67
67
|
.to receive(:identifier)
|
68
68
|
.and_return(double(elm_version: '0.18'))
|
69
69
|
|
70
|
-
subject.versions([], '0.18')
|
70
|
+
subject.versions([], '0.18', true, nil)
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -102,7 +102,7 @@ describe ElmInstall::GitSource do
|
|
102
102
|
.to receive(:fetch)
|
103
103
|
|
104
104
|
expect(repository)
|
105
|
-
.to receive(:fetched
|
105
|
+
.to receive(:fetched)
|
106
106
|
.and_return(false)
|
107
107
|
|
108
108
|
expect(subject)
|
@@ -113,7 +113,7 @@ describe ElmInstall::GitSource do
|
|
113
113
|
.to receive(:checkout)
|
114
114
|
.and_return(Dir.new('.'))
|
115
115
|
|
116
|
-
subject.versions([], '0.18')
|
116
|
+
subject.versions([], '0.18', true, nil)
|
117
117
|
end
|
118
118
|
end
|
119
119
|
end
|
@@ -125,7 +125,7 @@ describe ElmInstall::GitSource do
|
|
125
125
|
.to receive(:fetch)
|
126
126
|
|
127
127
|
expect(repository)
|
128
|
-
.to receive(:fetched
|
128
|
+
.to receive(:fetched)
|
129
129
|
.and_return(false)
|
130
130
|
|
131
131
|
expect(repository)
|
@@ -141,7 +141,7 @@ describe ElmInstall::GitSource do
|
|
141
141
|
.to receive(:versions)
|
142
142
|
.and_return([Semverse::Version.new('1.0.0')])
|
143
143
|
|
144
|
-
subject.versions([], '0.18')
|
144
|
+
subject.versions([], '0.18', true, nil)
|
145
145
|
end
|
146
146
|
end
|
147
147
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elm_install
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gusztáv Szikszai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|