kpm 0.7.2 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +66 -0
  3. data/Gemfile +2 -0
  4. data/README.adoc +111 -109
  5. data/Rakefile +2 -1
  6. data/bin/kpm +4 -2
  7. data/kpm.gemspec +8 -6
  8. data/lib/kpm.rb +3 -0
  9. data/lib/kpm/account.rb +267 -338
  10. data/lib/kpm/base_artifact.rb +33 -39
  11. data/lib/kpm/base_installer.rb +69 -83
  12. data/lib/kpm/blob.rb +29 -0
  13. data/lib/kpm/cli.rb +3 -1
  14. data/lib/kpm/coordinates.rb +6 -9
  15. data/lib/kpm/database.rb +90 -114
  16. data/lib/kpm/diagnostic_file.rb +126 -147
  17. data/lib/kpm/formatter.rb +74 -46
  18. data/lib/kpm/inspector.rb +22 -32
  19. data/lib/kpm/installer.rb +53 -46
  20. data/lib/kpm/kaui_artifact.rb +4 -3
  21. data/lib/kpm/killbill_plugin_artifact.rb +10 -7
  22. data/lib/kpm/killbill_server_artifact.rb +13 -12
  23. data/lib/kpm/migrations.rb +8 -7
  24. data/lib/kpm/nexus_helper/actions.rb +47 -8
  25. data/lib/kpm/nexus_helper/nexus_api_calls_v2.rb +87 -94
  26. data/lib/kpm/nexus_helper/nexus_facade.rb +5 -3
  27. data/lib/kpm/plugins_directory.rb +9 -8
  28. data/lib/kpm/plugins_directory.yml +8 -175
  29. data/lib/kpm/plugins_manager.rb +29 -24
  30. data/lib/kpm/sha1_checker.rb +31 -18
  31. data/lib/kpm/system.rb +105 -136
  32. data/lib/kpm/system_helpers/cpu_information.rb +56 -55
  33. data/lib/kpm/system_helpers/disk_space_information.rb +60 -63
  34. data/lib/kpm/system_helpers/entropy_available.rb +37 -39
  35. data/lib/kpm/system_helpers/memory_information.rb +52 -51
  36. data/lib/kpm/system_helpers/os_information.rb +45 -47
  37. data/lib/kpm/system_helpers/system_proxy.rb +10 -10
  38. data/lib/kpm/tasks.rb +364 -437
  39. data/lib/kpm/tenant_config.rb +68 -83
  40. data/lib/kpm/tomcat_manager.rb +9 -8
  41. data/lib/kpm/trace_logger.rb +18 -16
  42. data/lib/kpm/uninstaller.rb +81 -14
  43. data/lib/kpm/utils.rb +13 -14
  44. data/lib/kpm/version.rb +3 -1
  45. data/packaging/Gemfile +2 -0
  46. data/pom.xml +1 -1
  47. data/spec/kpm/remote/base_artifact_spec.rb +13 -15
  48. data/spec/kpm/remote/base_installer_spec.rb +30 -29
  49. data/spec/kpm/remote/installer_spec.rb +73 -73
  50. data/spec/kpm/remote/kaui_artifact_spec.rb +7 -6
  51. data/spec/kpm/remote/killbill_plugin_artifact_spec.rb +19 -24
  52. data/spec/kpm/remote/killbill_server_artifact_spec.rb +17 -16
  53. data/spec/kpm/remote/migrations_spec.rb +12 -11
  54. data/spec/kpm/remote/nexus_facade_spec.rb +30 -26
  55. data/spec/kpm/remote/tenant_config_spec.rb +27 -26
  56. data/spec/kpm/remote/tomcat_manager_spec.rb +2 -1
  57. data/spec/kpm/unit/actions_spec.rb +52 -0
  58. data/spec/kpm/unit/base_artifact_spec.rb +17 -16
  59. data/spec/kpm/unit/cpu_information_spec.rb +67 -0
  60. data/spec/kpm/unit/disk_space_information_spec.rb +47 -0
  61. data/spec/kpm/unit/entropy_information_spec.rb +36 -0
  62. data/spec/kpm/unit/formatter_spec.rb +163 -0
  63. data/spec/kpm/unit/inspector_spec.rb +34 -42
  64. data/spec/kpm/unit/installer_spec.rb +5 -4
  65. data/spec/kpm/unit/memory_information_spec.rb +102 -0
  66. data/spec/kpm/unit/os_information_spec.rb +38 -0
  67. data/spec/kpm/unit/plugins_directory_spec.rb +34 -18
  68. data/spec/kpm/unit/plugins_manager_spec.rb +61 -65
  69. data/spec/kpm/unit/sha1_checker_spec.rb +107 -60
  70. data/spec/kpm/unit/uninstaller_spec.rb +107 -61
  71. data/spec/kpm/unit_mysql/account_spec.rb +120 -135
  72. data/spec/spec_helper.rb +19 -17
  73. data/tasks/package.rake +18 -18
  74. metadata +17 -8
