albacore 2.0.0.rc.18 → 2.0.0.rc.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +68 -8
  3. data/albacore.gemspec +1 -1
  4. data/lib/albacore/app_spec.rb +38 -6
  5. data/lib/albacore/app_spec/README.md +4 -0
  6. data/lib/albacore/app_spec/defaults.rb +61 -0
  7. data/lib/albacore/app_spec/iis_site.rb +42 -0
  8. data/lib/albacore/cpack_app_spec.rb +30 -39
  9. data/lib/albacore/version.rb +1 -1
  10. data/resources/installSite.ps1 +50 -0
  11. data/spec/test_appspecs/corp.service/.gitignore +3 -0
  12. data/spec/test_appspecs/corp.service/.nuget/packages.config +4 -0
  13. data/spec/test_appspecs/corp.service/CSharpWeb/.appspec +5 -0
  14. data/spec/test_appspecs/corp.service/CSharpWeb/App_Start/BundleConfig.cs +43 -0
  15. data/spec/test_appspecs/corp.service/CSharpWeb/App_Start/FilterConfig.cs +13 -0
  16. data/spec/test_appspecs/corp.service/CSharpWeb/App_Start/RouteConfig.cs +23 -0
  17. data/spec/test_appspecs/corp.service/CSharpWeb/App_Start/WebApiConfig.cs +19 -0
  18. data/spec/test_appspecs/corp.service/CSharpWeb/CSharpWeb.csproj +264 -0
  19. data/spec/test_appspecs/corp.service/CSharpWeb/Content/Site.css +61 -0
  20. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  21. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  22. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  23. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  24. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  25. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  26. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  27. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  28. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/images/ui-icons_222222_256x240.png +0 -0
  29. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/images/ui-icons_2e83ff_256x240.png +0 -0
  30. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/images/ui-icons_454545_256x240.png +0 -0
  31. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/images/ui-icons_888888_256x240.png +0 -0
  32. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/images/ui-icons_cd0a0a_256x240.png +0 -0
  33. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/jquery-ui.css +464 -0
  34. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/jquery.ui.accordion.css +19 -0
  35. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/jquery.ui.all.css +11 -0
  36. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/jquery.ui.autocomplete.css +53 -0
  37. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/jquery.ui.base.css +21 -0
  38. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/jquery.ui.button.css +38 -0
  39. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/jquery.ui.core.css +38 -0
  40. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/jquery.ui.datepicker.css +66 -0
  41. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/jquery.ui.dialog.css +21 -0
  42. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/jquery.ui.progressbar.css +11 -0
  43. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/jquery.ui.resizable.css +20 -0
  44. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/jquery.ui.selectable.css +10 -0
  45. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/jquery.ui.slider.css +24 -0
  46. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/jquery.ui.tabs.css +18 -0
  47. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/jquery.ui.theme.css +247 -0
  48. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  49. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  50. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  51. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  52. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  53. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  54. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  55. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  56. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/images/ui-icons_222222_256x240.png +0 -0
  57. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/images/ui-icons_2e83ff_256x240.png +0 -0
  58. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/images/ui-icons_454545_256x240.png +0 -0
  59. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/images/ui-icons_888888_256x240.png +0 -0
  60. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/images/ui-icons_cd0a0a_256x240.png +0 -0
  61. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/jquery-ui.min.css +5 -0
  62. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/jquery.ui.accordion.min.css +5 -0
  63. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/jquery.ui.autocomplete.min.css +5 -0
  64. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/jquery.ui.button.min.css +5 -0
  65. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/jquery.ui.core.min.css +5 -0
  66. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/jquery.ui.datepicker.min.css +5 -0
  67. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/jquery.ui.dialog.min.css +5 -0
  68. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/jquery.ui.progressbar.min.css +5 -0
  69. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/jquery.ui.resizable.min.css +5 -0
  70. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/jquery.ui.selectable.min.css +5 -0
  71. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/jquery.ui.slider.min.css +5 -0
  72. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/jquery.ui.tabs.min.css +5 -0
  73. data/spec/test_appspecs/corp.service/CSharpWeb/Content/themes/base/minified/jquery.ui.theme.min.css +5 -0
  74. data/spec/test_appspecs/corp.service/CSharpWeb/Controllers/HomeController.cs +17 -0
  75. data/spec/test_appspecs/corp.service/CSharpWeb/Global.asax +1 -0
  76. data/spec/test_appspecs/corp.service/CSharpWeb/Global.asax.cs +24 -0
  77. data/spec/test_appspecs/corp.service/CSharpWeb/Properties/AssemblyInfo.cs +35 -0
  78. data/spec/test_appspecs/corp.service/CSharpWeb/Properties/PublishProfiles/local.pubxml +17 -0
  79. data/spec/test_appspecs/corp.service/CSharpWeb/Views/Home/Index.cshtml +8 -0
  80. data/spec/test_appspecs/corp.service/CSharpWeb/Views/Shared/Error.cshtml +17 -0
  81. data/spec/test_appspecs/corp.service/CSharpWeb/Views/Shared/_Layout.cshtml +16 -0
  82. data/spec/test_appspecs/corp.service/CSharpWeb/Views/Web.config +59 -0
  83. data/spec/test_appspecs/corp.service/CSharpWeb/Views/_ViewStart.cshtml +3 -0
  84. data/spec/test_appspecs/corp.service/CSharpWeb/Web.Debug.config +30 -0
  85. data/spec/test_appspecs/corp.service/CSharpWeb/Web.Release.config +31 -0
  86. data/spec/test_appspecs/corp.service/CSharpWeb/Web.config +107 -0
  87. data/spec/test_appspecs/corp.service/CSharpWeb/packages.config +26 -0
  88. data/spec/test_appspecs/corp.service/FSharpWeb/AssemblyInfo.fs +22 -0
  89. data/spec/test_appspecs/corp.service/FSharpWeb/Content/Site.css +42 -0
  90. data/spec/test_appspecs/corp.service/FSharpWeb/Controllers/HomeController.fs +13 -0
  91. data/spec/test_appspecs/corp.service/FSharpWeb/Controllers/ValuesController.fs +23 -0
  92. data/spec/test_appspecs/corp.service/FSharpWeb/FSharpWeb.fsproj +217 -0
  93. data/spec/test_appspecs/corp.service/FSharpWeb/Global.asax +1 -0
  94. data/spec/test_appspecs/corp.service/FSharpWeb/Global.asax.fs +71 -0
  95. data/spec/test_appspecs/corp.service/FSharpWeb/Views/Home/Index.cshtml +10 -0
  96. data/spec/test_appspecs/corp.service/FSharpWeb/Views/Shared/Error.cshtml +5 -0
  97. data/spec/test_appspecs/corp.service/FSharpWeb/Views/Shared/_Layout.cshtml +40 -0
  98. data/spec/test_appspecs/corp.service/FSharpWeb/Views/Web.config +34 -0
  99. data/spec/test_appspecs/corp.service/FSharpWeb/Views/_ViewStart.cshtml +3 -0
  100. data/spec/test_appspecs/corp.service/FSharpWeb/fonts/glyphicons-halflings-regular.eot +0 -0
  101. data/spec/test_appspecs/corp.service/FSharpWeb/fonts/glyphicons-halflings-regular.svg +229 -0
  102. data/spec/test_appspecs/corp.service/FSharpWeb/fonts/glyphicons-halflings-regular.ttf +0 -0
  103. data/spec/test_appspecs/corp.service/FSharpWeb/fonts/glyphicons-halflings-regular.woff +0 -0
  104. data/spec/test_appspecs/corp.service/FSharpWeb/local.pubxml +17 -0
  105. data/spec/test_appspecs/corp.service/FSharpWeb/packages.config +21 -0
  106. data/spec/test_appspecs/corp.service/FSharpWeb/readme.txt +1 -0
  107. data/spec/test_appspecs/corp.service/FSharpWeb/web.config +55 -0
  108. data/spec/test_appspecs/corp.service/Rakefile +13 -2
  109. data/spec/test_appspecs/corp.service/corp.service.svc.sln +18 -1
  110. data/spec/test_appspecs/corp.service/corp.service.svc/.appspec +2 -0
  111. metadata +201 -6
  112. data/spec/test_appspecs/corp.service/corp.service.svc/corp.service.svc.sln +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3adb7ca26eb58c83011c056ec55d4fe3022225d7
