emplace 0.1.4 → 0.1.7

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/emplace.rb +55 -48
  3. data/test/emplace-test.rb +2 -4
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65d254de88cfa79c37429e9ed5265604ae0c13f0
4
- data.tar.gz: dfd2d00dcbcc61ceefff90a47122ffff0e485251
3
+ metadata.gz: b144f6bb99df6ed689df617404919bb2ba11249d
4
+ data.tar.gz: a88cb236d52bd5ec904545fca8912571f7861fa7
5
5
  SHA512:
6
- metadata.gz: 6cace8085c721261221cc229027048048061c52c2a1de5cb758ae08ba2f547006772d67a296af1bc384781aa99854d0e71f6d060f62ba883f938b70132d3a4a0
7
- data.tar.gz: 63002826a5a33275b78ef9c4ad6461bb3fd04b561dc5bc639033b266b3e8d6e9c6204deff837d0ee530b7398769d033e5dbedab9f8fbac0355dab1fa9cbefc13
6
+ metadata.gz: 90367dc321118ecbc5023aa9daa100b64c5baee4b8801851699010855a4e7d8b7fd32c28ba3cc68a919732ebc926b19fcc3cdcb4e44f2359bd361781ce60a1fb
7
+ data.tar.gz: 93949f99b0da4a6762dad3153770fd8c47a4c522bd4214becb42d1a73116f896f570ecf0f925cedcff8f6068eb123ebf39cbb97ee71f97ee641bee7e08eb942c
data/lib/emplace.rb CHANGED
@@ -24,7 +24,7 @@ module Emplace
24
24
  end
25
25
  end
26
26
 
27
- class CmakeBuild
27
+ class CMakeBuild
28
28
  def build_dir
29
29
  'build'
30
30
  end
@@ -54,7 +54,7 @@ module Emplace
54
54
  end
55
55
  end
56
56
 
57
- class Unix < CmakeBuild
57
+ class Unix < CMakeBuild
58
58
  def cmake_generator
59
59
  'Unix Makefiles'
60
60
  end
@@ -81,7 +81,7 @@ module Emplace
81
81
  end
82
82
  end
83
83
 
84
- class Windows < CmakeBuild
84
+ class Windows < CMakeBuild
85
85
  def system_name
86
86
  "win-#{arch}"
87
87
  end
@@ -90,54 +90,59 @@ module Emplace
90
90
  end
91
91
  end
92
92
 
93
- module Travis
94
- def system_name
95
- if cc = ENV['CC']
96
- "#{super}-#{cc}"
97
- else
98
- super
93
+ private
94
+ def self.travis(base)
95
+ Class.new(base) {
96
+ def system_name
97
+ if cc = ENV['CC']
98
+ "#{super}-#{cc}"
99
+ else
100
+ super
101
+ end
99
102
  end
100
- end
103
+ }
101
104
  end
102
105
 
103
- module AppVeyor
104
- def cmake_generator
105
- case arch
106
- when 'x86'
107
- 'Visual Studio 14'
108
- when 'x64'
109
- 'Visual Studio 14 Win64'
106
+ def self.appveyor(base)
107
+ Class.new(base) {
108
+ def cmake_generator
109
+ case arch
110
+ when 'x86'
111
+ 'Visual Studio 14'
112
+ when 'x64'
113
+ 'Visual Studio 14 Win64'
114
+ end
110
115
  end
111
- end
112
- def arch
113
- case ENV['PLATFORM']
114
- when'x64'
115
- 'x64'
116
- else
117
- 'x86'
116
+ def arch
117
+ case ENV['PLATFORM']
118
+ when'x64'
119
+ 'x64'
120
+ else
121
+ 'x86'
122
+ end
118
123
  end
119
- end
120
- def system_name
121
- if cfg = ENV['CONFIGURATION']
122
- "#{super}-msvc-#{cfg.downcase}"
123
- else
124
- "#{super}-msvc"
124
+ def system_name
125
+ if cfg = ENV['CONFIGURATION']
126
+ "#{super}-msvc-#{cfg.downcase}"
127
+ else
128
+ "#{super}-msvc"
129
+ end
125
130
  end
126
- end
127
- def build
128
- if cfg = ENV['CONFIGURATION']
129
- sh "cmake --build #{build_dir} --target install --config #{cfg}"
130
- else
131
- super
131
+ def build
132
+ if cfg = ENV['CONFIGURATION']
133
+ sh "cmake --build #{build_dir} --target install --config #{cfg}"
134
+ else
135
+ super
136
+ end
132
137
  end
133
- end
134
- def package(name)
135
- sh "7z a #{package_name(name)} #{name}", dist_dir
136
- end
138
+ def package(name)
139
+ sh "7z a #{package_name(name)} #{name}", dist_dir
140
+ end
141
+ }
137
142
  end
138
143
 
139
144
  def self.load_env
140
- case RUBY_PLATFORM
145
+ platform = case RUBY_PLATFORM
141
146
  when /mswin|mingw/
142
147
  Windows
143
148
  when /darwin/
@@ -146,13 +151,15 @@ module Emplace
146
151
  Linux
147
152
  else
148
153
  Unix
149
- end.tap {|platform|
150
- if ENV['TRAVIS']
151
- platform.send(:include, Travis)
152
- elsif ENV['APPVEYOR']
153
- platform.send(:include, AppVeyor)
154
- end
155
- }.new
154
+ end
155
+
156
+ if ENV['TRAVIS']
157
+ travis platform
158
+ elsif ENV['APPVEYOR']
159
+ appveyor platform
160
+ else
161
+ platform
162
+ end.new
156
163
  end
157
164
 
158
165
  end
data/test/emplace-test.rb CHANGED
@@ -52,9 +52,8 @@ class TestEmplace < Test::Unit::TestCase
52
52
  ], appveyor.commands
53
53
  end
54
54
 
55
- class Travis < Emplace::Linux
55
+ class Travis < Emplace.send(:travis, Emplace::Linux)
56
56
  attr_reader :commands
57
- include Emplace::Travis
58
57
  def arch
59
58
  'x86_64'
60
59
  end
@@ -63,9 +62,8 @@ class TestEmplace < Test::Unit::TestCase
63
62
  end
64
63
  end
65
64
 
66
- class AppVeyor < Emplace::Windows
65
+ class AppVeyor < Emplace.send(:appveyor, Emplace::Windows)
67
66
  attr_reader :commands
68
- include Emplace::AppVeyor
69
67
  def arch
70
68
  'x64'
71
69
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emplace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Calhoun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-17 00:00:00.000000000 Z
11
+ date: 2015-12-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Keeps settings for running cmake builds on Travis-CI and AppVeyor.
14
14
  email: