codestrap 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +20 -0
  3. data/.travis.yml +4 -0
  4. data/.yardopts +3 -0
  5. data/BOILERPLATE.md +151 -0
  6. data/CODESTRAPFILE.md +28 -0
  7. data/Gemfile +6 -0
  8. data/LICENSE.txt +13 -0
  9. data/README.md +69 -0
  10. data/Rakefile +51 -0
  11. data/bin/strap +8 -0
  12. data/bin/upstrap +8 -0
  13. data/codestrap.gemspec +37 -0
  14. data/config/projects/codestrap.rb +22 -0
  15. data/config/software/codestrap.rb +20 -0
  16. data/config/software/ruby.rb +247 -0
  17. data/config/software/zlib.rb +86 -0
  18. data/features/client.feature +99 -0
  19. data/features/fixtures/client/home/codestrap/bin/.empty +0 -0
  20. data/features/fixtures/client/home/codestrap/content/bash.erb +3 -0
  21. data/features/fixtures/client/home/codestrap/content/gem/dir/file +0 -0
  22. data/features/fixtures/client/home/codestrap/content/gem/dir/template +3 -0
  23. data/features/fixtures/client/home/codestrap/content/gem/file +1 -0
  24. data/features/fixtures/client/home/codestrap/content/gem/template +3 -0
  25. data/features/fixtures/client/home/codestrap/content/local_remote.erb +1 -0
  26. data/features/fixtures/client/home/codestrap/content/local_remote/dir/file +0 -0
  27. data/features/fixtures/client/home/codestrap/content/local_remote/dir/template +3 -0
  28. data/features/fixtures/client/home/codestrap/content/local_remote/file +1 -0
  29. data/features/fixtures/client/home/codestrap/content/local_remote/template +3 -0
  30. data/features/fixtures/client/home/codestrap/objects/local.json +3 -0
  31. data/features/fixtures/client/output/.empty +0 -0
  32. data/features/fixtures/client/var/lib/codestrap/bin/.empty +0 -0
  33. data/features/fixtures/client/var/lib/codestrap/content/bashremote.erb +3 -0
  34. data/features/fixtures/client/var/lib/codestrap/content/gemremote/dir/file +0 -0
  35. data/features/fixtures/client/var/lib/codestrap/content/gemremote/dir/template +3 -0
  36. data/features/fixtures/client/var/lib/codestrap/content/gemremote/file +0 -0
  37. data/features/fixtures/client/var/lib/codestrap/content/gemremote/template +3 -0
  38. data/features/fixtures/client/var/lib/codestrap/content/remote_local.erb +1 -0
  39. data/features/fixtures/client/var/lib/codestrap/content/remote_local/dir/file +0 -0
  40. data/features/fixtures/client/var/lib/codestrap/content/remote_local/dir/template +3 -0
  41. data/features/fixtures/client/var/lib/codestrap/content/remote_local/file +1 -0
  42. data/features/fixtures/client/var/lib/codestrap/content/remote_local/template +3 -0
  43. data/features/fixtures/client/var/lib/codestrap/content/remote_remote.erb +1 -0
  44. data/features/fixtures/client/var/lib/codestrap/content/remote_remote/dir/file +0 -0
  45. data/features/fixtures/client/var/lib/codestrap/content/remote_remote/dir/template +3 -0
  46. data/features/fixtures/client/var/lib/codestrap/content/remote_remote/file +0 -0
  47. data/features/fixtures/client/var/lib/codestrap/content/remote_remote/template +3 -0
  48. data/features/fixtures/client/var/lib/codestrap/objects/remote.json +3 -0
  49. data/features/fixtures/logging/home/logging/codestrap/bin/stubdirectory/.empty +0 -0
  50. data/features/fixtures/logging/home/logging/codestrap/bin/stubnotlink +0 -0
  51. data/features/fixtures/logging/home/logging/codestrap/content/.empty +0 -0
  52. data/features/fixtures/logging/home/logging/codestrap/objects/.empty +0 -0
  53. data/features/fixtures/server/mixed/var/lib/stub/content/address.erb +3 -0
  54. data/features/fixtures/server/mixed/var/lib/stub/content/cell.erb +3 -0
  55. data/features/fixtures/server/mixed/var/lib/stub/content/email.erb +3 -0
  56. data/features/fixtures/server/mixed/var/lib/stub/content/mobile.erb +3 -0
  57. data/features/fixtures/server/mixed/var/lib/stub/content/name.erb +3 -0
  58. data/features/fixtures/server/mixed/var/lib/stub/content/phone.erb +3 -0
  59. data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/Modulefile +12 -0
  60. data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/README +17 -0
  61. data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/manifests/init.pp +42 -0
  62. data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/spec/spec_helper.rb +18 -0
  63. data/features/fixtures/server/mixed/var/lib/stub/content/puppetmodule/tests/init.pp +13 -0
  64. data/features/fixtures/server/mixed/var/lib/stub/objects/contact.json +8 -0
  65. data/features/fixtures/server/mixed/var/lib/stub/objects/shadow/contact.json +8 -0
  66. data/features/fixtures/strap/projects/etc/.empty +0 -0
  67. data/features/fixtures/strap/projects/home/user/dir/bin/.empty +0 -0
  68. data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/Modulefile +12 -0
  69. data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/README +17 -0
  70. data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/manifests/:stub:project.name:/subclass.pp +3 -0
  71. data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/manifests/init.pp +42 -0
  72. data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/spec/spec_helper.rb +18 -0
  73. data/features/fixtures/strap/projects/home/user/dir/content/puppetmodule/tests/init.pp +13 -0
  74. data/features/fixtures/strap/projects/home/user/dir/objects/contact.json +8 -0
  75. data/features/fixtures/strap/projects/home/user/dir/objects/shadow/contact.json +8 -0
  76. data/features/fixtures/strap/projects/output/.empty +0 -0
  77. data/features/fixtures/stub/contact/etc/.empty +0 -0
  78. data/features/fixtures/stub/contact/home/user/dir/bin/.empty +0 -0
  79. data/features/fixtures/stub/contact/home/user/dir/content/address.erb +3 -0
  80. data/features/fixtures/stub/contact/home/user/dir/content/cell.erb +3 -0
  81. data/features/fixtures/stub/contact/home/user/dir/content/email.erb +3 -0
  82. data/features/fixtures/stub/contact/home/user/dir/content/mobile.erb +3 -0
  83. data/features/fixtures/stub/contact/home/user/dir/content/name.erb +3 -0
  84. data/features/fixtures/stub/contact/home/user/dir/content/phone.erb +3 -0
  85. data/features/fixtures/stub/contact/home/user/dir/objects/contact.json +8 -0
  86. data/features/fixtures/stub/contact/home/user/dir/objects/shadow/contact.json +8 -0
  87. data/features/fixtures/stub/contact/output/.empty +0 -0
  88. data/features/fixtures/stub/date/etc/.empty +0 -0
  89. data/features/fixtures/stub/date/home/user/stub/bin/.empty +0 -0
  90. data/features/fixtures/stub/date/home/user/stub/content/day.erb +3 -0
  91. data/features/fixtures/stub/date/home/user/stub/content/hour.erb +3 -0
  92. data/features/fixtures/stub/date/home/user/stub/content/minute.erb +3 -0
  93. data/features/fixtures/stub/date/home/user/stub/content/month.erb +3 -0
  94. data/features/fixtures/stub/date/home/user/stub/content/second.erb +3 -0
  95. data/features/fixtures/stub/date/home/user/stub/content/year.erb +3 -0
  96. data/features/fixtures/stub/date/home/user/stub/objects/.empty +0 -0
  97. data/features/fixtures/stub/date/output/.empty +0 -0
  98. data/features/fixtures/stub/script/etc/.empty +0 -0
  99. data/features/fixtures/stub/script/home/user/stub/bin/.empty +0 -0
  100. data/features/fixtures/stub/script/home/user/stub/content/credentials.erb +6 -0
  101. data/features/fixtures/stub/script/home/user/stub/objects/credentials.rb +11 -0
  102. data/features/fixtures/stub/script/output/.empty +0 -0
  103. data/features/logging.feature +39 -0
  104. data/features/object_scripts.feature +13 -0
  105. data/features/server.feature +36 -0
  106. data/features/step_definitions/client_steps.rb +99 -0
  107. data/features/step_definitions/logging_steps.rb +65 -0
  108. data/features/step_definitions/object_scripts_steps.rb +26 -0
  109. data/features/step_definitions/server_steps.rb +112 -0
  110. data/features/step_definitions/strap_steps.rb +69 -0
  111. data/features/step_definitions/stub_option_simple_steps.rb +31 -0
  112. data/features/step_definitions/stub_steps.rb +94 -0
  113. data/features/strap.feature +34 -0
  114. data/features/stub.feature +157 -0
  115. data/features/stub_option_simple.feature +14 -0
  116. data/features/stub_packages.feature +15 -0
  117. data/features/support/env.rb +197 -0
  118. data/lib/codestrap.rb +415 -0
  119. data/lib/codestrap/cli.rb +76 -0
  120. data/lib/codestrap/client.rb +179 -0
  121. data/lib/codestrap/config.rb +199 -0
  122. data/lib/codestrap/log.rb +56 -0
  123. data/lib/codestrap/mixin.rb +20 -0
  124. data/lib/codestrap/namespace.rb +19 -0
  125. data/lib/codestrap/object/abstract.rb +33 -0
  126. data/lib/codestrap/object/factory.rb +86 -0
  127. data/lib/codestrap/object/standard/datetime.rb +24 -0
  128. data/lib/codestrap/object/standard/files.rb +40 -0
  129. data/lib/codestrap/object/standard/project.rb +33 -0
  130. data/lib/codestrap/object/standard/rest.rb +30 -0
  131. data/lib/codestrap/patch.rb +122 -0
  132. data/lib/codestrap/server/rest.rb +177 -0
  133. data/lib/codestrap/server/version.rb +5 -0
  134. data/lib/codestrap/strap/abstract.rb +135 -0
  135. data/lib/codestrap/strap/factory.rb +85 -0
  136. data/lib/codestrap/strap/standard.rb +95 -0
  137. data/lib/codestrap/stub/abstract.rb +156 -0
  138. data/lib/codestrap/stub/factory.rb +87 -0
  139. data/lib/codestrap/stub/standard.rb +23 -0
  140. data/lib/codestrap/version.rb +3 -0
  141. data/omnibus.rb +53 -0
  142. data/package-scripts/codestrap/postinst +25 -0
  143. data/package-scripts/codestrap/postrm +17 -0
  144. data/package-scripts/codestrap/preinst +7 -0
  145. data/package-scripts/codestrap/prerm +15 -0
  146. data/resources/codestrap/pkg/background.png +0 -0
  147. data/resources/codestrap/pkg/distribution.xml.erb +22 -0
  148. data/resources/codestrap/pkg/license.html.erb +202 -0
  149. data/resources/codestrap/pkg/welcome.html.erb +7 -0
  150. metadata +466 -0