4
- data.tar.gz: 9d32ba36a45484bc4b9d3f4266c8fed4a69abb62
3
+ metadata.gz: 2dd6c3c5bcb5a1347b929ea6c71b772f47420c64
4
+ data.tar.gz: e1186cdedddd11f7356ee98b6705c26c507f3149
5
5
  SHA512:
6
- metadata.gz: 1ac4d76af91d85c459b9acb7d8f5c705e0d65604ae805c770db33109436b67a80548c83e9f6e704760a6eb9837571392b614258894a8366187b5e38be2227efc
7
- data.tar.gz: 1d23c2bb643d2381d1d981e9b9ed1949a7e201ecfe15802526e9244f84339e59f21da71e7448507f69ae5a1a1b5515a75f3ba9fcba5874b7b211c91ad135683b
6
+ metadata.gz: 90bf3a0884528bee5deba2cb0156d07c71f46570c67e3cb9ee4facd0a5a61633cb4b8e308faa49fa3ff70559725cb2ed29cbf560a3730ffd3a542d53dfa5ffa1
7
+ data.tar.gz: 49154665a384a529ab5cde6f68fe41330cef777d0874c15ea7ebaf8cf6e62b4ebda2db918718f10148319e05d4311bc91e9653bd5f7ad5bd49cb5137b8ad7b27
data/README.md CHANGED
@@ -114,12 +114,13 @@ When you `require 'albacore'` you will get a few methods added and available for
114
114
  use within your Rakefile, these are specified in CrossPlatformCmd, and are as
