gem-wrappers 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ecbfee7aff12296b947d5f855e213e007338e73
4
- data.tar.gz: dd477920b03c899371a29062196f3724efa1d4a6
3
+ metadata.gz: bd77331a83cc2f7bc061d5bec0bfa1b7fa525db4
4
+ data.tar.gz: c9b5fd6eec8cf8b5eaefe7aadf0eb79c32419093
5
5
  SHA512:
6
- metadata.gz: d7d118bc7c48759d0101d43d1d1eb402828a79367898344162777e2615b268bd4b996a04348672e85f841b06bdf20980301124d2121715845aa710866b210367
7
- data.tar.gz: 043aff18b4f7c0f211e03e6909e22e8aed7826b9488ac0aaa4d41ff8dc8e7fdb1273ab68e0c8188022550919d3c4ebc16bb7fc00b3d59f539d562638373b910b
6
+ metadata.gz: 7f98a163cb25c960acaa7165b6eb462f218c2b72a80c28de45cb778c3fa51069694b23c7c07820e5950bf537c72928af774acee7ea17fc1a357622bfb3278211
7
+ data.tar.gz: 3b9ecc914ebdb1406e2de70d14a1d933586f88c445e3fc4ad69388f599b0c884d928617896703237cd3eb0de8fc9a7ecb43cae8b6e869f3d644e196d0120ffb7
@@ -1,6 +1,13 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - jruby
4
+ - ruby-head
5
+ - 1.8.7
6
+ - 1.9.2
7
+ - 1.9.3
3
8
  - 2.0.0
9
+ - 2.1.0
10
+ - rbx
4
11
  notifications:
5
12
  irc:
6
13
  channels:
@@ -9,3 +16,7 @@ notifications:
9
16
  recipients:
10
17
  - mpapis@gmail.com
11
18
  on_failure: change
19
+ matrix:
20
+ allow_failures:
21
+ - rvm: rbx
22
+ fast_finish: true
data/Gemfile CHANGED
@@ -3,3 +3,14 @@ source "https://rubygems.org"
3
3
  #ruby=2.0.0
4
4
 
5
5
  gemspec
6
+
7
+ group :development do
8
+ # statistics only on MRI 2.0 - avoid problems on older rubies
9
+ gem "redcarpet", :platforms => [:mri_20]
10
+ gem "simplecov", :platforms => [:mri_20]
11
+ gem "coveralls", :platforms => [:mri_20]
12
+
13
+ # rubinius support
14
+ gem "rubysl-mutex_m", :platforms => [:rbx]
15
+ gem "rubysl-singleton", :platforms => [:rbx]
16
+ end
@@ -14,8 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.extensions = %w( ext/wrapper_generator/extconf.rb )
15
15
  s.files = `git ls-files`.split("\n")
16
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- %w{rake minitest simplecov coveralls redcarpet}.each do |name|
18
- s.add_development_dependency(name)
19
- end
17
+ s.add_development_dependency("rake")
18
+ s.add_development_dependency("minitest")
20
19
  # s.add_development_dependency("smf-gem")
21
20
  end
@@ -6,17 +6,26 @@ module GemWrappers
6
6
  def self.install(executables)
7
7
  environment = GemWrappers::Environment.new
8
8
  environment.ensure
9
- wrappers = GemWrappers::Installer.new(environment.file_name)
10
- wrappers.ensure
9
+ installer = GemWrappers::Installer.new(environment.file_name)
10
+ installer.ensure
11
11
 
12
12
  # gem executables
13
13
  executables.each do |executable|
14
- wrappers.install(executable)
14
+ installer.install(executable)
15
15
  end
16
16
 
17
17
  # ruby executables
18
18
  %w{ruby gem erb irb}.each do |executable|
19
- wrappers.install(executable)
19
+ installer.install(executable)
20
+ end
21
+ end
22
+
23
+ def self.uninstall(executables)
24
+ installer = GemWrappers::Installer.new
25
+
26
+ # gem executables
27
+ executables.each do |executable|
28
+ installer.uninstall(executable)
20
29
  end
21
30
  end
22
31
 
@@ -4,7 +4,7 @@ module GemWrappers
4
4
  class Installer
5
5
  attr_reader :environment_file
6
6
 
7
- def initialize(environment_file)
7
+ def initialize(environment_file = nil)
8
8
  @environment_file = environment_file
9
9
  end
10
10
 
@@ -23,7 +23,13 @@ module GemWrappers
23
23
  raise Gem::FilePermissionError.new(wrappers_path) unless File.writable?(wrappers_path)