@@ -1,17 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe KPM::Installer do
4
-
5
6
  context 'when no config file is specified' do
6
- let(:all_kb_versions) { %w(0.15.0 0.15.1 0.15.10 0.15.11-SNAPSHOT 0.15.2 0.15.3 0.16.0 0.16.1 0.16.10 0.16.11 0.16.12-SNAPSHOT 0.16.2 0.16.3 0.17.0 0.17.1 0.17.2 0.17.2-SNAPSHOT 0.17.3-SNAPSHOT) }
7
+ let(:all_kb_versions) { %w[0.15.0 0.15.1 0.15.10 0.15.11-SNAPSHOT 0.15.2 0.15.3 0.16.0 0.16.1 0.16.10 0.16.11 0.16.12-SNAPSHOT 0.16.2 0.16.3 0.17.0 0.17.1 0.17.2 0.17.2-SNAPSHOT 0.17.3-SNAPSHOT] }
7
8
 
8
9
  it 'finds the right stable versions' do
9
10
  config = KPM::Installer.build_default_config(all_kb_versions)
10
11
  config['killbill'].should_not be_nil
11
- config['killbill']['version'].should == '0.16.11'
12
+ config['killbill']['version'].should eq '0.16.11'
12
13
 
13
14
  config['kaui'].should_not be_nil
14
- config['kaui']['version'].should == 'LATEST'
15
+ config['kaui']['version'].should eq 'LATEST'
15
16
  end
16
17
  end