115
115
  follows:
116
116
 
117
- - `#system`
118
- - `#sh`
119
- - `#shie`
120
- - `#system_control`
121
- - `#which`
122
- - `#normalise_slashes`
117
+ - `#system` : (processPath : string) -> (arguments : string array)
118
+ - `#sh` : same as above
119
+ - `#shie` : same as above
120
+ - `#which` : (binaryName : string) -> (path : string)
121
+ - `#normalise_slashes` - takes a path-looking string and normalises the
122
+ slashes to the operating system that the command is running on. So for
123
+ Windows, you'd get back-slashes and for linux forward slashes.
123
124
  - `#chdir (work_dir : ?string) (block : Block<unit, x>) : x` - takes a string work dir to be
124
125
  in and a block of ruby to execute in that work dir and returns the return
125
126
  value of block.
@@ -265,9 +266,11 @@ TBD
265
266
 
266
267
  ### Docs: appspecs
267
268
 
268
- Example rakefile (see spec/test_appspecs/corp.service in albacore source).
269
+ Example rakefile (see
270
+ [spec/test_appspecs/corp.service](https://github.com/Albacore/albacore/tree/master/spec/test_appspecs/corp.service)
271
+ in albacore source).
269
272
 
270
- ```
273
+ ``` ruby
271
274
  require 'bundler/setup'
272
275
  require 'albacore'
273
276
 
@@ -300,6 +303,63 @@ automatically become a chocolatey package server that you can use
300
303
  packages of on your Windows boxen. Or you can use puppet proper with a yum repo
301
304
  on your linux boxen.
302
305
 
306
+ The appspec simply looks something like this:
307
+
308
+ ``` yaml
309
+ ---
310
+ version: 1.2.3
311
+ authors: Henrik Feldt
312
+ ```
313
+
314
+ You can put any nuget-spec property there in `snake_case` and it will be set in
315
+ the resulting nuget file. When building RPMs, the title of the project file will
316
+ be used as the id (the non-lowercased title will be used for the NuGet).
317
+
318
+ This task-type works by checking if it's running on Windows, and then running
319
+ chocolatey, otherwise running fpm. This means that you have to have either
320
+ installed, depending on your OS of choice.
321
+
322
+ ### Known .appspec options
323
+
324
+ **project_path** - if you are, say, building a package from a web site (like
325
+ CSharpWeb is an example of), then you probably don't want to package all of your
326
+ .cs files, nor would you like to package only the bin folder. Instead you add
327
+ the .appspec to the list of files in the csproj file, so that it gets copied
328
+ when you have a local publish like this:
329
+
330
+ ``` ruby
331
+ build :pkg_web do |b|
332
+ b.file = 'CSharpWeb/CSharpWeb.csproj'
333
+ b.prop 'DeployOnBuild', 'true'
334
+ b.prop 'PublishProfile', 'local'
335
+ b.prop 'Configuration', Configuration
336
+ end
337
+ ```
338
+
339
+ After calling this task, you'll find the appspec at `CSharpWeb/build/.appspec`
340
+ (which mean it's part of the contents of the site). Now it's easy for albacore
341
+ to find it and create a package from it, but it can't easily find the project
342
+ that corresponds to it, because it's not next to the csproj file.
343
+
344
+ This is where `project_path` comes in; make it something like
345
+ `../CSharpWeb.csproj` in the .appspec file and then albacore knows where to get
346
+ the data from.
347
+
348
+ **provider** - `defaults` or `iis_site` -- needs to be specified currently if
349
+ you're building a site -- a nice PR would be to discover that from the project
350
+ type.
351
+
352
+ **deploy_dir** - fully qualified path to deploy the contents
353
+
354
+ #### Example IIS Site `.appspec` file
355
+
356
+ ``` yaml
357
+ ---
358
+ authors: Intelliplan Employees
359
+ provider: iis_site
360
+ project_path: ../CMDB.Web.csproj
361
+ ```
362
+
303
363
  ## Tasks
304
364
 
305
365
  Tasks are things you can include that create singleton ruby tasks that are
@@ -24,7 +24,7 @@ EOF
24
24
  s.add_dependency 'rake', '>10' # this gem builds on rake
25
25
  s.add_dependency 'map', '~>6.5' # https://github.com/ahoward/map for options handling
26
26
  s.add_dependency 'nokogiri', '~> 1.5' # used to manipulate and read *proj files
27
- s.add_dependency 'semver2', '~> 3.3'
27
+ s.add_dependency 'semver2', '~> 3.4'
28
28
 
29
29
  s.add_development_dependency 'rubygems-tasks', '~>0.2'
30
30
  s.add_development_dependency 'rspec', '>= 2.13'
@@ -28,6 +28,27 @@ module Albacore
28
28
  @semver = semver
29
29
  end
30
30
 
31
+ # Gets the path that the .appspec file was read from when it was initialised.
32
+ #
33
+ def path
34
+ @path
35
+ end
36
+
37
+ # Gets the executable name if this service has one -- defaults to the
38
+ # assembly name of the corresponding project, plus 'exe', which is how the
39
+ # compilers name the executables.
40
+ #
41
+ def exe
42
+ conf['exe'] || "#{proj.asmname}.exe"
43
+ end
44
+
45
+ # Gets the location fully qualified path that the finished artefact will be
46
+ # installed into. Defaults to C:\\Services\\{id}.
47
+ #
48
+ def deploy_dir
49
+ conf['deploy_dir'] || "C:\\Services\\#{id}"
50
+ end
51
+
31
52
  # Resolves the project file given an optional descriptor path or a
32
53
  # configuration hash or both. One of the other of the parameters need to
33
54
  # exist, or an error will be thrown.
@@ -115,25 +136,36 @@ module Albacore
115
136
  semver_version || ENV['FORMAL_VERSION'] || conf['version'] || proj.version || semver_disk_version || '1.0.0'
116
137
  end
117
138
 
118
- # gets the binary folder, first from .appspec then from proj given a configuration
119
- # mode (default: Release)
139
+ # gets the binary folder, first from .appspec then from proj given a
140
+ # configuration mode (default: Release)
120
141
  def bin_folder configuration = 'Release'
121
142
  conf['bin'] || proj.output_path(configuration)
122
143
  end
123
144
 
124
- # gets the folder that is used to keep configuration that defaults
125
- # to the current (.) directory
145
+ # gets the folder that is used to keep configuration that defaults to the
146
+ # current (.) directory
126
147
  def conf_folder
127
148
  conf['conf_folder'] || '.'
128
149
  end
129
150
 
130
- # gets an enumerable list of paths that are the 'main' contents of the package
151
+ # gets an enumerable list of paths that are the 'main' contents of the
152
+ # package
131
153
  #
132
154
  def contents
133
155
  conf['contents'] || []
134
156
  end
135
157
 
136
- # TODO: support a few of these: https://github.com/bernd/fpm-cookery/wiki/Recipe-Specification
158
+ # gets the provider to use to calculate the directory paths to construct
159
+ # inside the nuget
160
+ #
161
+ # defaults to the 'defaults' provider which can be found in
162
+ # 'albacore/app_spec/defaults.rb'
163
+ def provider
164
+ conf['provider'] || 'defaults'
165
+ end
166
+
167
+ # TODO: support a few of these:
168
+ # https://github.com/bernd/fpm-cookery/wiki/Recipe-Specification
137
169
 
138
170
  # load the App Spec from a descriptor path
139
171
  def self.load descriptor_path
@@ -0,0 +1,4 @@
1
+ # app_spec providers
2
+
3
+ Place different providers in this folder, that allows you to change how albacore
4
+ handles content for different types of projects.
@@ -0,0 +1,61 @@
1
+ require 'albacore/app_spec'
2
+
3
+ # note: this is a Windows provider
4
+
5
+ module Albacore
6
+ # The default is to get the bin/ folder based on the configuration that you
7
+ # have compiled the project with.
8
+ #
9
+ class AppSpec::Defaults
10
+ include ::Albacore::Logging
11
+
12
+ # location/folder inside nuget to place everything found in the
13
+ # #relative_dir inside
14
+ def nuget_contents
15
+ 'bin'
16
+ end
17
+
18
+ # Where to copy contents from
19
+ def source_dir app_spec, configuration = 'Release'
20
+ File.join(app_spec.proj.proj_path_base,
21
+ app_spec.bin_folder(configuration),
22
+ '.').
23
+ gsub(/\//, '\\')
24
+ end
25
+
26
+ # create a chocolatey install script for a topshelf service on windows
27
+ #
28
+ # write tools/chocolateyInstall.ps1
29
+ def install_script out, app_spec, &block
30
+ debug { "installing into '#{out}' [app_spec/defaults#install_script]" }
31
+ tools = "#{out}/#{app_spec.id}/tools"
32
+
33
+ FileUtils.mkdir tools unless Dir.exists? tools
34
+ File.open(File.join(tools, 'chocolateyInstall.ps1'), 'w+') do |io|
35
+ contents = embedded_resource '../../../resources/chocolateyInstall.ps1'
36
+ io.write contents
37
+ write_invocation app_spec, io
38
+ end
39
+ end
40
+
41
+ # Get the relative resource from 'albacore/app_spec/.' as a string.
42
+ def embedded_resource relative_path
43
+ File.open(embedded_resource_path(relative_path), 'r') { |io| io.read }
44
+ end
45
+
46
+ # Get the relative resource path from 'albacore/app_spec/.'
47
+ def embedded_resource_path relative_path
48
+ File.join(File.dirname(File.expand_path(__FILE__)), relative_path)
49
+ end
50
+
51
+ def write_invocation app_spec, io
52
+ debug { 'writing default powershell invocation [app_spec/defaults#write_invocation]' }
53
+
54
+ io.write %{
55
+ Install-Service `
56
+ -ServiceExeName "#{app_spec.exe}" -ServiceDir "#{app_spec.deploy_dir}" `
57
+ -CurrentPath (Split-Path $MyInvocation.MyCommand.Path)
58
+ }
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,42 @@
1
+ require 'albacore/app_spec'
2
+
3
+ module Albacore
4
+ # In the case of building an IIS site we expect the site to have been
5
+ # 'Published' to a specific folder from which we can then fetch the contents.
6
+ #
7
+ # If you want the default behaviour of only packaging the bin/ folder with the
8
+ # compiled artifacts, use 'albacore/app_spec/defaults' instead.
9
+ #
10
+ # While this class is inheriting the defaults, it's still overriding
11
+ # almost/all methods.
12
+ class AppSpec::IisSite < AppSpec::Defaults
13
+ include ::Albacore::Logging
14
+ include ::Albacore::CrossPlatformCmd
15
+
16
+ # location/folder inside nuget to place everything found in the
17
+ # #source_dir inside
18
+ def nuget_contents
19
+ 'contents'
20
+ end
21
+
22
+ # where to copy from - will copy ALL contents of this directory - in this
23
+ # case will copy from the directory that the appspec is in.
24
+ def source_dir app_spec, configuration = 'Release'
25
+ "#{File.dirname(app_spec.path)}/."
26
+ end
27
+
28
+ # Extends the outputted data with the installation routines
29
+ def write_invocation app_spec, io
30
+ debug { 'writing iis site installation invocation [app_spec/iis_site#write_invocation]' }
31
+
32
+ site_installation_function = embedded_resource '../../../resources/installSite.ps1'
33
+ io.write %{
34
+ #{site_installation_function}
35
+
36
+ # deliberately lowercase id/name/title.
37
+ Install-Site -SiteName '#{app_spec.title}' `
38
+ -WebSiteRootFolder '#{normalise_slashes(File.expand_path('..', app_spec.deploy_dir))}'
39
+ }
40
+ end
41
+ end
42
+ end
@@ -67,7 +67,10 @@ module Albacore
67
67
  end
68
68
 
69
69
  def git_release_notes
70
- tags = `git tag`.split(/\n/)
70
+ tags = `git tag`.split(/\n/).
71
+ map { |tag| [ ::XSemVer::SemVer.parse_rubygems(tag), tag ] }.
72
+ sort { |a, b| a <=> b }.
73
+ map { |_, tag| tag }
71
74
  last_tag = tags[-1]
72
75
  second_last_tag = tags[-2] || `git rev-list --max-parents=0 HEAD`
73
76
  logs = `git log --pretty=format:%s #{second_last_tag}..`.split(/\n/)
@@ -84,8 +87,8 @@ module Albacore
84
87
  m.version = app_spec.version
85
88
  m.authors = app_spec.authors
86
89
  m.owners = app_spec.owners
87
- m.description = app_spec.description || app_spec.title
88
- m.release_notes = git_release_notes
90
+ m.description = app_spec.description || app_spec.title_raw
91
+ m.release_notes = app_spec.release_notes || git_release_notes
89
92
  m.summary = app_spec.summary
90
93
  m.language = app_spec.language
91
94
  m.project_url = app_spec.project_url || 'https://haf.se'
@@ -97,43 +100,25 @@ module Albacore
97
100
  p.to_xml
98
101
  end
99
102
 
100
- # create a chocolatey install script for a topshelf service on windows
101
- def create_chocolatey_install out, service_dir, exe, app_spec
102
- tools = "#{out}/#{app_spec.id}/tools"
103
-
104
- FileUtils.mkdir tools unless Dir.exists? tools
105
- File.open(File.join(tools, 'chocolateyInstall.ps1'), 'w+') do |io|
106
- contents = embedded_resource '../../resources/chocolateyInstall.ps1'
107
- io.write contents
108
- io.write %{
109
- Install-Service `
110
- -ServiceExeName "#{exe}" -ServiceDir "#{service_dir}" `
111
- -CurrentPath (Split-Path $MyInvocation.MyCommand.Path)
112
- }
113
- end
114
- end
115
-
116
103
  def create_cpack out, app_spec, nuspec_xml, configuration
104
+ provider = find_provider app_spec
105
+
117
106
  target = "#{out}/#{app_spec.id}"
118
- bin = "#{target}/bin"
107
+ contents = "#{target}/#{provider.nuget_contents}/"
119
108
 
120
- # create target
109
+ debug { 'create target [cpack_app_spec#create_cpack]' }
121
110
  FileUtils.mkdir_p target
122
111
 
123
- # write nuspec
112
+ debug { 'write nuspec [cpack_app_spec#create_cpack]' }
124
113
  File.open("#{target}/#{app_spec.id}.nuspec", 'w+') { |io| io.write nuspec_xml }
125
114
 
126
- # write tools
127
- create_chocolatey_install out,
128
- app_spec.exe,
129
- "#{app_spec.target_root_dir}\\#{app_spec.id}",
130
- app_spec
115
+ debug { 'write tools/chocolateyInstall.ps1 [cpack_app_spec#create_cpack]' }
116
+ provider.install_script out, app_spec
131
117
 
132
- # copy contents of package
133
- proj_path = File.join(app_spec.proj.proj_path_base,
134
- app_spec.proj.output_path(configuration), '.').
135
- gsub(/\//, '\\')
136
- FileUtils.cp_r proj_path, bin, :verbose => true
118
+ debug { 'copy contents of package [cpack_app_spec#create_cpack]' }
119
+ FileUtils.cp_r provider.source_dir(app_spec, configuration),
120
+ contents,
121
+ :verbose => true
137
122
 
138
123
  # package it
139
124
  Dir.chdir target do
@@ -141,15 +126,21 @@ Install-Service `
141
126
  end
142
127
 
143
128
  # publish it
144
- Albacore.publish :artifact, OpenStruct.new(:location => "#{target}/*.nupkg")
129
+ Albacore.publish :artifact, OpenStruct.new(
130
+ :location => "#{target}/#{app_spec.id}.#{app_spec.version}.nupkg"
131
+ )
145
132
  end
146
133
 
147
- def embedded_resource relative_path
148
- File.open(embedded_resource_path(relative_path), 'r') { |io| io.read }
149
- end
150
-
151
- def embedded_resource_path relative_path
152
- File.join(File.dirname(File.expand_path(__FILE__)), relative_path)
134
+ def find_provider app_spec
135
+ require "albacore/app_spec/#{app_spec.provider}"
136
+ case app_spec.provider
137
+ when 'defaults'
138
+ AppSpec::Defaults.new
139
+ when 'iis_site'
140
+ AppSpec::IisSite.new
141
+ else
142
+ raise ArgumentError, "unknown app_spec.provider: #{app_spec.provider}"
143
+ end
153
144
  end
154
145
  end
155
146
  end
@@ -1,3 +1,3 @@
1
1
  module Albacore
2
- VERSION = "2.0.0.rc.18"
2
+ VERSION = "2.0.0.rc.19"
3
3
  end
@@ -0,0 +1,50 @@
1
+ Import-Module WebAdministration
2
+
3
+ Function Install-Site(
4
+ # Folder where all your websites are located
5
+ [string] $WebSiteRootFolder = "C:\WebSites",
6
+
7
+ # The port your default binding is using
8
+ [int] $Port = 80,
9
+
10
+ # Where the source files are -- without any trailing slash or otherwise --
11
+ # just the name, please.
12
+ [string] $SourceDirectory = "source",
13
+
14
+ # Name of site that you're setting up
15
+ [string] $SiteName
16
+ ) {
17
+ #site folder
18
+ $siteInstallLocation = "$WebSiteRootFolder\$SiteName"
19
+
20
+ #site application pool
21
+ $siteAppPool = "$SiteName-pool"
22
+
23
+ #check if the site is already present (determines update or install)
24
+ $isPresent = Get-Website -name $siteName
25
+
26
+ if($isPresent){
27
+ # Upgrade the current package
28
+ Write-Host "$SiteName will be updated"
29
+ Copy-Item "$SourceDirectory\*" -Recurse $siteInstallLocation -Force
30
+ } else {
31
+ # Install a clean version of the package
32
+
33
+ Write-Host "$SiteName will be installed"
34
+
35
+ # Create site folder
36
+ new-item $siteInstallLocation -ItemType directory -Force
37
+
38
+ # Copy site files to site folder
39
+ Copy-Item $SourceDirectory -Recurse $siteInstallLocation -Force
40
+
41
+ # Create application pool
42
+ New-WebAppPool -Name $siteAppPool -Force
43
+
44
+ $hostHeader = Invoke-Expression "facter fqdn"
45
+
46
+ # Create site
47
+ New-Website -Name $SiteName -Port $Port -HostHeader $hostHeader `
48
+ -ApplicationPool $siteAppPool -PhysicalPath $siteInstallLocation
49
+ }
50
+ }