depend 0.0.1.pre.rc2 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/depend.gemspec +1 -0
- data/lib/depend.rb +6 -8
- data/lib/depend/installer.rb +6 -4
- data/lib/depend/package_provider/common.rb +1 -0
- data/lib/depend/package_provider/homebrew.rb +1 -0
- data/lib/depend/{registerable.rb → register.rb} +20 -10
- data/lib/depend/version.rb +1 -1
- data/lib/rubygems_plugin.rb +2 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd730b57a1948b0210772ec767027abf067394d1
|
4
|
+
data.tar.gz: 0d8fb7412056aa7b4f86e7b153f62f694713902c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31a3058204a9fac8c08a05c799049c852c2d0627a1f63511119564c52b5f5ef32dae925c946e32bba2a1dec4178d4794ed589382deffcfa4f35e456269d1a6bd
|
7
|
+
data.tar.gz: 9b6e2f83093d9eb2b10bb73d4e8afd126d4a2a23f61bc034c4357a78794e8be85a18f554abc91c61fcfad9d6e16d67caa29891606936226122241d149fdf804c
|
data/depend.gemspec
CHANGED
data/lib/depend.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "depend/version"
|
2
2
|
|
3
3
|
module Depend
|
4
|
-
autoload :
|
4
|
+
autoload :Register, "depend/register"
|
5
5
|
autoload :Dependent, "depend/dependent"
|
6
6
|
autoload :Configuration, "depend/configuration"
|
7
7
|
|
@@ -28,22 +28,20 @@ module Depend
|
|
28
28
|
yield(configuration)
|
29
29
|
end
|
30
30
|
|
31
|
+
def self.register
|
32
|
+
@register_instance ||= Register.init_with_default_register
|
33
|
+
end
|
34
|
+
|
31
35
|
class Base
|
32
|
-
extend Registerable
|
33
36
|
extend Dependent
|
34
37
|
|
35
|
-
self.register PackageProvider::Apt, 'Ubuntu'
|
36
|
-
self.register PackageProvider::Homebrew, 'MacOS'
|
37
|
-
|
38
|
-
OPERATION_SYSTEMS = %w{ Ubuntu MacOS }.freeze
|
39
|
-
|
40
38
|
def initialize(platform, platform_version = nil)
|
41
39
|
@platform = platform
|
42
40
|
@platform_version = platform_version
|
43
41
|
end
|
44
42
|
|
45
43
|
def package_providers
|
46
|
-
|
44
|
+
Depend.register.package_providers_for(@platform, @platform_version)
|
47
45
|
end
|
48
46
|
|
49
47
|
def dependencies_for(package_provider)
|
data/lib/depend/installer.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
require 'os_platform'
|
2
2
|
|
3
3
|
module Depend
|
4
|
+
class InstallError < ::Gem::InstallError; end
|
5
|
+
|
4
6
|
class Installer
|
5
7
|
|
6
|
-
def self.install
|
7
|
-
install_platform_dependencies
|
8
|
+
def self.install(spec)
|
9
|
+
install_platform_dependencies(spec)
|
8
10
|
end
|
9
11
|
|
10
|
-
def self.install_platform_dependencies
|
12
|
+
def self.install_platform_dependencies(spec)
|
11
13
|
puts "install dependency for gem"
|
12
14
|
os_platform = OSPlatform.local
|
13
15
|
depend_instance = Depend::Base.new(os_platform.platform, os_platform.platform_version)
|
@@ -20,7 +22,7 @@ module Depend
|
|
20
22
|
puts "Trying to install native dependencies for Gem '#{spec.name}': #{deps.join ' '}"
|
21
23
|
deps.each do |dep|
|
22
24
|
unless package_provider.install(spec.name, dep)
|
23
|
-
|
25
|
+
fail Depend::InstallError, "Failed to install native dependencies for '#{spec.name}'."
|
24
26
|
end
|
25
27
|
end
|
26
28
|
end
|
@@ -1,14 +1,29 @@
|
|
1
1
|
module Depend
|
2
2
|
class PlatformNotSupportedError < StandardError; end
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
class Register
|
5
|
+
|
6
|
+
OPERATION_SYSTEMS = %w{ Ubuntu mac_os_x }.freeze
|
7
|
+
attr_reader :platforms
|
8
|
+
|
9
|
+
def self.init_with_default_register
|
10
|
+
instance = self.new
|
11
|
+
instance.register PackageProvider::Apt, 'Ubuntu'
|
12
|
+
instance.register PackageProvider::Homebrew, 'mac_os_x'
|
13
|
+
instance
|
14
|
+
end
|
7
15
|
|
8
16
|
def acceptable_operations_systems
|
9
17
|
OPERATION_SYSTEMS
|
10
18
|
end
|
11
19
|
|
20
|
+
def package_providers_for(platform, platform_version)
|
21
|
+
puts @platforms
|
22
|
+
return [] if @platforms.nil? || @platforms.empty?
|
23
|
+
_platform = @platforms[platform] || []
|
24
|
+
_platform.select{|plat| version_include?(plat.shift, platform_version)}.map(&:last)
|
25
|
+
end
|
26
|
+
|
12
27
|
def register(package_provider, platform, platform_version = nil)
|
13
28
|
puts "in register"
|
14
29
|
fail PlatformNotSupportedError unless platform_accepted?(platform)
|
@@ -20,12 +35,6 @@ module Depend
|
|
20
35
|
end
|
21
36
|
end
|
22
37
|
|
23
|
-
def package_providers_for(platform, platform_version)
|
24
|
-
return [] if @platforms.nil? || @platforms.empty?
|
25
|
-
_platform = @platforms[platform]
|
26
|
-
_platform.select{|plat| version_include?(plat.shift, platform_version)}.map(&:last)
|
27
|
-
end
|
28
|
-
|
29
38
|
private
|
30
39
|
|
31
40
|
def version_include?(version_string, platform_version)
|
@@ -41,7 +50,8 @@ module Depend
|
|
41
50
|
end
|
42
51
|
|
43
52
|
def platform_accepted?(platform)
|
44
|
-
|
53
|
+
acceptable_operations_systems.map(&:downcase).include?(platform.downcase)
|
45
54
|
end
|
55
|
+
|
46
56
|
end
|
47
57
|
end
|
data/lib/depend/version.rb
CHANGED
data/lib/rubygems_plugin.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: depend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Newell Zhu
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 5.7.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: mocha
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.1.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.1.0
|
69
83
|
description: RubyGems Native Depend Solution.
|
70
84
|
email:
|
71
85
|
- zlx.star@gmail.com
|
@@ -88,7 +102,7 @@ files:
|
|
88
102
|
- lib/depend/package_provider/apt.rb
|
89
103
|
- lib/depend/package_provider/common.rb
|
90
104
|
- lib/depend/package_provider/homebrew.rb
|
91
|
-
- lib/depend/
|
105
|
+
- lib/depend/register.rb
|
92
106
|
- lib/depend/version.rb
|
93
107
|
- lib/rubygems_plugin.rb
|
94
108
|
homepage: https://github.com/zlx/depend
|
@@ -106,9 +120,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
120
|
version: '0'
|
107
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
122
|
requirements:
|
109
|
-
- - "
|
123
|
+
- - ">="
|
110
124
|
- !ruby/object:Gem::Version
|
111
|
-
version:
|
125
|
+
version: '0'
|
112
126
|
requirements: []
|
113
127
|
rubyforge_project:
|
114
128
|
rubygems_version: 2.2.0
|