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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9fa09e476c4fe67b9cd33fa0d06b16c88f6469ac
4
- data.tar.gz: 059c1ab86f61f15e2e0f60201b68d777264d1165
3
+ metadata.gz: 11bad1e688de758ef3ecf5d99e89a7604214b8ea
4
+ data.tar.gz: acd1bc99e5e35e89e1c81d32b1cf16e430743d8d
5
5
  SHA512:
6
- metadata.gz: 8052d8b19b87f12e9a0533f19b2a9d25f758f13eb683dc292b3a5015a639ecaa83a084a2cdf2f0c4e2f6c45c933a381fc7580c74b382f8f04d576c7c80972a1b
7
- data.tar.gz: 87b6b361ada593885405245deb9c900227d28a54093149c40c8ea2d493f6828ffe2f4f0677fe55e12d62f0568e1b740d89fe91fe02f6f3b5b7935e5e630b1ded
6
+ metadata.gz: 9040adbfa05e0f4518e2c3491bb9ab7f06be024320f27ff89b5aac19e624b9f66144ad378d918d49fd20f333097add17cd79d65403423892bdc47031e380c0eb
7
+ data.tar.gz: b92709d46c0d0509a3b2fde6b5bcb37a7a24ccd79d234b369ae32e83b164317ee82dcb98410a22f4e3b4405dd55b8f8b7580fafea56c8eea1597c2c036ad0538
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- git_path = File.expand_path('../../.git', __FILE__)
3
+ git_path = File.expand_path(File.join('..', '..', '.git'), __FILE__)
4
4
 
5
5
  if File.exist?(git_path)
6
- $:.unshift(File.expand_path('../../lib', __FILE__))
6
+ $:.unshift(File.expand_path(File.join('..', '..', 'lib'), __FILE__))
7
7
  end
8
8
 
9
9
  require 'gemshine/cli'
@@ -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(app_name)
11
- Command.new(app_name, options).path
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 --version` will print the current version.
16
+ `gemshine version` will print the current version.
17
17
  D
18
18
  def version
19
19
  Command.new.version
@@ -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(app_name = '', options = {})
15
- @app_name = app_name
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
- gemfiles = run("find #{@app_name} -type f -name Gemfile", capture: true)
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
- run "cd #{path} && bundle outdated && cd -", capture: true
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("#{project_dir}/*.gemspec").first
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 = ''
@@ -1,3 +1,3 @@
1
1
  module Gemshine
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
@@ -1,14 +1,19 @@
1
- require_relative '../test_helper'
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
- assert_match /Gathering/, out
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
@@ -2,12 +2,15 @@ require 'minitest/autorun'
2
2
 
3
3
  module Gemshine
4
4
  module Test
5
- BINARY_PATH = File.absolute_path('../../bin/gemshine',__FILE__)
6
- TEST_PATH = '/tmp/gemshine'
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
- command = "#{cmd} #{TEST_PATH}/#{project_path}" if command.include?(' ')
12
+
13
+ command = "#{cmd} #{File.join(TEST_PATH, project_path)}" if command.include?(' ')
11
14
 
12
15
  system "#{BINARY_PATH} #{command}"
13
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemshine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Janetakis