24
24
  end
25
25
 
26
+ def uninstall(executable)
27
+ file_name = File.join(wrappers_path, executable)
28
+ File.delete(file_name) if File.exist?(file_name)
29
+ end
30
+
26
31
  def install(executable)
32
+ raise "Missing environment file for initialize!" unless @environment_file
27
33
  content = ERB.new(template).result(binding)
28
34
  file_name = File.join(wrappers_path, executable)
29
35
  File.open(file_name, 'w') do |file|
@@ -1,3 +1,3 @@
1
1
  module GemWrappers
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -14,5 +14,10 @@ if
14
14
  Gem.post_install do |installer|
15
15
  GemWrappers.install(installer.spec.executables)
16
16
  end
17
+
18
+ Gem.post_uninstall do |installer|
19
+ GemWrappers.uninstall(installer.spec.executables)
20
+ end
21
+
17
22
  Gem::CommandManager.instance.register_command :wrappers
18
23
  end
@@ -86,7 +86,7 @@ EXPECTED
86
86
  end
87
87
 
88
88
  it "finds gem executables" do
89
- subject.send(:executables).must_include('coveralls')
89
+ subject.send(:executables).must_include('rake')
90
90
  end
91
91
 
92
92
  end
@@ -37,7 +37,7 @@ describe GemWrappers::Environment do
37
37
 
38
38
  after do
39
39
  @test_file.close
40
- @test_file.unlink
40
+ @test_file.unlink if @test_file.path
41
41
  end
42
42
 
43
43
  it "calculates path part 1" do
@@ -63,5 +63,17 @@ EXPECTED
63
63
  end
64
64
  end
65
65
 
66
+ it "removes wrapper" do
67
+ subject.instance_variable_set(:@wrappers_path, @test_path)
68
+ full_path = File.join(subject.wrappers_path, "rake")
69
+ subject.ensure
70
+ File.open(full_path, "w") do |file|
71
+ file.puts "empty"
72
+ end
73
+ File.exist?(full_path).must_equal(true)
74
+ subject.uninstall("rake")
75
+ File.exist?(full_path).must_equal(false)
76
+ end
77
+
66
78
  end
67
79
  end
@@ -40,4 +40,14 @@ describe GemWrappers do
40
40
  File.exist?(File.join(@test_path, "wrappers", "other")).must_equal(false)
41
41
  end
42
42
 
43
+ it "does remove wrapper" do
44
+ Gem.configuration[:wrappers_path] = File.join(@test_path, "wrappers")
45
+ Gem.configuration[:wrappers_environment_file] = File.join(@test_path, "environment")
46
+ Gem.configuration[:wrappers_path_take] = 0
47
+ GemWrappers.install(%w{rake})
48
+ File.exist?(File.join(@test_path, "wrappers", "rake")).must_equal(true)
49
+ GemWrappers.uninstall(%w{rake})
50
+ File.exist?(File.join(@test_path, "wrappers", "rake")).must_equal(false)
51
+ end
52
+
43
53
  end
@@ -1,17 +1,21 @@
1
- require "coveralls"
2
- require "simplecov"
1
+ if
2
+ RUBY_VERSION == "2.0.0" # check Gemfile
3
+ then
4
+ require "coveralls"
5
+ require "simplecov"
3
6
 
4
- SimpleCov.start do
5
- formatter SimpleCov::Formatter::MultiFormatter[
6
- SimpleCov::Formatter::HTMLFormatter,
7
- Coveralls::SimpleCov::Formatter,
8
- ]
9
- command_name "Unit Tests"
10
- add_filter "/test/"
11
- add_filter "/demo/"
12
- end
7
+ SimpleCov.start do
8
+ formatter SimpleCov::Formatter::MultiFormatter[
9
+ SimpleCov::Formatter::HTMLFormatter,
10
+ Coveralls::SimpleCov::Formatter,
11
+ ]
12
+ command_name "Unit Tests"
13
+ add_filter "/test/"
14
+ add_filter "/demo/"
15
+ end
13
16
 
14
- Coveralls.noisy = true unless ENV['CI']
17
+ Coveralls.noisy = true unless ENV['CI']
18
+ end
15
19
 
16
20
  require 'minitest/autorun'
17
21
  require 'minitest/unit'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-wrappers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Papis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-19 00:00:00.000000000 Z
11
+ date: 2013-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -38,48 +38,6 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: simplecov
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '>='
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: coveralls
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '>='
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: redcarpet
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - '>='
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - '>='
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
41
  description:
84
42
  email:
85
43
  - mpapis@gmail.com