17
18
  end
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require 'kpm/system_helpers/system_proxy'
5
+ require 'kpm/system_helpers/memory_information'
6
+
7
+ describe KPM::SystemProxy::MemoryInformation do
8
+ subject { described_class.new }
9
+
10
+ context 'when running on Linux' do
11
+ let(:data) { "MemTotal: 10774024 kB\nMemFree: 3788232 kB\nMemAvailable: 9483696 kB\nBuffers: 269216 kB\nCached: 5448624 kB\nSwapCached: 0 kB\nActive: 3562072 kB\nInactive: 2913296 kB\nActive(anon): 827072 kB\nInactive(anon): 124844 kB\nActive(file): 2735000 kB\nInactive(file): 2788452 kB\nUnevictable: 0 kB\nMlocked: 0 kB\nSwapTotal: 3620520 kB\nSwapFree: 3620520 kB\nDirty: 16 kB\nWriteback: 0 kB\nAnonPages: 757472 kB\nMapped: 71548 kB\nShmem: 194392 kB\nSlab: 468096 kB\nSReclaimable: 425428 kB\nSUnreclaim: 42668 kB\nKernelStack: 4816 kB\nPageTables: 3420 kB\nNFS_Unstable: 0 kB\nBounce: 0 kB\nWritebackTmp: 0 kB\nCommitLimit: 9007532 kB\nCommitted_AS: 1711072 kB\nVmallocTotal: 34359738367 kB\nVmallocUsed: 0 kB\nVmallocChunk: 0 kB\nAnonHugePages: 622592 kB\nHugePages_Total: 0\nHugePages_Free: 0\nHugePages_Rsvd: 0\nHugePages_Surp: 0\nHugepagesize: 2048 kB\nDirectMap4k: 166848 kB\nDirectMap2M: 10883072 kB\n" }
12
+ let(:memory_info) { subject.send(:build_hash, data) }
13
+
14
+ it {
15
+ expect(subject.labels).to eq([{ label: :memory_detail },
16
+ { label: :value }])
17
+ }
18
+
19
+ it {
20
+ expect(memory_info).to eq({ 'MemTotal' => { memory_detail: 'MemTotal', value: '10774024 kB' },
21
+ 'MemFree' => { memory_detail: 'MemFree', value: '3788232 kB' },
22
+ 'MemAvailable' => { memory_detail: 'MemAvailable', value: '9483696 kB' },
23
+ 'Buffers' => { memory_detail: 'Buffers', value: '269216 kB' },
24
+ 'Cached' => { memory_detail: 'Cached', value: '5448624 kB' },
25
+ 'SwapCached' => { memory_detail: 'SwapCached', value: '0 kB' },
26
+ 'Active' => { memory_detail: 'Active', value: '3562072 kB' },
27
+ 'Inactive' => { memory_detail: 'Inactive', value: '2913296 kB' },
28
+ 'Active(anon)' => { memory_detail: 'Active(anon)', value: '827072 kB' },
29
+ 'Inactive(anon)' => { memory_detail: 'Inactive(anon)', value: '124844 kB' },
30
+ 'Active(file)' => { memory_detail: 'Active(file)', value: '2735000 kB' },
31
+ 'Inactive(file)' => { memory_detail: 'Inactive(file)', value: '2788452 kB' },
32
+ 'Unevictable' => { memory_detail: 'Unevictable', value: '0 kB' },
33
+ 'Mlocked' => { memory_detail: 'Mlocked', value: '0 kB' },
34
+ 'SwapTotal' => { memory_detail: 'SwapTotal', value: '3620520 kB' },
35
+ 'SwapFree' => { memory_detail: 'SwapFree', value: '3620520 kB' },
36
+ 'Dirty' => { memory_detail: 'Dirty', value: '16 kB' },
37
+ 'Writeback' => { memory_detail: 'Writeback', value: '0 kB' },
38
+ 'AnonPages' => { memory_detail: 'AnonPages', value: '757472 kB' },
39
+ 'Mapped' => { memory_detail: 'Mapped', value: '71548 kB' },
40
+ 'Shmem' => { memory_detail: 'Shmem', value: '194392 kB' },
41
+ 'Slab' => { memory_detail: 'Slab', value: '468096 kB' },
42
+ 'SReclaimable' => { memory_detail: 'SReclaimable', value: '425428 kB' },
43
+ 'SUnreclaim' => { memory_detail: 'SUnreclaim', value: '42668 kB' },
44
+ 'KernelStack' => { memory_detail: 'KernelStack', value: '4816 kB' },
45
+ 'PageTables' => { memory_detail: 'PageTables', value: '3420 kB' },
46
+ 'NFS_Unstable' => { memory_detail: 'NFS_Unstable', value: '0 kB' },
47
+ 'Bounce' => { memory_detail: 'Bounce', value: '0 kB' },
48
+ 'WritebackTmp' => { memory_detail: 'WritebackTmp', value: '0 kB' },
49
+ 'CommitLimit' => { memory_detail: 'CommitLimit', value: '9007532 kB' },
50
+ 'Committed_AS' => { memory_detail: 'Committed_AS', value: '1711072 kB' },
51
+ 'VmallocTotal' => { memory_detail: 'VmallocTotal', value: '34359738367 kB' },
52
+ 'VmallocUsed' => { memory_detail: 'VmallocUsed', value: '0 kB' },
53
+ 'VmallocChunk' => { memory_detail: 'VmallocChunk', value: '0 kB' },
54
+ 'AnonHugePages' => { memory_detail: 'AnonHugePages', value: '622592 kB' },
55
+ 'HugePages_Total' => { memory_detail: 'HugePages_Total', value: '0' },
56
+ 'HugePages_Free' => { memory_detail: 'HugePages_Free', value: '0' },
57
+ 'HugePages_Rsvd' => { memory_detail: 'HugePages_Rsvd', value: '0' },
58
+ 'HugePages_Surp' => { memory_detail: 'HugePages_Surp', value: '0' },
59
+ 'Hugepagesize' => { memory_detail: 'Hugepagesize', value: '2048 kB' },
60
+ 'DirectMap4k' => { memory_detail: 'DirectMap4k', value: '166848 kB' },
61
+ 'DirectMap2M' => { memory_detail: 'DirectMap2M', value: '10883072 kB' } })
62
+ }
63
+ end
64
+
65
+ context 'when running on MacOS' do
66
+ let(:mem_data) { "Mach Virtual Memory Statistics: (page size of 4096 bytes)\nPages free: 20436\nPages active: 279093\nPages inactive: 276175\nPages speculative: 2492\nPages throttled: 0\nPages wired down: 3328540\nPages purgeable: 47378\n\"Translation faults\": 1774872371\nPages copy-on-write: 34313850\nPages zero filled: 1023660277\nPages reactivated: 194623586\nPages purged: 70443047\nFile-backed pages: 119033\nAnonymous pages: 438727\nPages stored in compressor: 2771982\nPages occupied by compressor: 287324\nDecompressions: 252938013\nCompressions: 328708973\nPageins: 66884005\nPageouts: 1122278\nSwapins: 110783726\nSwapouts: 113589173\n" }
67
+ let(:mem_total_data) { " Memory: 16 GB\n" }
68
+ let(:memory_info) { subject.send(:build_hash_mac, mem_data, mem_total_data) }
69
+
70
+ it {
71
+ expect(subject.labels).to eq([{ label: :memory_detail },
72
+ { label: :value }])
73
+ }
74
+
75
+ it {
76
+ expect(memory_info).to eq({ 'Memory' => { memory_detail: 'Memory', value: '16 GB' },
77
+ 'Mach Virtual Memory Statistics' => { memory_detail: 'Mach Virtual Memory Statistics', value: '0MB' },
78
+ 'Pages free' => { memory_detail: 'Memory free', value: '79MB' },
79
+ 'Pages active' => { memory_detail: 'Memory active', value: '1090MB' },
80
+ 'Pages inactive' => { memory_detail: 'Memory inactive', value: '1078MB' },
81
+ 'Pages speculative' => { memory_detail: 'Memory speculative', value: '9MB' },
82
+ 'Pages throttled' => { memory_detail: 'Memory throttled', value: '0MB' },
83
+ 'Pages wired down' => { memory_detail: 'Memory wired down', value: '13002MB' },
84
+ 'Pages purgeable' => { memory_detail: 'Memory purgeable', value: '185MB' },
85
+ 'Translation faults' => { memory_detail: 'Translation faults', value: '6933095MB' },
86
+ 'Pages copy-on-write' => { memory_detail: 'Memory copy-on-write', value: '134038MB' },
87
+ 'Pages zero filled' => { memory_detail: 'Memory zero filled', value: '3998672MB' },
88
+ 'Pages reactivated' => { memory_detail: 'Memory reactivated', value: '760248MB' },
89
+ 'Pages purged' => { memory_detail: 'Memory purged', value: '275168MB' },
90
+ 'File-backed pages' => { memory_detail: 'File-backed pages', value: '464MB' },
91
+ 'Anonymous pages' => { memory_detail: 'Anonymous pages', value: '1713MB' },
92
+ 'Pages stored in compressor' => { memory_detail: 'Memory stored in compressor', value: '10828MB' },
93
+ 'Pages occupied by compressor' => { memory_detail: 'Memory occupied by compressor', value: '1122MB' },
94
+ 'Decompressions' => { memory_detail: 'Decompressions', value: '988039MB' },
95
+ 'Compressions' => { memory_detail: 'Compressions', value: '1284019MB' },
96
+ 'Pageins' => { memory_detail: 'Pageins', value: '261265MB' },
97
+ 'Pageouts' => { memory_detail: 'Pageouts', value: '4383MB' },
98
+ 'Swapins' => { memory_detail: 'Swapins', value: '432748MB' },
99
+ 'Swapouts' => { memory_detail: 'Swapouts', value: '443707MB' } })
100
+ }
101
+ end
102
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require 'kpm/system_helpers/system_proxy'
5
+ require 'kpm/system_helpers/os_information'
6
+
7
+ describe KPM::SystemProxy::OsInformation do
8
+ subject { described_class.new }
9
+ let(:os_data) { subject.send(:build_hash, data) }
10
+
11
+ context 'when running on Linux' do
12
+ let(:data) { "Description:Ubuntu 16.04.1 LTS \n\n" }
13
+
14
+ it {
15
+ expect(subject.labels).to eq([{ label: :os_detail },
16
+ { label: :value }])
17
+ }
18
+
19
+ it {
20
+ expect(os_data).to eq({ 'Description' => { :os_detail => 'Description', :value => 'Ubuntu 16.04.1 LTS' } })
21
+ }
22
+ end
23
+
24
+ context 'when running on MacOS' do
25
+ let(:data) { "ProductName:\tMac OS X\nProductVersion:\t10.14.6\nBuildVersion:\t18G87\n" }
26
+
27
+ it {
28
+ expect(subject.labels).to eq([{ label: :os_detail },
29
+ { label: :value }])
30
+ }
31
+
32
+ it {
33
+ expect(os_data).to eq({ 'ProductName' => { :os_detail => 'ProductName', :value => 'Mac OS X' },
34
+ 'ProductVersion' => { :os_detail => 'ProductVersion', :value => '10.14.6' },
35
+ 'BuildVersion' => { :os_detail => 'BuildVersion', :value => '18G87' } })
36
+ }
37
+ end
38
+ end
@@ -1,36 +1,52 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe KPM::PluginsDirectory do
4
-
5
6
  it 'should parse the plugins directory' do
