projectionist-projects 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/projection +18 -17
- data/lib/projectionist/projects.rb +2 -2
- data/lib/projectionist/projects/version.rb +1 -1
- 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: 40746ac517a182e5545f3b07fa2303a6be98a5dc
|
4
|
+
data.tar.gz: e2ed7f12192d3f09fe8df0a93a653c59991fee5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08e0477173ced8c3c9efc0710e4af3ca610ced7e03f9002ea073c3bbd5e8ca55ed79f9fe396577ebc37bc1065d4ecab725bbae7bac6469517665920f9cdc79c9
|
7
|
+
data.tar.gz: 3ed9329b0af5904e870e70713cdf5272059dbb8b48602bd9c94b6991277043cce9963532742ead9d337a12ca22ebe736f0f9d0e57db5c61f49be8fb4ab097052
|
data/exe/projection
CHANGED
@@ -26,8 +26,22 @@ end
|
|
26
26
|
|
27
27
|
def setup_cache_directory
|
28
28
|
unless File.exist? DOWNLOAD_DIRECTORY
|
29
|
-
|
30
|
-
|
29
|
+
mkdir_p DOWNLOAD_DIRECTORY
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def download_files(downloads: [], confirm: true)
|
34
|
+
catch(:server_unavailable) do
|
35
|
+
results = Projectionist::Projects.fetch
|
36
|
+
projects = results.map { |result| result[:project] }
|
37
|
+
maximum = results.map(&:length).max
|
38
|
+
filtered = downloads.any? ? (downloads & projects) : projects
|
39
|
+
|
40
|
+
filtered.each do |project|
|
41
|
+
puts "downloading: #{colorize(project.ljust(maximum), :bold, :blue)}"
|
42
|
+
Projectionist::Projects.download project: project, confirm: confirm
|
43
|
+
end
|
44
|
+
return
|
31
45
|
end
|
32
46
|
end
|
33
47
|
|
@@ -56,6 +70,7 @@ parser = OptionParser.new do |opts|
|
|
56
70
|
|
57
71
|
opts.on("-s", "--setup") do
|
58
72
|
setup_cache_directory
|
73
|
+
download_files confirm: false
|
59
74
|
exit
|
60
75
|
end
|
61
76
|
|
@@ -79,21 +94,7 @@ parser = OptionParser.new do |opts|
|
|
79
94
|
end
|
80
95
|
|
81
96
|
opts.on("-d", "--download=DOWNLOADS", "Download projections from remote") do |downloads|
|
82
|
-
downloads
|
83
|
-
|
84
|
-
catch(:server_unavailable) do
|
85
|
-
results = Projectionist::Projects.fetch
|
86
|
-
projects = results.map { |result| result[:project] }
|
87
|
-
maximum = results.map(&:length).max
|
88
|
-
filtered = downloads.any? ? (downloads & projects) : projects
|
89
|
-
|
90
|
-
filtered.each do |project|
|
91
|
-
puts "downloading: #{colorize(project.ljust(maximum), :bold, :blue)}"
|
92
|
-
Projectionist::Projects.download project: project
|
93
|
-
end
|
94
|
-
exit
|
95
|
-
end
|
96
|
-
|
97
|
+
download_files downloads: (downloads || "").split(",").map(&:strip)
|
97
98
|
puts "The server is unavailable.. do you haz internets?"
|
98
99
|
exit -1
|
99
100
|
end
|
@@ -20,11 +20,11 @@ module Projectionist
|
|
20
20
|
throw :server_unavailable
|
21
21
|
end
|
22
22
|
|
23
|
-
def self.download(project:,
|
23
|
+
def self.download(project:, confirm: true, stdin: -> { gets })
|
24
24
|
normalized_project = "#{project}.projections.json"
|
25
25
|
destination_file = File.join(DOWNLOAD_DIRECTORY, normalized_project)
|
26
26
|
|
27
|
-
if
|
27
|
+
if confirm && File.exist?(destination_file)
|
28
28
|
print "Overwrite existing file? (y/N) "
|
29
29
|
return unless stdin.call.strip.downcase == "y"
|
30
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: projectionist-projects
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy W. Rowe
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|