elm_install 1.0.1 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b5c84733bb921ff13400591fe82d7517b8f6515
4
- data.tar.gz: b54df49c137a487cd5c75d1180f2153298e32e93
3
+ metadata.gz: 015afe2051818a6f31c3925d145774abe091f5c7
4
+ data.tar.gz: 013a7d8771a2334689ea8097b2142d735c0f43f0
5
5
  SHA512:
6
- metadata.gz: 88cc0e840c81b31ba63fd9867e7aa8ebaaf936f4569fcd70b53f9226266ecafd3aa1891756feef4ace0f40646387ae543ff9fb91c39a28dbecaa0e6084667e76
7
- data.tar.gz: 88744a9115ea126efe39c3cb28b8138ad84af590afbff7e52c37a830ab71f74740ecccb960dbb314fc82e83b6a39b21fbc4f999731c19cef77079897109e560a
6
+ metadata.gz: 005a9d8b14baeff0103829c50fcf5bb8f31952a23d16674bbb6299c4942e4d8b17f28586c8039f95e0098f26a45a434dbaa5e38e7bd14d1162ec593377d157ee
7
+ data.tar.gz: bffaaabbc950780b0b3bc2f0dcab1d89b728f97b14665299376863e38046c47fd12f775884e2f41c62a55b243d8820bcde0fac20af830f3f3737b760ee70ea8a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- elm_install (1.0.1)
4
+ elm_install (1.1.0)
5
5
  adts (~> 0.1.2)
6
6
  commander (~> 4.4, >= 4.4.2)
7
7
  contracts (~> 0.16.0)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Szikszai Gusztáv
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/Readme.md CHANGED
@@ -16,7 +16,7 @@ This gem/npm-package allows you to install Elm packages **in a decentralized way
16
16
 
17
17
  ## Installation
18
18
 
19
- If you have ruby installed on your machine then you can install it directy from
19
+ If you have ruby installed on your machine then you can install it directly from
20
20
  [rubygems.org](https://rubygems.org/gems/elm_install):
21
21
  ```
22
22
  gem install elm_install
@@ -166,7 +166,7 @@ OPTIONS:
166
166
 
167
167
  #### Do I need to use SSH keys?
168
168
 
169
- It dependes on your use case, but for public repositories in Github or Bitbucket
169
+ It depends on your use case, but for public repositories in Github or Bitbucket
170
170
  it's not needed.
171
171
 
172
172
  #### What url protocols are supported?
@@ -70,17 +70,16 @@ module ElmInstall
70
70
  #
71
71
  # @return [Array] The versions
72
72
  def versions(constraints)
73
+ if repository.cloned?
74
+ # Get updates from upstream
75
+ Logger.arrow "Getting updates for: #{package_name.bold}"
76
+ repository.fetch
77
+ end
78
+
73
79
  case @branch
74
80
  when Branch::Just
75
81
  [identifier.version(fetch(@branch.ref))]
76
82
  when Branch::Nothing
77
- matches = matching_versions constraints
78
- return matches if matches.any?
79
- Logger.arrow(
80
- "Could not find matching versions for: #{package_name.bold}"\
81
- ' in cache. Fetching updates.'
82
- )
83
- repository.fetch
84
83
  matching_versions constraints
85
84
  end
86
85
  end
@@ -63,12 +63,19 @@ module ElmInstall
63
63
  #
64
64
  # @return [Git::Base]
65
65
  def repo
66
- clone unless Dir.exist?(path)
66
+ clone unless cloned?
67
67
  @repo ||= Git.open path
68
68
  @repo.reset_hard
69
69
  @repo
70
70
  end
71
71
 
72
+ # Returns if the repository has been cloned yet or not
73
+ #
74
+ # @return [Bool]
75
+ def cloned?
76
+ Dir.exist?(path)
77
+ end
78
+
72
79
  Contract None => Git::Base
73
80
  # Clones the repository
74
81
  #
@@ -1,4 +1,4 @@
1
1
  module ElmInstall
2
2
  # The version of ElmInstall
3
- VERSION = '1.0.1'.freeze
3
+ VERSION = '1.1.0'.freeze
4
4
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elm-github-install",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Install Elm packages directly from Git repositories",
5
5
  "scripts": {
6
6
  "install": "node scripts/install.js",
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  ruby '2.2.2'
4
4
 
5
- gem 'elm_install', '1.0.0'
5
+ gem 'elm_install', '1.0.1'
@@ -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.0.0)
8
+ elm_install (1.0.1)
9
9
  adts (~> 0.1.2)
10
10
  commander (~> 4.4, >= 4.4.2)
11
11
  contracts (~> 0.16.0)
@@ -33,7 +33,7 @@ PLATFORMS
33
33
  ruby
34
34
 
35
35
  DEPENDENCIES
36
- elm_install (= 1.0.0)
36
+ elm_install (= 1.0.1)
37
37
 
38
38
  RUBY VERSION
39
39
  ruby 2.2.2p95
@@ -11,6 +11,7 @@ describe ElmInstall::GitSource do
11
11
 
12
12
  before do
13
13
  subject.options = { cache_directory: CACHE_DIRECTORY }
14
+ allow(repository).to receive(:cloned?).and_return true
14
15
  end
15
16
 
16
17
  let(:repository) do
@@ -51,7 +52,7 @@ describe ElmInstall::GitSource do
51
52
 
52
53
  expect(repository)
53
54
  .to receive(:versions)
54
- .and_return([], [Semverse::Version.new('1.0.0')])
55
+ .and_return([Semverse::Version.new('1.0.0')])
55
56
 
56
57
  subject.versions([])
57
58
  end
@@ -84,6 +85,9 @@ describe ElmInstall::GitSource do
84
85
 
85
86
  describe '#versions' do
86
87
  it 'returns the versions' do
88
+ expect(repository)
89
+ .to receive(:fetch)
90
+
87
91
  expect(subject)
88
92
  .to receive(:identifier)
89
93
  .and_return(double(version: Semverse::Version.new('1.0.0')))
@@ -105,7 +109,7 @@ describe ElmInstall::GitSource do
105
109
 
106
110
  expect(repository)
107
111
  .to receive(:versions)
108
- .and_return([], [Semverse::Version.new('1.0.0')])
112
+ .and_return([Semverse::Version.new('1.0.0')])
109
113
 
110
114
  subject.versions([])
111
115
  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.0.1
4
+ version: 1.1.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-05-05 00:00:00.000000000 Z
11
+ date: 2017-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -165,6 +165,7 @@ files:
165
165
  - ".travis.yml"
166
166
  - Gemfile
167
167
  - Gemfile.lock
168
+ - License.md
168
169
  - Rakefile
169
170
  - Readme.md
170
171
  - bin/elm-install