6
7
  directory = KPM::PluginsDirectory.all(false)
7
8
  directory.size.should > 0
8
9
  end
9
10
 
10
-
11
11
  it 'should lookup plugins' do
12
- group_id, artifact_id, packaging, classifier, version, type = KPM::PluginsDirectory.lookup('analytics', false, '0.14')
13
- group_id.should == 'org.kill-bill.billing.plugin.java'
14
- artifact_id.should == 'analytics-plugin'
15
- packaging.should == 'jar'
12
+ group_id, artifact_id, packaging, classifier, version, type = KPM::PluginsDirectory.lookup('analytics', false, '0.20.11')
13
+ group_id.should eq 'org.kill-bill.billing.plugin.java'
14
+ artifact_id.should eq 'analytics-plugin'
15
+ packaging.should eq 'jar'
16
+ classifier.should be_nil
17
+ version.should eq '6.0.1'
18
+ type.should eq :java
19
+
20
+ group_id, artifact_id, packaging, classifier, version, type = KPM::PluginsDirectory.lookup('analytics', false, '0.20.11-SNAPSHOT')
21
+ group_id.should eq 'org.kill-bill.billing.plugin.java'
22
+ artifact_id.should eq 'analytics-plugin'
23
+ packaging.should eq 'jar'
24
+ classifier.should be_nil
25
+ version.should eq '6.0.1'
26
+ type.should eq :java
27
+
28
+ group_id, artifact_id, packaging, classifier, version, type = KPM::PluginsDirectory.lookup('analytics', false, '0.20')
29
+ group_id.should eq 'org.kill-bill.billing.plugin.java'
30
+ artifact_id.should eq 'analytics-plugin'
31
+ packaging.should eq 'jar'
16
32
  classifier.should be_nil
