gemshine 0.1.4 → 0.1.5
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/bin/gemshine +2 -2
- data/lib/gemshine/cli.rb +3 -3
- data/lib/gemshine/command.rb +7 -6
- data/lib/gemshine/version.rb +1 -1
- data/test/integration/cli_test.rb +25 -2
- data/test/test_helper.rb +6 -3
- 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: 11bad1e688de758ef3ecf5d99e89a7604214b8ea
|
4
|
+
data.tar.gz: acd1bc99e5e35e89e1c81d32b1cf16e430743d8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9040adbfa05e0f4518e2c3491bb9ab7f06be024320f27ff89b5aac19e624b9f66144ad378d918d49fd20f333097add17cd79d65403423892bdc47031e380c0eb
|
7
|
+
data.tar.gz: b92709d46c0d0509a3b2fde6b5bcb37a7a24ccd79d234b369ae32e83b164317ee82dcb98410a22f4e3b4405dd55b8f8b7580fafea56c8eea1597c2c036ad0538
|
data/bin/gemshine
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
git_path = File.expand_path('
|
3
|
+
git_path = File.expand_path(File.join('..', '..', '.git'), __FILE__)
|
4
4
|
|
5
5
|
if File.exist?(git_path)
|
6
|
-
$:.unshift(File.expand_path('
|
6
|
+
$:.unshift(File.expand_path(File.join('..', '..', 'lib'), __FILE__))
|
7
7
|
end
|
8
8
|
|
9
9
|
require 'gemshine/cli'
|
data/lib/gemshine/cli.rb
CHANGED
@@ -7,13 +7,13 @@ module Gemshine
|
|
7
7
|
long_desc <<-D
|
8
8
|
`gemshine path myapp` will recursively search through the myapp path and report the installed vs latest gem versions for all ruby projects.
|
9
9
|
D
|
10
|
-
def path(
|
11
|
-
Command.new(
|
10
|
+
def path(root_path)
|
11
|
+
Command.new(root_path, options).path
|
12
12
|
end
|
13
13
|
|
14
14
|
desc 'version', ''
|
15
15
|
long_desc <<-D
|
16
|
-
`gemshine
|
16
|
+
`gemshine version` will print the current version.
|
17
17
|
D
|
18
18
|
def version
|
19
19
|
Command.new.version
|
data/lib/gemshine/command.rb
CHANGED
@@ -11,8 +11,8 @@ module Gemshine
|
|
11
11
|
MSG_GATHER_OUTDATED = 'Gathering outdated top level gems for:'
|
12
12
|
MSG_UP_TO_DATE = 'Every top level gem is up to date for this project.'
|
13
13
|
|
14
|
-
def initialize(
|
15
|
-
@
|
14
|
+
def initialize(root_path = '', options = {})
|
15
|
+
@root_path = root_path
|
16
16
|
@options = options
|
17
17
|
|
18
18
|
self.destination_root = Dir.pwd
|
@@ -42,14 +42,15 @@ module Gemshine
|
|
42
42
|
private
|
43
43
|
|
44
44
|
def ruby_project_directories
|
45
|
-
|
46
|
-
gemfile_paths = gemfiles.split("\n")
|
45
|
+
gemfile_paths = Dir.glob(File.join(@root_path, '**', 'Gemfile'))
|
47
46
|
|
48
47
|
gemfile_paths.map { |gemfile| File.dirname(gemfile) }
|
49
48
|
end
|
50
49
|
|
51
50
|
def bundle_outdated(path)
|
52
|
-
|
51
|
+
pwd = Dir.pwd
|
52
|
+
|
53
|
+
run "cd #{path} && bundle outdated && cd #{pwd}", capture: true
|
53
54
|
end
|
54
55
|
|
55
56
|
def build_gem_list(data, project_dir)
|
@@ -60,7 +61,7 @@ module Gemshine
|
|
60
61
|
lines = bundle_data.split("\n")
|
61
62
|
|
62
63
|
gemfile_path = File.join(project_dir, 'Gemfile')
|
63
|
-
gemspec_path = Dir.glob(
|
64
|
+
gemspec_path = Dir.glob(File.join(project_dir, '*.gemspec')).first
|
64
65
|
gemfile_contents = IO.read(gemfile_path)
|
65
66
|
|
66
67
|
gemspec_path ? gemspec_contents = IO.read(gemspec_path) : gemspec_contents = ''
|
data/lib/gemshine/version.rb
CHANGED
@@ -1,14 +1,19 @@
|
|
1
|
-
|
1
|
+
require 'fileutils'
|
2
|
+
require_relative File.join('..', 'test_helper')
|
2
3
|
|
3
4
|
class TestCLI < Minitest::Unit::TestCase
|
4
5
|
include Gemshine::Test
|
5
6
|
|
6
7
|
def test_path
|
8
|
+
create_dummy_gemfile
|
9
|
+
|
7
10
|
out, err = capture_subprocess_io do
|
8
11
|
gemshine 'path Gemfile'
|
9
12
|
end
|
10
13
|
|
11
|
-
|
14
|
+
FileUtils.rm_rf TEST_PATH
|
15
|
+
|
16
|
+
assert_match '', out
|
12
17
|
end
|
13
18
|
|
14
19
|
def test_version
|
@@ -18,4 +23,22 @@ class TestCLI < Minitest::Unit::TestCase
|
|
18
23
|
|
19
24
|
assert_match /Gemshine/, out
|
20
25
|
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def create_dummy_gemfile
|
30
|
+
gems = []
|
31
|
+
gems << 'gem "rails", "~> 4.0.0"'
|
32
|
+
gems << ' gem "sidekiq", "~> 2.17.4"'
|
33
|
+
gems << 'gem "whenever", require: false'
|
34
|
+
gems << 'gemwhenever",,,,d,,e'
|
35
|
+
gems << 'gem "sdoc", "~> 0.4.0", require: false'
|
36
|
+
gems << ' '
|
37
|
+
|
38
|
+
FileUtils.mkpath TEST_PATH
|
39
|
+
|
40
|
+
File.open(TEST_GEMFILE, 'w+') do |f|
|
41
|
+
gems.each { |element| f.puts(element) }
|
42
|
+
end
|
43
|
+
end
|
21
44
|
end
|
data/test/test_helper.rb
CHANGED
@@ -2,12 +2,15 @@ require 'minitest/autorun'
|
|
2
2
|
|
3
3
|
module Gemshine
|
4
4
|
module Test
|
5
|
-
|
6
|
-
|
5
|
+
|
6
|
+
BINARY_PATH = File.absolute_path(File.join('..', '..', 'bin', 'gemshine'),__FILE__)
|
7
|
+
TEST_PATH = File.join('', 'tmp')
|
8
|
+
TEST_GEMFILE = File.join('', 'tmp', 'Gemfile')
|
7
9
|
|
8
10
|
def gemshine(command)
|
9
11
|
cmd, project_path = command.split(' ')
|
10
|
-
|
12
|
+
|
13
|
+
command = "#{cmd} #{File.join(TEST_PATH, project_path)}" if command.include?(' ')
|
11
14
|
|
12
15
|
system "#{BINARY_PATH} #{command}"
|
13
16
|
end
|