supso 0.10.2 → 0.10.3
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/.gitignore +1 -0
- data/docs/commands/version.md +1 -1
- data/lib/supso/commands.rb +2 -2
- data/lib/supso/project.rb +12 -0
- data/lib/supso/updater.rb +22 -13
- data/lib/supso/util.rb +13 -5
- data/lib/supso/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39c62cf95a3d7324a9c81f88a1d3f8cacfbfe426
|
4
|
+
data.tar.gz: 31757319b7cbf6ade234d2fa50d53999ad378c08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86217eef0870447ac9c63f17cd33ab185c0d9730501eae826f9bf0a0e8a829279411c4186c853ea43c405ec18826ba2bc69e2e23efc94efa3c3b7b6d59ae71e0
|
7
|
+
data.tar.gz: 4405a29d125a34ed948a4d998ca600cb8b0ce2d4df947c8963014c9a7e6c9c74bf6e7e0ff2f93d19c4f3a4dab0990f8c6a313c6fbecc718da0f975adfffcfc8f
|
data/.gitignore
CHANGED
data/docs/commands/version.md
CHANGED
data/lib/supso/commands.rb
CHANGED
data/lib/supso/project.rb
CHANGED
@@ -214,5 +214,17 @@ module Supso
|
|
214
214
|
|
215
215
|
false
|
216
216
|
end
|
217
|
+
|
218
|
+
def self.get_from_references(references)
|
219
|
+
result_projects = []
|
220
|
+
references.each do |name|
|
221
|
+
project = Project.projects.find { |find_project| find_project.name == name }
|
222
|
+
if project.nil?
|
223
|
+
project = Project.new(name, nil)
|
224
|
+
end
|
225
|
+
result_projects << project
|
226
|
+
end
|
227
|
+
result_projects
|
228
|
+
end
|
217
229
|
end
|
218
230
|
end
|
data/lib/supso/updater.rb
CHANGED
@@ -1,21 +1,24 @@
|
|
1
1
|
module Supso
|
2
2
|
module Updater
|
3
|
-
def Updater.update
|
3
|
+
def Updater.update(project_references = [])
|
4
4
|
user = User.current_user
|
5
5
|
if user && user.auth_token
|
6
|
-
Updater.update_returning_user(user)
|
6
|
+
Updater.update_returning_user(user, project_references)
|
7
7
|
else
|
8
|
-
Updater.update_first_time_user
|
8
|
+
Updater.update_first_time_user(project_references)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
def Updater.update_first_time_user
|
12
|
+
def Updater.update_first_time_user(project_references = [])
|
13
13
|
puts "Super Source lets you subscribe to projects, so that you can receive urgent security announcements, important new versions, and other information via email."
|
14
14
|
|
15
15
|
Project.detect_all_projects!
|
16
|
-
|
17
|
-
|
18
|
-
puts "
|
16
|
+
|
17
|
+
if project_references.length == 0
|
18
|
+
puts "You are using the following projects with Super Source:"
|
19
|
+
Project.projects.each do |project|
|
20
|
+
puts " #{ project.name }"
|
21
|
+
end
|
19
22
|
end
|
20
23
|
|
21
24
|
puts "You can opt-out if you wish, however you must provide a valid email, in order to receive the confirmation token."
|
@@ -32,17 +35,19 @@ module Supso
|
|
32
35
|
end
|
33
36
|
end
|
34
37
|
|
35
|
-
|
38
|
+
projects = Project.get_from_references(project_references)
|
39
|
+
Updater.update_projects!(projects)
|
36
40
|
end
|
37
41
|
|
38
|
-
def Updater.update_returning_user(user)
|
42
|
+
def Updater.update_returning_user(user, project_references)
|
39
43
|
org = Organization.current_organization_or_fetch
|
40
44
|
Project.detect_all_projects!
|
41
|
-
|
45
|
+
projects = Project.get_from_references(project_references)
|
46
|
+
Updater.update_projects!(projects)
|
42
47
|
end
|
43
48
|
|
44
|
-
def Updater.update_projects!(projects =
|
45
|
-
if projects.nil?
|
49
|
+
def Updater.update_projects!(projects = [])
|
50
|
+
if projects.nil? || projects.length == 0
|
46
51
|
projects = Project.projects
|
47
52
|
end
|
48
53
|
|
@@ -51,7 +56,11 @@ module Supso
|
|
51
56
|
return
|
52
57
|
end
|
53
58
|
|
54
|
-
|
59
|
+
if projects.length == 1
|
60
|
+
puts "Updating 1 project (#{ projects.first.name })..."
|
61
|
+
else
|
62
|
+
puts "Updating #{ projects.length } projects..."
|
63
|
+
end
|
55
64
|
|
56
65
|
user = User.current_user
|
57
66
|
organization = Organization.current_organization
|
data/lib/supso/util.rb
CHANGED
@@ -10,7 +10,6 @@ module Supso
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def Util.detect_project_root
|
13
|
-
base_file_names = ['Gemfile', 'package.json', '.supso', 'environment.yml', 'requirements.txt', 'setup.py']
|
14
13
|
project_root = Dir.getwd
|
15
14
|
while true
|
16
15
|
if project_root == ""
|
@@ -18,10 +17,8 @@ module Supso
|
|
18
17
|
break
|
19
18
|
end
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
break
|
24
|
-
end
|
20
|
+
if Util.project_root?(project_root)
|
21
|
+
break
|
25
22
|
end
|
26
23
|
|
27
24
|
detect_project_root_splits = project_root.split("/")
|
@@ -36,6 +33,17 @@ module Supso
|
|
36
33
|
project_root
|
37
34
|
end
|
38
35
|
|
36
|
+
def Util.project_root?(path)
|
37
|
+
base_file_names = ['Gemfile', 'package.json', '.supso', 'environment.yml', 'requirements.txt', 'setup.py']
|
38
|
+
for name in base_file_names
|
39
|
+
if File.exist?(path + '/' + name)
|
40
|
+
return true
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
false
|
45
|
+
end
|
46
|
+
|
39
47
|
def Util.ensure_path_exists!(full_path)
|
40
48
|
split_paths = full_path.split('/')
|
41
49
|
just_file_path = split_paths.pop
|
data/lib/supso/version.rb
CHANGED