17
- version.should == '1.0.3'
18
- type.should == :java
33
+ version.should eq '6.0.1'
34
+ type.should eq :java
19
35
 
20
36
  group_id, artifact_id, packaging, classifier, version, type = KPM::PluginsDirectory.lookup('analytics', false, 'LATEST')
21
- group_id.should == 'org.kill-bill.billing.plugin.java'
22
- artifact_id.should == 'analytics-plugin'
23
- packaging.should == 'jar'
37
+ group_id.should eq 'org.kill-bill.billing.plugin.java'
38
+ artifact_id.should eq 'analytics-plugin'
39
+ packaging.should eq 'jar'
24
40
  classifier.should be_nil
25
- version.should == 'LATEST'
26
- type.should == :java
41
+ version.should eq 'LATEST'
42
+ type.should eq :java
27
43
 
28
44
  group_id, artifact_id, packaging, classifier, version, type = KPM::PluginsDirectory.lookup('analytics', false, '0.42')
29
- group_id.should == 'org.kill-bill.billing.plugin.java'
30
- artifact_id.should == 'analytics-plugin'
31
- packaging.should == 'jar'
45
+ group_id.should eq 'org.kill-bill.billing.plugin.java'
46
+ artifact_id.should eq 'analytics-plugin'
47
+ packaging.should eq 'jar'
32
48
  classifier.should be_nil
33
- version.should == 'LATEST'
34
- type.should == :java
49
+ version.should eq 'LATEST'
50
+ type.should eq :java
35
51
  end
36
52
  end
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe KPM::PluginsManager do
4
-
5
6
  before(:each) do
6
7
  logger = Logger.new(STDOUT)
7
8
  logger.level = Logger::INFO
@@ -14,7 +15,7 @@ describe KPM::PluginsManager do
14
15
  FileUtils.mkdir_p(@plugin_dir.join('1.0.0'))
15
16
  FileUtils.mkdir_p(@plugin_dir.join('2.0.0'))
16
17
 
17
- File.exists?(@plugin_dir.join('SET_DEFAULT')).should be_false
18
+ File.exist?(@plugin_dir.join('SET_DEFAULT')).should be_false
18
19
  end
19
20
 
20
21
  after(:each) do
@@ -24,133 +25,128 @@ describe KPM::PluginsManager do
24
25
  it 'creates a plugin identifier entry with no coordinate' do