@@ -0,0 +1,20 @@
1
+ require File.absolute_path(File.join(File.dirname(__FILE__),'..','..','lib','codestrap','version'))
2
+
3
+ name 'codestrap'
4
+ default_version Codestrap::VERSION
5
+
6
+ dependency 'ruby'
7
+ dependency 'rubygems'
8
+
9
+ build do
10
+ pkg = File.absolute_path(File.join(File.dirname(__FILE__),'..','..','pkg',"codestrap-#{version}.gem"))
11
+ gem "install #{pkg} -n #{install_dir}/bin --no-rdoc --no-ri -v #{version}"
12
+ command "rm -rf /opt/#{name}/embedded/docs"
13
+ command "rm -rf /opt/#{name}/embedded/share/man"
14
+ command "rm -rf /opt/#{name}/embedded/share/doc"
15
+ command "rm -rf /opt/#{name}/embedded/ssl/man"
16
+ command "rm -rf /opt/#{name}/embedded/info"
17
+ command "rm -rf /opt/#{name}/bin/upstrap"
18
+ command "rm -rf /opt/#{name}/bin/rackup"
19
+ command "rm -rf /opt/#{name}/bin/tilt"
20
+ end
@@ -0,0 +1,247 @@
1
+ #
2
+ # Copyright 2012-2016 Chef Software, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ name "ruby"
18
+
19
+ license "BSD-2-Clause"
20
+ license_file "BSDL"
21
+ license_file "COPYING"
22
+ license_file "LEGAL"
23
+
24
+ # - chef-client cannot use 2.2.x yet due to a bug in IRB that affects chef-shell on linux:
25
+ # https://bugs.ruby-lang.org/issues/11869
26
+ # - the current status of 2.3.x is that it downloads but fails to compile.
27
+ # - verify that all ffi libs are available for your version on all platforms.
28
+ default_version "2.2.5"
29
+
30
+ fips_enabled = (project.overrides[:fips] && project.overrides[:fips][:enabled]) || false
31
+
32
+ dependency "patch" if solaris_10?
33
+ dependency "ncurses" unless windows? || version.satisfies?(">= 2.1")
34
+ dependency "zlib"
35
+ dependency "openssl"
36
+ dependency "libffi"
37
+ dependency "libyaml"
38
+ # Needed for chef_gem installs of (e.g.) nokogiri on upgrades -
39
+ # they expect to see our libiconv instead of a system version.
40
+ # Ignore on windows - TDM GCC comes with libiconv in the runtime
41
+ # and that's the only one we will ever use.
42
+ dependency "libiconv"
43
+
44
+ version("2.3.0") { source md5: "e81740ac7b14a9f837e9573601db3162" }
45
+
46
+ version("2.2.5") { source md5: "bd8e349d4fb2c75d90817649674f94be" }
47
+ version("2.2.4") { source md5: "9a5e15f9d5255ba37ace18771b0a8dd2" }
48
+ version("2.2.3") { source md5: "150a5efc5f5d8a8011f30aa2594a7654" }
49
+ version("2.2.2") { source md5: "326e99ddc75381c7b50c85f7089f3260" }
50
+ version("2.2.1") { source md5: "b49fc67a834e4f77249eb73eecffb1c9" }
51
+ version("2.2.0") { source md5: "cd03b28fd0b555970f5c4fd481700852" }
52
+
53
+ version("2.1.8") { source md5: "091b62f0a9796a3c55de2a228a0e6ef3" }
54
+ version("2.1.7") { source md5: "2e143b8e19b056df46479ae4412550c9" }
55
+ version("2.1.6") { source md5: "6e5564364be085c45576787b48eeb75f" }
56
+ version("2.1.5") { source md5: "df4c1b23f624a50513c7a78cb51a13dc" }
57
+ version("2.1.4") { source md5: "89b2f4a197621346f6724a3c35535b19" }
58
+ version("2.1.3") { source md5: "74a37b9ad90e4ea63c0eed32b9d5b18f" }
59
+ version("2.1.2") { source md5: "a5b5c83565f8bd954ee522bd287d2ca1" }
60
+ version("2.1.1") { source md5: "e57fdbb8ed56e70c43f39c79da1654b2" }
61
+
62
+ version("2.0.0-p645") { source md5: "49919bba0c855eaf8e247108c7933a62" }
63
+ version("2.0.0-p594") { source md5: "a9caa406da5d72f190e28344e747ee74" }
64
+ version("2.0.0-p576") { source md5: "2e1f4355981b754d92f7e2cc456f843d" }
65
+
66
+ version("1.9.3-p550") { source md5: "e05135be8f109b2845229c4f47f980fd" }
67
+ version("1.9.3-p547") { source md5: "7531f9b1b35b16f3eb3d7bea786babfd" }
68
+ version("1.9.3-p484") { source md5: "8ac0dee72fe12d75c8b2d0ef5d0c2968" }
69
+
70
+ source url: "https://cache.ruby-lang.org/pub/ruby/#{version.match(/^(\d+\.\d+)/)[0]}/ruby-#{version}.tar.gz"
71
+
72
+ relative_path "ruby-#{version}"
73
+
74
+ env = with_standard_compiler_flags(with_embedded_path)
75
+
76
+ if mac_os_x?
77
+ # -Qunused-arguments suppresses "argument unused during compilation"
78
+ # warnings. These can be produced if you compile a program that doesn't
79
+ # link to anything in a path given with -Lextra-libs. Normally these
80
+ # would be harmless, except that autoconf treats any output to stderr as
81
+ # a failure when it makes a test program to check your CFLAGS (regardless
82
+ # of the actual exit code from the compiler).
83
+ env["CFLAGS"] << " -I#{install_dir}/embedded/include/ncurses -arch x86_64 -m64 -O3 -g -pipe -Qunused-arguments"
84
+ env["LDFLAGS"] << " -arch x86_64"
85
+ elsif freebsd?
86
+ # Stops "libtinfo.so.5.9: could not read symbols: Bad value" error when
87
+ # compiling ext/readline. See the following for more info:
88
+ #
89
+ # https://lists.freebsd.org/pipermail/freebsd-current/2013-October/045425.html
90
+ # http://mailing.freebsd.ports-bugs.narkive.com/kCgK8sNQ/ports-183106-patch-sysutils-libcdio-does-not-build-on-10-0-and-head
91
+ #
92
+ env["LDFLAGS"] << " -ltinfow"
93
+ elsif aix?
94
+ # this magic per IBM
95
+ env["LDSHARED"] = "xlc -G"
96
+ env["CFLAGS"] = "-I#{install_dir}/embedded/include/ncurses -I#{install_dir}/embedded/include"
97
+ # this magic per IBM
98
+ env["XCFLAGS"] = "-DRUBY_EXPORT"
99
+ # need CPPFLAGS set so ruby doesn't try to be too clever
100
+ env["CPPFLAGS"] = "-I#{install_dir}/embedded/include/ncurses -I#{install_dir}/embedded/include"
101
+ env["SOLIBS"] = "-lm -lc"
102
+ # need to use GNU m4, default m4 doesn't work
103
+ env["M4"] = "/opt/freeware/bin/m4"
104
+ elsif solaris_10?
105
+ if sparc?
106
+ # Known issue with rubby where too much GCC optimization blows up miniruby on sparc
107
+ env["CFLAGS"] << " -std=c99 -O0 -g -pipe -mcpu=v9"
108
+ env["LDFLAGS"] << " -mcpu=v9"
109
+ else
110
+ env["CFLAGS"] << " -std=c99 -O3 -g -pipe"
111
+ end
112
+ elsif windows?
113
+ env["CPPFLAGS"] << " -DFD_SETSIZE=2048"
114
+ else # including linux
115
+ if version.satisfies?(">= 2.3.0") &&
116
+ rhel? && platform_version.satisfies?("< 6.0")
117
+ env["CFLAGS"] << " -O2 -g -pipe"
118
+ else
119
+ env["CFLAGS"] << " -O3 -g -pipe"
120
+ end
121
+ end
122
+
123
+ build do
124
+ # AIX needs /opt/freeware/bin only for patch
125
+ patch_env = env.dup
126
+ patch_env["PATH"] = "/opt/freeware/bin:#{env['PATH']}" if aix?
127
+
128
+ if solaris_10? && version.satisfies?(">= 2.1")
129
+ patch source: "ruby-no-stack-protector.patch", plevel: 1, env: patch_env
130
+ elsif solaris_10? && version =~ /^1.9/
131
+ patch source: "ruby-sparc-1.9.3-c99.patch", plevel: 1, env: patch_env
132
+ end
133
+
134
+ # wrlinux7/ios_xr build boxes from Cisco include libssp and there is no way to
135
+ # disable ruby from linking against it, but Cisco switches will not have the
136
+ # library. Disabling it as we do for Solaris.
137
+ if ios_xr? && version.satisfies?(">= 2.1")
138
+ patch source: "ruby-no-stack-protector.patch", plevel: 1, env: patch_env
139
+ end
140
+
141
+ # disable libpath in mkmf across all platforms, it trolls omnibus and
142
+ # breaks the postgresql cookbook. i'm not sure why ruby authors decided
143
+ # this was a good idea, but it breaks our use case hard. AIX cannot even
144
+ # compile without removing it, and it breaks some native gem installs on
145
+ # other platforms. generally you need to have a condition where the
146
+ # embedded and non-embedded libs get into a fight (libiconv, openssl, etc)
147
+ # and ruby trying to set LD_LIBRARY_PATH itself gets it wrong.
148
+ #
149
+ # Also, fix paths emitted in the makefile on windows on both msys and msys2.
150
+ if version.satisfies?(">= 2.1")
151
+ patch source: "ruby-mkmf.patch", plevel: 1, env: patch_env
152
+ # should intentionally break and fail to apply on 2.2, patch will need to
153
+ # be fixed.
154
+ end
155
+
156
+ # Fix reserve stack segmentation fault when building on RHEL5 or below
157
+ # Currently only affects 2.1.7 and 2.2.3. This patch taken from the fix
158
+ # in Ruby trunk and expected to be included in future point releases.
159
+ # https://redmine.ruby-lang.org/issues/11602
160
+ if rhel? &&
161
+ platform_version.satisfies?("< 6") &&
162
+ (version == "2.1.7" || version == "2.2.3")
163
+
164
+ patch source: "ruby-fix-reserve-stack-segfault.patch", plevel: 1, env: patch_env
165
+ end
166
+
167
+ configure_command = ["--with-out-ext=dbm,readline",
168
+ "--enable-shared",
169
+ "--disable-install-doc",
170
+ "--without-gmp",
171
+ "--without-gdbm",
172
+ "--without-tk",
173
+ "--disable-dtrace"]
174
+ configure_command << "--with-ext=psych" if version.satisfies?("< 2.3")
175
+ configure_command << "--with-bundled-md5" if fips_enabled
176
+
177
+ if aix?
178
+ # need to patch ruby's configure file so it knows how to find shared libraries
179
+ patch source: "ruby-aix-configure.patch", plevel: 1, env: patch_env
180
+ # have ruby use zlib on AIX correctly
181
+ patch source: "ruby_aix_openssl.patch", plevel: 1, env: patch_env
182
+ # AIX has issues with ssl retries, need to patch to have it retry
183
+ patch source: "ruby_aix_2_1_3_ssl_EAGAIN.patch", plevel: 1, env: patch_env
184
+ # the next two patches are because xlc doesn't deal with long vs int types well
185
+ patch source: "ruby-aix-atomic.patch", plevel: 1, env: patch_env
186
+ patch source: "ruby-aix-vm-core.patch", plevel: 1, env: patch_env
187
+
188
+ # per IBM, just help ruby along on what it's running on
189
+ configure_command << "--host=powerpc-ibm-aix6.1.0.0 --target=powerpc-ibm-aix6.1.0.0 --build=powerpc-ibm-aix6.1.0.0 --enable-pthread"
190
+
191
+ elsif freebsd?
192
+ # Disable optional support C level backtrace support. This requires the
193
+ # optional devel/libexecinfo port to be installed.
194
+ configure_command << "ac_cv_header_execinfo_h=no"
195
+ configure_command << "--with-opt-dir=#{install_dir}/embedded"
196
+ elsif smartos?
197
+ # Opscode patch - someara@opscode.com
198
+ # GCC 4.7.0 chokes on mismatched function types between OpenSSL 1.0.1c and Ruby 1.9.3-p286
199
+ patch source: "ruby-openssl-1.0.1c.patch", plevel: 1, env: patch_env
200
+
201
+ # Patches taken from RVM.
202
+ # http://bugs.ruby-lang.org/issues/5384
203
+ # https://www.illumos.org/issues/1587
204
+ # https://github.com/wayneeseguin/rvm/issues/719
205
+ patch source: "rvm-cflags.patch", plevel: 1, env: patch_env
206
+
207
+ # From RVM forum
208
+ # https://github.com/wayneeseguin/rvm/commit/86766534fcc26f4582f23842a4d3789707ce6b96
209
+ configure_command << "ac_cv_func_dl_iterate_phdr=no"
210
+ configure_command << "--with-opt-dir=#{install_dir}/embedded"
211
+ elsif windows?
212
+ configure_command << " debugflags=-g"
213
+ else
214
+ configure_command << "--with-opt-dir=#{install_dir}/embedded"
215
+ end
216
+
217
+ # FFS: works around a bug that infects AIX when it picks up our pkg-config
218
+ # AFAIK, ruby does not need or use this pkg-config it just causes the build to fail.
219
+ # The alternative would be to patch configure to remove all the pkg-config garbage entirely
220
+ env["PKG_CONFIG"] = "/bin/true" if aix?
221
+
222
+ configure(*configure_command, env: env)
223
+ make "-j #{workers}", env: env
224
+ make "-j #{workers} install", env: env
225
+
226
+ if windows?
227
+ # Needed now that we switched to msys2 and have not figured out how to tell
228
+ # it how to statically link yet
229
+ dlls = ["libwinpthread-1"]
230
+ if windows_arch_i386?
231
+ dlls << "libgcc_s_dw2-1"
232
+ else
233
+ dlls << "libgcc_s_seh-1"
234
+ end
235
+ dlls.each do |dll|
236
+ arch_suffix = windows_arch_i386? ? "32" : "64"
237
+ windows_path = "C:/msys2/mingw#{arch_suffix}/bin/#{dll}.dll"
238
+ if File.exist?(windows_path)
239
+ copy windows_path, "#{install_dir}/embedded/bin/#{dll}.dll"
240
+ else
241
+ raise "Cannot find required DLL needed for dynamic linking: #{windows_path}"
242
+ end
243
+ end
244
+ else
245
+ end
246
+
247
+ end
@@ -0,0 +1,86 @@
1
+ #
2
+ # Copyright 2012-2015 Chef Software, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ name "zlib"
18
+ default_version "1.2.8"
19
+
20
+ version "1.2.8" do
21
+ source md5: "44d667c142d7cda120332623eab69f40"
22
+ end
23
+ version "1.2.6" do
24
+ source md5: "618e944d7c7cd6521551e30b32322f4a"
25
+ end
26
+
27
+ source url: "http://zlib.net/zlib-#{version}.tar.gz"
28
+
29
+ license "Zlib"
30
+ license_file "README"
31
+
32
+ relative_path "zlib-#{version}"
33
+
34
+ build do
35
+ if windows?
36
+ env = with_standard_compiler_flags(with_embedded_path)
37
+
38
+ patch source: "zlib-windows-relocate.patch", env: env
39
+
40
+ # We can't use the top-level Makefile. Instead, the developers have made
41
+ # an organic, artisanal, hand-crafted Makefile.gcc for us which takes a few
42
+ # variables.
43
+ env["BINARY_PATH"] = "/bin"
44
+ env["LIBRARY_PATH"] = "/lib"
45
+ env["INCLUDE_PATH"] = "/include"
46
+ env["DESTDIR"] = "#{install_dir}/embedded"
47
+
48
+ make_args = [
49
+ "-fwin32/Makefile.gcc",
50
+ "SHARED_MODE=1",
51
+ "CFLAGS=\"#{env['CFLAGS']} -Wall\"",
52
+ "ASFLAGS=\"#{env['CFLAGS']} -Wall\"",
53
+ "LDFLAGS=\"#{env['LDFLAGS']}\"",
54
+ # The win32 makefile for zlib does not handle parallel make correctly.
55
+ # In particular, see its rule for IMPLIB and SHAREDLIB. The ld step in
56
+ # SHAREDLIB will generate both the dll and the dll.a files. The step to
57
+ # strip the dll occurs next but since the dll.a file is already present,
58
+ # make will attempt to link example_d.exe and minigzip_d.exe in parallel
59
+ # with the strip step - causing gcc to freak out when a source file is
60
+ # rewritten part way through the linking stage.
61
+ #"-j #{workers}",
62
+ ]
63
+
64
+ make(*make_args, env: env)
65
+ make("install", *make_args, env: env)
66
+ else
67
+ # We omit the omnibus path here because it breaks mac_os_x builds by picking
68
+ # up the embedded libtool instead of the system libtool which the zlib
69
+ # configure script cannot handle.
70
+ # TODO: Do other OSes need this? Is this strictly a mac thing?
71
+ env = with_standard_compiler_flags
72
+ if solaris_10?
73
+ # For some reason zlib needs this flag on solaris (cargocult warning?)
74
+ env["CFLAGS"] << " -DNO_VIZ"
75
+ elsif freebsd?
76
+ # FreeBSD 10+ gets cranky if zlib is not compiled in a
77
+ # position-independent way.
78
+ env["CFLAGS"] << " -fPIC"
79
+ end
80
+
81
+ configure env: env
82
+
83
+ make "-j #{workers}", env: env
84
+ make "-j #{workers} install", env: env
85
+ end
86
+ end
@@ -0,0 +1,99 @@
1
+ Feature: Client uses remote codestraps and boilerplates
2
+ In order to use remote codestraps and boilerplates
3
+ as a user
4
+ I want a client command that will support this functionality
5
+
6
+ Scenario Outline: Use remote codestrap or boilerplate
7
+ Given client tmp directory
8
+ And client fixtures file "fixtures.yaml" with:
9
+ """
10
+ links: client/home/codestrap/bin
11
+ codestrapfile: |
12
+ Codestrapfile.config do |conf|
13
+ conf.server.base = ['client/var/lib/codestrap']
14
+ conf.local.base = ['client/home/codestrap']
15
+ conf.local.urls = 'http://127.0.0.1:4567/rest/capability.json'
16
+ end
17
+ commands:
18
+ stubbash:
19
+ output: client/output/bashscript
20
+ test:
21
+ client/output/bashscript:
22
+ local-data: 'true'
23
+ strapgem:
24
+ output: client/output/gem
25
+ test:
26
+ client/output/gem/template:
27
+ local-data: 'true'
28
+ client/output/gem/dir/template:
29
+ local-data: 'true'
30
+ stubbashremote:
31
+ output: client/output/bashscriptremote
32
+ test:
33
+ client/output/bashscriptremote:
34
+ remote-data: 'true'
35
+ strapgemremote:
36
+ output: client/output/gemremote
37
+ test:
38
+ client/output/gemremote/template:
39
+ remote-data: 'true'
40
+ client/output/gemremote/dir/template:
41
+ remote-data: 'true'
42
+ stubremote_local:
43
+ output: client/output/file_remote_local
44
+ test:
45
+ client/output/file_remote_local:
46
+ local-data: 'true'
47
+ strapremote_local:
48
+ output: client/output/dir_remote_local
49
+ test:
50
+ client/output/dir_remote_local/template:
51
+ local-data: 'true'
52
+ client/output/dir_remote_local/dir/template:
53
+ local-data: 'true'
54
+ stubremote_remote:
55
+ output: client/output/file_remote_remote
56
+ test:
57
+ client/output/file_remote_remote:
58
+ remote-data: 'true'
59
+ strapremote_remote:
60
+ output: client/output/dir_remote_remote
61
+ test:
62
+ client/output/dir_remote_remote/template:
63
+ remote-data: 'true'
64
+ client/output/dir_remote_remote/dir/template:
65
+ remote-data: 'true'
66
+ stublocal_remote:
67
+ output: client/output/file_local_remote
68
+ test:
69
+ client/output/file_local_remote:
70
+ remote-data: 'true'
71
+ straplocal_remote:
72
+ output: client/output/dir_local_remote
73
+ test:
74
+ client/output/dir_local_remote/template:
75
+ remote-data: 'true'
76
+ client/output/dir_local_remote/dir/template:
77
+ remote-data: 'true'
78
+ """
79
+ And client fixture "<command>"
80
+ And client generate command is called
81
+ Then client runs "stub output"
82
+ And client runs "strap output"
83
+ And client stub exit code is 0
84
+ And client strap exit code is 0
85
+ And client stub has the correct interpolated values
86
+ And client boilerplate has the correct interpolated values
87
+ Examples:
88
+ | command |
89
+ | stubbash |
90
+ | strapgem |
91
+ | stubbashremote |
92
+ | strapgemremote |
93
+ | stubremote_local |
94
+ | strapremote_local |
95
+ | stubremote_remote |
96
+ | strapremote_remote |
97
+ | stublocal_remote |
98
+ | straplocal_remote |
99
+