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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f92ad949e4d626faa7f28146e3b1aa0a7d1eaa87
4
- data.tar.gz: 21001673473262984a303dfae869cf23b573fb75
3
+ metadata.gz: 39c62cf95a3d7324a9c81f88a1d3f8cacfbfe426
4
+ data.tar.gz: 31757319b7cbf6ade234d2fa50d53999ad378c08
5
5
  SHA512:
6
- metadata.gz: 0c39583e21d7abb9001d933d8ad65d2766d16aa648e197f3a523ec592c73ab40debc4e3fca04b597578b25d674cf9bce9f61427e8c501a5765d1a6fe74f0e101
7
- data.tar.gz: 2553839c80d87cc306203f2487fd4d7afb1fd94b2d3903cd9e48a00e333741f3aa64a98e69cde32c420418e8ffc0534efbb2c2af8920258b295a6b1addb7f17a
6
+ metadata.gz: 86217eef0870447ac9c63f17cd33ab185c0d9730501eae826f9bf0a0e8a829279411c4186c853ea43c405ec18826ba2bc69e2e23efc94efa3c3b7b6d59ae71e0
7
+ data.tar.gz: 4405a29d125a34ed948a4d998ca600cb8b0ce2d4df947c8963014c9a7e6c9c74bf6e7e0ff2f93d19c4f3a4dab0990f8c6a313c6fbecc718da0f975adfffcfc8f
data/.gitignore CHANGED
@@ -12,3 +12,4 @@ log
12
12
  *.lock
13
13
  .idea
14
14
  *.gem
15
+ .supso
@@ -8,5 +8,5 @@ such as the Ruby gem super_source, or the Javascript package super-source.
8
8
  Usage:
9
9
 
10
10
  `$ supso version
11
- 0.9.1
11
+ 0.10.3
12
12
  `
@@ -61,8 +61,8 @@ module Supso
61
61
  self.advanced_commands + self.simple_commands
62
62
  end
63
63
 
64
- def self.update
65
- Updater.update
64
+ def self.update(*project_names)
65
+ Updater.update(project_names)
66
66
  end
67
67
 
68
68
  def self.whereami
@@ -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
@@ -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
- puts "You are using the following projects with Super Source:"
17
- Project.projects.each do |project|
18
- puts " #{ project.name }"
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
- Updater.update_projects!
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
- Updater.update_projects!
45
+ projects = Project.get_from_references(project_references)
46
+ Updater.update_projects!(projects)
42
47
  end
43
48
 
44
- def Updater.update_projects!(projects = nil)
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
- puts "Updating #{ Util.pluralize(projects.length, 'project') }..."
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
@@ -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
- for name in base_file_names
22
- if File.exist?(project_root + '/' + name)
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
@@ -2,7 +2,7 @@ module Supso
2
2
  if !defined?(Supso::VERSION)
3
3
  VERSION_MAJOR = 0
4
4
  VERSION_MINOR = 10
5
- VERSION_PATCH = 2
5
+ VERSION_PATCH = 3
6
6
  VERSION = [VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH].join('.')
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: supso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Super Source