25
26
  # Verifies file gets created if does not exist
26
27
  identifiers = @manager.add_plugin_identifier_key('foo', 'foo_name', 'type', nil)
27
- identifiers.size.should == 1
28
- identifiers['foo']['plugin_name'].should == 'foo_name'
28
+ identifiers.size.should eq 1
29
+ identifiers['foo']['plugin_name'].should eq 'foo_name'
29
30
  end
30
31
 
31
32
  it 'creates a plugin identifier entry with coordinates' do
32
33
  # Verifies file gets created if does not exist
33
- coordinate_map = {:group_id => 'group', :artifact_id => 'artifact', :packaging => 'packaging', :version => 'version'}
34
+ coordinate_map = { group_id: 'group', artifact_id: 'artifact', packaging: 'packaging', version: 'version' }
34
35
  identifiers = @manager.add_plugin_identifier_key('bar', 'bar_name', 'type', coordinate_map)
35
- identifiers.size.should == 1
36
- identifiers['bar']['plugin_name'].should == 'bar_name'
37
- identifiers['bar']['group_id'].should == 'group'
38
- identifiers['bar']['artifact_id'].should == 'artifact'
39
- identifiers['bar']['packaging'].should == 'packaging'
40
- identifiers['bar']['classifier'].should == nil
41
- identifiers['bar']['version'].should == 'version'
36
+ identifiers.size.should eq 1
37
+ identifiers['bar']['plugin_name'].should eq 'bar_name'
38
+ identifiers['bar']['group_id'].should eq 'group'
39
+ identifiers['bar']['artifact_id'].should eq 'artifact'
40
+ identifiers['bar']['packaging'].should eq 'packaging'
41
+ identifiers['bar']['classifier'].should.nil?
42
+ identifiers['bar']['version'].should eq 'version'
42
43
  end
43
44
 
44
-
45
45
  it 'creates plugin identifier with multiple entries' do
46
46
  # Verifies file gets created if does not exist
47
47
  identifiers = @manager.add_plugin_identifier_key('foo', 'foo_name', 'type', nil)
48
- identifiers.size.should == 1
49
- identifiers['foo']['plugin_name'].should == 'foo_name'
48
+ identifiers.size.should eq 1
49
+ identifiers['foo']['plugin_name'].should eq 'foo_name'
50
50
 
51
51
  # Verify file was created from previous entry (prev value was read)
52
52
  identifiers = @manager.add_plugin_identifier_key('bar', 'bar_name', 'type', nil)
53
- identifiers.size.should == 2
54
- identifiers['foo']['plugin_name'].should == 'foo_name'
55
- identifiers['bar']['plugin_name'].should == 'bar_name'
56
-
53
+ identifiers.size.should eq 2
54
+ identifiers['foo']['plugin_name'].should eq 'foo_name'
55
+ identifiers['bar']['plugin_name'].should eq 'bar_name'
57
56
 
58
57
  # Verify file was created from previous entry (prev value was read)
59
58
  identifiers = @manager.add_plugin_identifier_key('zoe', 'zoe_name', 'type', nil)
60
- identifiers.size.should == 3
61
- identifiers['bar']['plugin_name'].should == 'bar_name'
62
- identifiers['foo']['plugin_name'].should == 'foo_name'
63
- identifiers['zoe']['plugin_name'].should == 'zoe_name'
59
+ identifiers.size.should eq 3
60
+ identifiers['bar']['plugin_name'].should eq 'bar_name'
61
+ identifiers['foo']['plugin_name'].should eq 'foo_name'
62
+ identifiers['zoe']['plugin_name'].should eq 'zoe_name'
64
63
  end
65
64
 
66
65
  it 'creates plugin identifiers with duplicate entries' do
67
66
  # Verifies file gets created if does not exist
68
67
  identifiers = @manager.add_plugin_identifier_key('kewl', 'kewl_name', 'type', nil)
69
- identifiers.size.should == 1
70
- identifiers['kewl']['plugin_name'].should == 'kewl_name'
68
+ identifiers.size.should eq 1
69
+ identifiers['kewl']['plugin_name'].should eq 'kewl_name'
71
70
 
72
71
  # Add with a different plugin_name
73
72
  identifiers = @manager.add_plugin_identifier_key('kewl', 'kewl_name2', 'type', nil)
