hem 1.0.1.beta2 → 1.0.1.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/hem/lib/seed/project.rb +26 -20
- data/lib/hem/paths.rb +19 -20
- data/lib/hem/tasks/deps.rb +30 -11
- data/lib/hem/util.rb +4 -0
- data/lib/hem/version.rb +1 -1
- data/spec/hem/helpers/command_spec.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e24a451f5acc1defa6a9387d956e907929a5f7ea
|
4
|
+
data.tar.gz: 5b1841273e1dd1ac7845c5aa56476f2341dcce7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a84691eb109695fb6bcd95dbd9a204109fc7ac1a23978c5124ebe03c2a8670f9cb798a8e589e952fd4b52c0c005df9967aea7fb051fbcb7a9f195caace93947e
|
7
|
+
data.tar.gz: c18bb3bafa2689768e5bad00541ef6c983f3a23c6d65d2323bc42dec4deaf04fea3bf6a51566451c3019520741160cde192b336d5e0344fc06ade253019a3e12
|
data/Gemfile.lock
CHANGED
data/lib/hem/lib/seed/project.rb
CHANGED
@@ -6,34 +6,40 @@ module Hem
|
|
6
6
|
@opts = {
|
7
7
|
:replacer => Replacer.new,
|
8
8
|
:config_class => Hem::Config::File,
|
9
|
-
:project_config_file => Hem.project_config_file,
|
10
9
|
:ssl_cert_generator => Hem::Lib::SelfSignedCertGenerator
|
11
10
|
}.merge! opts
|
12
11
|
end
|
13
12
|
|
14
13
|
def setup seed, config
|
14
|
+
project_path = config[:project_path]
|
15
|
+
|
15
16
|
seed.update
|
16
|
-
seed.export
|
17
|
-
config[:seed][:version] = seed.version
|
18
|
-
config[:hostname] = "#{config[:name]}.dev"
|
19
|
-
config[:asset_bucket] = "inviqa-assets-#{config[:name]}"
|
20
|
-
config[:vm] = {
|
21
|
-
:project_mount_path => "/vagrant"
|
22
|
-
}
|
23
|
-
config[:ssl] = @opts[:ssl_cert_generator].generate config[:hostname]
|
24
|
-
config[:chef_ssl] = {}
|
25
|
-
config[:ssl].each do |k, v|
|
26
|
-
config[:chef_ssl][k] = v.gsub("\n", "\\n")
|
27
|
-
end
|
17
|
+
seed.export project_path, config
|
28
18
|
|
29
|
-
|
30
|
-
|
19
|
+
Dir.chdir(project_path) do
|
20
|
+
Hem.detect_project_type project_path
|
21
|
+
@opts[:project_config_file] = Hem.project_config_file
|
31
22
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
23
|
+
config[:seed][:version] = seed.version
|
24
|
+
config[:hostname] = "#{config[:name]}.dev"
|
25
|
+
config[:asset_bucket] = "inviqa-assets-#{config[:name]}"
|
26
|
+
config[:vm] = {
|
27
|
+
:project_mount_path => "/vagrant"
|
28
|
+
}
|
29
|
+
config[:ssl] = @opts[:ssl_cert_generator].generate config[:hostname]
|
30
|
+
config[:chef_ssl] = {}
|
31
|
+
config[:ssl].each do |k, v|
|
32
|
+
config[:chef_ssl][k] = v.gsub("\n", "\\n")
|
33
|
+
end
|
34
|
+
|
35
|
+
@opts[:replacer].replace(config[:project_path], config)
|
36
|
+
load_seed_init(config)
|
37
|
+
|
38
|
+
config.delete :project_path
|
39
|
+
config.delete :ssl
|
40
|
+
config.delete :chef_ssl
|
41
|
+
@opts[:config_class].save @opts[:project_config_file], config
|
42
|
+
end
|
37
43
|
|
38
44
|
initialize_git project_path, config[:git_url]
|
39
45
|
end
|
data/lib/hem/paths.rb
CHANGED
@@ -12,8 +12,9 @@ module Hem
|
|
12
12
|
File.join(config_path, 'seeds')
|
13
13
|
end
|
14
14
|
|
15
|
-
def detect_project_type
|
16
|
-
|
15
|
+
def detect_project_type limit_path = nil
|
16
|
+
@project_type = 'Hem'
|
17
|
+
@project_path = nil
|
17
18
|
|
18
19
|
searches = [
|
19
20
|
{ type: "Hem", indicators: [ "Hemfile", "tools/hem"] },
|
@@ -21,21 +22,15 @@ module Hem
|
|
21
22
|
{ type: "Hem", indicators: ["tools/vagrant/Vagrantfile"] }
|
22
23
|
]
|
23
24
|
|
24
|
-
searches
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
@project_type = search[:type]
|
29
|
-
@project_path = path
|
30
|
-
break
|
31
|
-
end
|
25
|
+
match = project_path_compat searches, limit_path
|
26
|
+
if match
|
27
|
+
@project_type = match[:type]
|
28
|
+
@project_path = match[:path]
|
32
29
|
end
|
33
|
-
|
34
|
-
@project_type ||= 'Hem'
|
35
30
|
end
|
36
31
|
|
37
32
|
def project_dsl_type
|
38
|
-
detect_project_type
|
33
|
+
detect_project_type if @project_type.nil?
|
39
34
|
@project_type
|
40
35
|
end
|
41
36
|
|
@@ -44,26 +39,30 @@ module Hem
|
|
44
39
|
end
|
45
40
|
|
46
41
|
def project_path
|
47
|
-
detect_project_type
|
42
|
+
detect_project_type if @project_type.nil?
|
48
43
|
@project_path
|
49
44
|
end
|
50
45
|
|
51
|
-
def project_path_compat
|
46
|
+
def project_path_compat searches, limit_path = nil
|
52
47
|
dir = Dir.pwd.split('/').reverse
|
53
48
|
min_length = Gem.win_platform? ? 1 : 0
|
54
49
|
Hem::Logging.logger.debug("paths.project: Searching backwards from #{Dir.pwd}")
|
55
50
|
|
56
51
|
while dir.length > min_length
|
57
52
|
test_dir = dir.reverse.join('/')
|
53
|
+
return nil unless limit_path.nil? || test_dir.start_with?(limit_path)
|
54
|
+
|
58
55
|
Hem::Logging.logger.debug("paths.project: Testing #{test_dir}")
|
59
56
|
|
60
|
-
|
61
|
-
|
62
|
-
|
57
|
+
searches.each do |search|
|
58
|
+
results = search[:indicators].map do |s|
|
59
|
+
File.exists?(File.join(test_dir, s))
|
60
|
+
end
|
63
61
|
|
64
|
-
|
62
|
+
match = results - [false]
|
65
63
|
|
66
|
-
|
64
|
+
return {type: search[:type], path: test_dir} if match.length > 0
|
65
|
+
end
|
67
66
|
|
68
67
|
dir.shift
|
69
68
|
end
|
data/lib/hem/tasks/deps.rb
CHANGED
@@ -5,10 +5,18 @@ namespace :deps do
|
|
5
5
|
desc "Install Gem dependencies"
|
6
6
|
task :gems do
|
7
7
|
locate "*Gemfile" do
|
8
|
-
required = shell("bundle
|
8
|
+
required = shell("bundle check", :exit_status => true) != 0
|
9
9
|
if required
|
10
10
|
Hem.ui.title "Installing Gem dependencies"
|
11
|
-
|
11
|
+
|
12
|
+
bundler_args = "#{Hem.user_config.bundler_args} #{Hem.project_config.bundler_args}".strip
|
13
|
+
|
14
|
+
command = [
|
15
|
+
'bundle install',
|
16
|
+
bundler_args.empty? ? nil : bundler_args
|
17
|
+
].compact.join(' ')
|
18
|
+
|
19
|
+
shell command, realtime: true, indent: 2
|
12
20
|
Hem.ui.separator
|
13
21
|
end
|
14
22
|
end
|
@@ -50,24 +58,35 @@ namespace :deps do
|
|
50
58
|
|
51
59
|
desc "Install vagrant plugins"
|
52
60
|
task :vagrant_plugins => [ "deps:gems" ] do
|
61
|
+
require 'semantic'
|
53
62
|
plugins = shell "vagrant plugin list", :capture => true
|
54
63
|
locate "*Vagrantfile" do
|
55
|
-
to_install =
|
64
|
+
to_install = {}
|
56
65
|
File.read("Vagrantfile").split("\n").each do |line|
|
57
|
-
if line.match
|
58
|
-
to_install
|
66
|
+
if line.match(/#\s*(?:Hem|Hobo)\.(vagrant_plugin.*)/)
|
67
|
+
to_install.merge! Hash[[eval("Hem.#{$1}")]]
|
59
68
|
else
|
60
69
|
next if line.match /^\s*#/
|
61
70
|
next unless line.match /Vagrant\.require_plugin (.*)/
|
62
|
-
to_install
|
71
|
+
to_install[$1.gsub(/['"]*/, '')] = nil
|
63
72
|
end
|
64
73
|
end
|
65
74
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
75
|
+
plugins = Hash[
|
76
|
+
plugins.scan(/^([^\s]+)\s+\(([^,\)]+)(?:,[^\)]+)?\)$/).map do |plugin, version|
|
77
|
+
[plugin, Semantic::Version.new(version)]
|
78
|
+
end
|
79
|
+
]
|
80
|
+
|
81
|
+
to_install.each do |plugin, constraint|
|
82
|
+
next if plugins.has_key?(plugin) && (constraint.nil? || plugins[plugin].satisfies(constraint))
|
83
|
+
Hem.ui.title "Installing vagrant plugin: #{plugin}#{constraint && " #{constraint}"}"
|
84
|
+
args = ["vagrant", "plugin", "install", plugin]
|
85
|
+
if constraint
|
86
|
+
args << '--plugin-version'
|
87
|
+
args << constraint
|
88
|
+
end
|
89
|
+
shell *args, :realtime => true, :indent => 2
|
71
90
|
Hem.ui.separator
|
72
91
|
end
|
73
92
|
end
|
data/lib/hem/util.rb
CHANGED
data/lib/hem/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.1.
|
4
|
+
version: 1.0.1.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Simons
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slop
|