sparrowhawk 0.9.1 → 0.9.2

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.
data/CHANGELOG.md CHANGED
@@ -1,12 +1,18 @@
1
+ ## 0.9.2 (29 December 2010)
2
+
3
+ * Features
4
+
5
+ * Refactor Configuration object out of Rake task (https://www.pivotaltracker.com/story/show/8013593)
6
+
1
7
  ## 0.9.1 (29 December 2010)
2
8
 
3
9
  * Features
4
10
 
5
- ** Only include gems in war that are part of the :default or :production groups (https://www.pivotaltracker.com/story/show/7980329)
11
+ * Only include gems in war that are part of the :default or :production groups (https://www.pivotaltracker.com/story/show/7980329)
6
12
 
7
13
  * Bugs
8
14
 
9
- ** Application filter incorrectly grabbing files from the root directory (https://www.pivotaltracker.com/story/show/8006537)
15
+ * Application filter incorrectly grabbing files from the root directory (https://www.pivotaltracker.com/story/show/8006537)
10
16
 
11
17
  ## 0.9.0 (28 December 2010)
12
18
 
@@ -0,0 +1,58 @@
1
+ module Sparrowhawk
2
+
3
+ class Configuration
4
+
5
+ #Sets the name/file path of the war file. Ex: ../distro/example.war
6
+ attr_accessor :war_file
7
+
8
+ #Sets the base directories that will be scanned for application
9
+ #files (not static content). Some directories will always be
10
+ #excluded implicitly (e.g. vendor/cache)
11
+ attr_accessor :application_dirs
12
+
13
+ #The min and max runtimes that will be used to service
14
+ #requests. Accepts a range.
15
+ attr_accessor :runtimes
16
+
17
+ #Which environment to use when running the application
18
+ attr_accessor :environment
19
+
20
+ #Other files to include in the application code (LICENSE, README, etc.)
21
+ attr_accessor :other_files
22
+
23
+ #Returns an object instance that can be used to build a war
24
+ def war
25
+ war = War.new war_file
26
+ war.entries << PublicDirMapper.new.to_a
27
+ war.entries << WebXmlEntry.new(web_xml_options)
28
+ war.entries << ManifestEntry.new
29
+ war.entries << ApplicationFilesMapper.new(application_dirs).to_a
30
+ war.entries << JRubyCoreJarEntry.new
31
+ war.entries << JRubyStdLibJarEntry.new
32
+ war.entries << JRubyRackJarEntry.new
33
+ gem_finder = BundlerGemFinder.new
34
+ war.entries << GemMapper.new(gem_finder).to_a
35
+ war.entries << GemfileEntry.new
36
+ war.entries << LockfileEntry.new
37
+ other_files.each do |file|
38
+ war.entries << FileEntry.new("WEB-INF/#{file}", file)
39
+ end if other_files
40
+ war
41
+ end
42
+
43
+ def initialize
44
+ yield self if block_given?
45
+ end
46
+
47
+ private
48
+
49
+ def web_xml_options
50
+ options = {}
51
+ options[:runtimes] = runtimes if runtimes
52
+ options[:environment] = environment if environment
53
+ options
54
+ end
55
+
56
+ end
57
+
58
+ end
@@ -5,52 +5,14 @@ module Sparrowhawk
5
5
 
6
6
  class RakeTask < ::Rake::TaskLib
7
7
 
8
- attr_accessor :war_file
9
-
10
- attr_accessor :application_dirs
11
-
12
- attr_accessor :runtimes
13
-
14
- attr_accessor :environment
15
-
16
- attr_accessor :other_files
17
-
18
- def initialize task_name=:war
19
- yield self if block_given?
8
+ def initialize task_name=:war, &block
9
+ @configuration = Configuration.new &block
20
10
 
21
11
  task task_name do
22
- war.build
12
+ @configuration.war.build
23
13
  end
24
14
  end
25
15
 
26
- private
27
-
28
- def war
29
- war = War.new war_file
30
- war.entries << PublicDirMapper.new.to_a
31
- war.entries << WebXmlEntry.new(web_xml_options)
32
- war.entries << ManifestEntry.new
33
- war.entries << ApplicationFilesMapper.new(application_dirs).to_a
34
- war.entries << JRubyCoreJarEntry.new
35
- war.entries << JRubyStdLibJarEntry.new
36
- war.entries << JRubyRackJarEntry.new
37
- gem_finder = BundlerGemFinder.new
38
- war.entries << GemMapper.new(gem_finder).to_a
39
- war.entries << GemfileEntry.new
40
- war.entries << LockfileEntry.new
41
- other_files.each do |file|
42
- war.entries << FileEntry.new("WEB-INF/#{file}", file)
43
- end if other_files
44
- war
45
- end
46
-
47
- def web_xml_options
48
- options = {}
49
- options[:runtimes] = runtimes if runtimes
50
- options[:environment] = environment if environment
51
- options
52
- end
53
-
54
16
  end
55
17
 
56
18
  end
data/lib/sparrowhawk.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  require 'bundler'
2
2
 
3
3
  module Sparrowhawk
4
- VERSION = "0.9.1"
4
+ VERSION = "0.9.2"
5
5
 
6
6
  autoload :War ,'sparrowhawk/war'
7
+ autoload :Configuration ,'sparrowhawk/configuration'
7
8
 
8
9
  autoload :Entry ,'sparrowhawk/entry'
9
10
  autoload :FileEntry ,'sparrowhawk/file_entry'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sparrowhawk
3
3
  version: !ruby/object:Gem::Version
4
- hash: 57
4
+ hash: 63
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 1
10
- version: 0.9.1
9
+ - 2
10
+ version: 0.9.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan L. Bell
@@ -152,6 +152,7 @@ files:
152
152
  - lib/sparrowhawk/file_entry_mapper.rb
153
153
  - lib/sparrowhawk/application_files_mapper.rb
154
154
  - lib/sparrowhawk/jruby_rack_jar_entry.rb
155
+ - lib/sparrowhawk/configuration.rb
155
156
  - lib/sparrowhawk/gemfile_entry.rb
156
157
  - lib/sparrowhawk/gem_mapper.rb
157
158
  - lib/sparrowhawk/lockfile_entry.rb