74
- identifiers.size.should == 1
75
- identifiers['kewl']['plugin_name'].should == 'kewl_name'
73
+ identifiers.size.should eq 1
74
+ identifiers['kewl']['plugin_name'].should eq 'kewl_name'
76
75
  end
77
76
 
78
-
79
77
  it 'creates plugin identifiers and remove entry' do
80
78
  # Verifies file gets created if does not exist
81
79
  identifiers = @manager.add_plugin_identifier_key('lol', 'lol_name', 'type', nil)
82
- identifiers.size.should == 1
83
- identifiers['lol']['plugin_name'].should == 'lol_name'
80
+ identifiers.size.should eq 1
81
+ identifiers['lol']['plugin_name'].should eq 'lol_name'
84
82
 
85
83
  # Remove wrong entry, nothing happens
86
84
  identifiers = @manager.remove_plugin_identifier_key('lol2')
87
- identifiers.size.should == 1
88
- identifiers['lol']['plugin_name'].should == 'lol_name'
85
+ identifiers.size.should eq 1
86
+ identifiers['lol']['plugin_name'].should eq 'lol_name'
89
87
 
90
88
  # Remove correct entry
91
89
  identifiers = @manager.remove_plugin_identifier_key('lol')
92
- identifiers.size.should == 0
90
+ identifiers.size.should eq 0
93
91
 
94
92
  # Add same entry again
95
93
  identifiers = @manager.add_plugin_identifier_key('lol', 'lol_name', 'type', nil)
96
- identifiers.size.should == 1
97
- identifiers['lol']['plugin_name'].should == 'lol_name'
94
+ identifiers.size.should eq 1
95
+ identifiers['lol']['plugin_name'].should eq 'lol_name'
98
96
  end
99
97
 
100
98
  it 'creates plugin identifiers and validate entry' do
101
99
  # Verifies file gets created if does not exist
102
- coordinate_map = {:group_id => 'group', :artifact_id => 'artifact', :packaging => 'packaging', :version => 'version'}
100
+ coordinate_map = { group_id: 'group', artifact_id: 'artifact', packaging: 'packaging', version: 'version' }
103
101
 
104
- identifiers = @manager.add_plugin_identifier_key('yoyo', 'yoyo_name', 'type', coordinate_map)
105
- identifiers.size.should == 1
106
- identifiers['yoyo']['plugin_name'].should == 'yoyo_name'
102
+ identifiers = @manager.add_plugin_identifier_key('yoyo', 'yoyo_name', 'type', coordinate_map)
103
+ identifiers.size.should eq 1
104
+ identifiers['yoyo']['plugin_name'].should eq 'yoyo_name'
107
105
 
108
- @manager.validate_plugin_identifier_key('yoyo', coordinate_map).should == true
106
+ @manager.validate_plugin_identifier_key('yoyo', coordinate_map).should eq true
109
107
 
110
108
  # Negative validation
111
- invalid_coordinate_map = {:group_id => 'group1', :artifact_id => 'artifact', :packaging => 'packaging', :version => 'version'}
109
+ invalid_coordinate_map = { group_id: 'group1', artifact_id: 'artifact', packaging: 'packaging', version: 'version' }
112
110
 
113
- @manager.validate_plugin_identifier_key('yoyo', invalid_coordinate_map).should == false
111
+ @manager.validate_plugin_identifier_key('yoyo', invalid_coordinate_map).should eq false
114
112
  end
115
113
 
116
-
117
114
  it 'creates a plugin identifier entry with a new version' do
118
115
  # Verifies file gets created if does not exist
119
116
 
120
- coordinate_map1 = {:group_id => 'group', :artifact_id => 'artifact', :packaging => 'packaging', :version => 'version1'}
117
+ coordinate_map1 = { group_id: 'group', artifact_id: 'artifact', packaging: 'packaging', version: 'version1' }
121
118
 
122
119
  identifiers = @manager.add_plugin_identifier_key('bar', 'bar_name', 'type', coordinate_map1)
123
- identifiers.size.should == 1
124
- identifiers['bar']['plugin_name'].should == 'bar_name'
125
- identifiers['bar']['version'].should == 'version1'
120
+ identifiers.size.should eq 1
121
+ identifiers['bar']['plugin_name'].should eq 'bar_name'
122
+ identifiers['bar']['version'].should eq 'version1'
126
123
 
127
- coordinate_map2 = {:group_id => 'group', :artifact_id => 'artifact', :packaging => 'packaging', :version => 'version2'}
124
+ coordinate_map2 = { group_id: 'group', artifact_id: 'artifact', packaging: 'packaging', version: 'version2' }
128
125
 
129
126
  identifiers = @manager.add_plugin_identifier_key('bar', 'bar_name', 'type', coordinate_map2)
130
- identifiers.size.should == 1
131
- identifiers['bar']['plugin_name'].should == 'bar_name'
132
- identifiers['bar']['version'].should == 'version2'
133
-
127
+ identifiers.size.should eq 1
128
+ identifiers['bar']['plugin_name'].should eq 'bar_name'
129
+ identifiers['bar']['version'].should eq 'version2'
134
130
  end
135
131
 
136
132
  it 'sets a path as active' do
137
133
  @manager.set_active(@plugin_dir.join('1.0.0'))
138
- File.exists?(@plugin_dir.join('SET_DEFAULT')).should be_true
139
- File.readlink(@plugin_dir.join('SET_DEFAULT')).should == @plugin_dir.join('1.0.0').to_s
134
+ File.exist?(@plugin_dir.join('SET_DEFAULT')).should be_true
135
+ File.readlink(@plugin_dir.join('SET_DEFAULT')).should eq @plugin_dir.join('1.0.0').to_s
140
136
 
141
137
  @manager.set_active(@plugin_dir.join('2.0.0'))
142
- File.exists?(@plugin_dir.join('SET_DEFAULT')).should be_true
143
- File.readlink(@plugin_dir.join('SET_DEFAULT')).should == @plugin_dir.join('2.0.0').to_s
138
+ File.exist?(@plugin_dir.join('SET_DEFAULT')).should be_true
139
+ File.readlink(@plugin_dir.join('SET_DEFAULT')).should eq @plugin_dir.join('2.0.0').to_s
144
140
  end
145
141
 
146
142
  it 'sets a plugin version as active' do
147
143
  @manager.set_active('killbill-stripe', '2.0.0')
148
- File.exists?(@plugin_dir.join('SET_DEFAULT')).should be_true
149
- File.readlink(@plugin_dir.join('SET_DEFAULT')).should == @plugin_dir.join('2.0.0').to_s
144
+ File.exist?(@plugin_dir.join('SET_DEFAULT')).should be_true
145
+ File.readlink(@plugin_dir.join('SET_DEFAULT')).should eq @plugin_dir.join('2.0.0').to_s
150
146
 
151
147
  @manager.set_active('killbill-stripe', '1.0.0')
152
- File.exists?(@plugin_dir.join('SET_DEFAULT')).should be_true
153
- File.readlink(@plugin_dir.join('SET_DEFAULT')).should == @plugin_dir.join('1.0.0').to_s
148
+ File.exist?(@plugin_dir.join('SET_DEFAULT')).should be_true
149
+ File.readlink(@plugin_dir.join('SET_DEFAULT')).should eq @plugin_dir.join('1.0.0').to_s
154
150
  end
155
151
 
156
152
  it 'uninstalls a plugin via a path' do
@@ -196,17 +192,17 @@ describe KPM::PluginsManager do
196
192
  it 'guesses the plugin name' do
197
193
  @manager.guess_plugin_name('tripe').should be_nil
198
194
  # Short name
199
- @manager.guess_plugin_name('stripe').should == 'killbill-stripe'
195
+ @manager.guess_plugin_name('stripe').should eq 'killbill-stripe'
200
196
  # Artifact id
201
- @manager.guess_plugin_name('stripe-plugin').should == 'killbill-stripe'
197
+ @manager.guess_plugin_name('stripe-plugin').should eq 'killbill-stripe'
202
198
  # Plugin name (top directory in the .tar.gz)
203
- @manager.guess_plugin_name('killbill-stripe').should == 'killbill-stripe'
199
+ @manager.guess_plugin_name('killbill-stripe').should eq 'killbill-stripe'
204
200
  end
205
201
 
206
202
  private
207
203
 
208
204
  def check_state(version, has_restart, has_disabled)
209
- File.exists?(@plugin_dir.join(version).join('tmp').join('restart.txt')).should == has_restart
210
- File.exists?(@plugin_dir.join(version).join('tmp').join('disabled.txt')).should == has_disabled
205
+ File.exist?(@plugin_dir.join(version).join('tmp').join('restart.txt')).should eq has_restart
206
+ File.exist?(@plugin_dir.join(version).join('tmp').join('disabled.txt')).should eq has_disabled
211
207
  end
212
208
  end