strelka 0.3.0 → 0.4.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 395204eaca2231acafa0f31e6dd55ec96b51199e
4
- data.tar.gz: 3c36c895a536b326353896d69d63e0d177d10224
3
+ metadata.gz: 58ca9bc4fbcc4953f0b9fb9b15407b726b0a9512
4
+ data.tar.gz: 946729ae577f2cd5496b3a14542094abb35ec907
5
5
  SHA512:
6
- metadata.gz: fc57d68e1dcbf2ddd207aa60099d8296d217161b7eda72868f4f366ee5340b33f02e03c1c33e9c1b1df0c997591defa10b472f63078e20819ffa715aab0c3cb1
7
- data.tar.gz: 64890a20a0effca5816512184a9750f9636809b67192b5697e38ee7b441dcb78e98d313386c954a64b3c5429b1314cfb4039549d996c3137a8dc4bdd1c195b88
6
+ metadata.gz: 429cab795c50159c7fdad07e17ecf0da7dbf6d43ef6e5798752d942a371dd592292815393c89563a0f29da887943b576fc7580a3d7ac1b06c091bae56d66bd99
7
+ data.tar.gz: 27c80311955501589a68d377e90c4c532f3acd3a074c648a4d5ea9eefc9246a6eb8669793c07583146bb9ef3cdd0e689440b8912dd37f82ac703f4a34d5a7b64
@@ -1,3 +1 @@
1
- Hj�M�����a��X@�x����*hF���cVǎ��8��tJS��m�.���y>�Gyu���q=+w�?j>����ILxs
2
- I|%���O&
3
- d��o�[T� U 膘O(#K)�(��E�A�U�( |�v>�� 2�� Fϔ�?d��+7lE����j�� |M��} !��K<�G�Y{)�}��,fCE!G�+�C�`@FG}��O�S�%�h�Ƀ�nU��>fD�(T�P����|�3�eVU}wJ|������`����f�
1
+ ���~&U�ϱ�ʺ��� ��ؿ�G��!$) e���'F��n���z_a���a�4��'��v@ھ��$��ev�\�a:��#'�����j+��*�A��jM�!�z1ע8�xs��ѷILR���\ ~_'�/�m��1hr<i����S���pfj ��'Z���yu�����:ϟe���h�q ��@t�ԭc���y���hQ��gq���iv���t)��TK� �%~E ��勐>l�-e
data.tar.gz.sig CHANGED
Binary file
data/ChangeLog CHANGED
@@ -1,8 +1,73 @@
1
+ 2013-03-26 Michael Granger <ged@FaerieMUD.org>
2
+
3
+ * bin/strelka, lib/strelka/app.rb:
4
+ Pull app finder code from bin/strelka up into a Strelka::App class
5
+ method.
6
+ [715de56560f6] [tip]
7
+
8
+ * .rvm.gems, Rakefile:
9
+ Update deps, add fivefish doc option only in development
10
+ [eb616144eb14]
11
+
12
+ 2013-03-11 Michael Granger <ged@FaerieMUD.org>
13
+
14
+ * .hgtags:
15
+ Added tag v0.3.0 for changeset 3583acf73860
16
+ [beebeb914629]
17
+
18
+ * .hgsigs:
19
+ Added signature for changeset 01ab7adefccf
20
+ [3583acf73860] [v0.3.0]
21
+
22
+ * History.rdoc, lib/strelka.rb:
23
+ Bump the minor version, update history.
24
+ [01ab7adefccf]
25
+
26
+ * lib/strelka/app/restresources.rb, lib/strelka/httprequest/auth.rb,
27
+ lib/strelka/httpresponse.rb, lib/strelka/paramvalidator.rb,
28
+ lib/strelka/router.rb, spec/strelka/app/auth_spec.rb,
29
+ spec/strelka/app/restresources_spec.rb:
30
+ Whitespace cleanup
31
+ [f0f47fdd0fc1]
32
+
33
+ * .rvm.gems, Rakefile, lib/strelka/app/auth.rb,
34
+ lib/strelka/app/parameters.rb, lib/strelka/authprovider.rb,
35
+ lib/strelka/router.rb, lib/strelka/session.rb,
36
+ spec/strelka/authprovider_spec.rb, spec/strelka/router_spec.rb,
37
+ spec/strelka/session_spec.rb:
38
+ Swap PluginFactory for Pluggability
39
+ [2b5ec3707092]
40
+
41
+ 2013-03-01 Michael Granger <ged@FaerieMUD.org>
42
+
43
+ * .hgtags:
44
+ Added tag v0.2.1 for changeset 3e0b98108f3f
45
+ [b697fcf0bf33]
46
+
47
+ * .hgsigs:
48
+ Added signature for changeset c973cb926a4d
49
+ [3e0b98108f3f] [v0.2.1]
50
+
51
+ * History.rdoc, lib/strelka.rb:
52
+ Bump patch version, update history.
53
+ [c973cb926a4d]
54
+
55
+ * Rakefile:
56
+ Dont include formatter in RDoc options, bump simplecov dependency
57
+ too.
58
+ [bf325e88fc06]
59
+
60
+ * .rvm.gems, Rakefile, lib/strelka/app/auth.rb,
61
+ lib/strelka/app/templating.rb:
62
+ Update dependencies, add Ruby version to the default template
63
+ variables.
64
+ [b5f34be87274]
65
+
1
66
  2013-02-27 Mahlon E. Smith <mahlon@martini.nu>
2
67
 
3
68
  * .rvm.gems, Rakefile:
4
69
  Update dependency for configurability.
5
- [8e7f432be135] [github/master, tip]
70
+ [8e7f432be135] [github/master]
6
71
 
7
72
  2013-02-27 Michael Granger <ged@FaerieMUD.org>
8
73
 
@@ -1,3 +1,12 @@
1
+ == v0.4.0 [2013-03-26] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ - Handle Strelka::App subclass inheritance, add Strelka::App syntactic
4
+ sugar.
5
+ - Pull app finder code from bin/strelka up into a Strelka::App class
6
+ method.
7
+ - Update deps, add fivefish doc option only in development
8
+
9
+
1
10
  == v0.3.0 [2013-03-11] Michael Granger <ged@FaerieMUD.org>
2
11
 
3
12
  - Swap PluginFactory for Pluggability
data/Rakefile CHANGED
@@ -22,7 +22,7 @@ hoespec = Hoe.spec 'strelka' do
22
22
  self.developer 'Michael Granger', 'ged@FaerieMUD.org'
23
23
 
24
24
  self.dependency 'configurability', '~> 2.0'
25
- self.dependency 'foreman', '~> 0.61'
25
+ self.dependency 'foreman', '~> 0.62'
26
26
  self.dependency 'highline', '~> 1.6'
27
27
  self.dependency 'inversion', '~> 0.12'
28
28
  self.dependency 'loggability', '~> 0.5'
@@ -32,14 +32,19 @@ hoespec = Hoe.spec 'strelka' do
32
32
  self.dependency 'trollop', '~> 2.0'
33
33
  self.dependency 'uuidtools', '~> 2.1'
34
34
 
35
- self.dependency 'hoe-deveiate', '~> 0.1', :developer
36
- self.dependency 'simplecov', '~> 0.7', :developer
35
+ self.dependency 'hoe-deveiate', '~> 0.1', :developer
36
+ self.dependency 'simplecov', '~> 0.7', :developer
37
+ self.dependency 'rdoc-generator-fivefish', '~> 0.2', :developer
37
38
 
38
39
  self.spec_extras[:licenses] = ["BSD"]
39
40
  self.spec_extras[:rdoc_options] = [
40
41
  '-t', 'Strelka Web Application Toolkit',
41
42
  '-w', '4',
42
43
  ]
44
+
45
+ # Use the Fivefish formatter if run in development
46
+ self.spec_extras[:rdoc_options] += [ '-f', 'fivefish' ] if File.directory?( '.hg' )
47
+
43
48
  self.require_ruby_version( '>=1.9.3' )
44
49
  self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
45
50
  self.check_history_on_release = true if self.respond_to?( :check_history_on_release= )
@@ -47,6 +52,8 @@ hoespec = Hoe.spec 'strelka' do
47
52
  self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
48
53
  end
49
54
 
55
+
56
+
50
57
  ENV['VERSION'] ||= hoespec.spec.version.to_s
51
58
 
52
59
  # Ensure the specs pass before checking in
@@ -295,7 +295,9 @@ class Strelka::CLICommand
295
295
 
296
296
  ### The 'start' command
297
297
  def start_command( *args )
298
- path, appname, gemname = self.find_specified_app( *args )
298
+ appname = args.pop
299
+ gemname = args.pop
300
+ path, gemname = Strelka::App.find( appname, gemname )
299
301
 
300
302
  header "Starting the %s app%s" % [
301
303
  appname,
@@ -355,48 +357,6 @@ class Strelka::CLICommand
355
357
  # Helper methods
356
358
  #
357
359
 
358
- ### Find the app specified in the specified +args+ and return the Pathname to it and the
359
- ### name of the gem it belongs to. Raises a RuntimeError if the +args+ didn't contain a
360
- ### valid application specification.
361
- def find_specified_app( *args )
362
- appname = args.pop
363
- gemname = args.pop
364
- discovered_apps = Strelka::App.discover_paths
365
-
366
- path = nil
367
- if gemname
368
- discovered_apps[ gemname ].each do |apppath|
369
- self.log.debug " %s (%s)" % [ apppath, apppath.basename('.rb') ]
370
- if apppath.basename('.rb').to_s == appname
371
- path = apppath
372
- break
373
- end
374
- end
375
- else
376
- self.log.debug "No gem name; searching them all:"
377
- discovered_apps.each do |disc_gemname, paths|
378
- self.log.debug " %s: %d paths" % [ disc_gemname, paths.length ]
379
- path = paths.find do |apppath|
380
- self.log.debug " %s (%s)" % [ apppath, apppath.basename('.rb') ]
381
- self.log.debug " %p vs. %p" % [ apppath.basename('.rb').to_s, appname ]
382
- apppath.basename('.rb').to_s == appname
383
- end or next
384
- gemname = disc_gemname
385
- break
386
- end
387
- end
388
-
389
- unless path
390
- msg = "Couldn't find an app named '#{appname}'"
391
- msg << " in the #{gemname} gem" if gemname
392
- raise( msg )
393
- end
394
- self.log.debug " found: %s" % [ path ]
395
-
396
- return path, appname, gemname
397
- end
398
-
399
-
400
360
  ### Load any requires added to the command via the '-r' option.
401
361
  def load_additional_requires
402
362
  return unless self.options.requires
@@ -24,10 +24,10 @@ module Strelka
24
24
  log_as :strelka
25
25
 
26
26
  # Library version constant
27
- VERSION = '0.3.0'
27
+ VERSION = '0.4.0'
28
28
 
29
29
  # Version-control revision constant
30
- REVISION = %q$Revision: 01ab7adefccf $
30
+ REVISION = %q$Revision: 49ae27e4588e $
31
31
 
32
32
  require 'strelka/constants'
33
33
  require 'strelka/exceptions'
@@ -62,5 +62,19 @@ module Strelka
62
62
  self.config.install
63
63
  end
64
64
 
65
+
66
+ ### Look up the application class of +appname+, optionally limiting it to the gem
67
+ ### named +gemname+. Returns the first matching class, or raises an exception if no
68
+ ### app class was found.
69
+ def self::App( appname, gemname=nil )
70
+ path, _ = Strelka::App.find( appname, gemname )
71
+ raise LoadError, "Can't find the %s app." % [ appname ] unless path
72
+
73
+ apps = Strelka::App.load( path ) or
74
+ raise ScriptError "Loading %s didn't define a Strelka::App class." % [ path ]
75
+
76
+ return apps.first
77
+ end
78
+
65
79
  end # module Strelka
66
80
 
@@ -13,7 +13,6 @@ require 'strelka/plugins'
13
13
 
14
14
 
15
15
  # The Strelka HTTP application base class.
16
- #
17
16
  class Strelka::App < Mongrel2::Handler
18
17
  extend Loggability,
19
18
  Configurability,
@@ -100,7 +99,8 @@ class Strelka::App < Mongrel2::Handler
100
99
  ### classes correspond to which files.
101
100
  def self::inherited( subclass )
102
101
  super
103
- @subclasses[ @loading_file ] << subclass if self == Strelka::App
102
+ self.log.debug "Adding %p to the subclasses hash." % [ subclass ]
103
+ Strelka::App.subclasses[ @loading_file ] << subclass #if self == Strelka::App
104
104
  end
105
105
 
106
106
 
@@ -206,6 +206,46 @@ class Strelka::App < Mongrel2::Handler
206
206
  end
207
207
 
208
208
 
209
+ ### Find the first app with the given +appname+ and return the path to its file and the name of
210
+ ### the gem it's from. If the optional +gemname+ is given, only consider apps from that gem.
211
+ ### Raises a RuntimeError if no app with the given +appname+ was found.
212
+ def self::find( appname, gemname=nil )
213
+ discovered_apps = self.discover_paths
214
+
215
+ path = nil
216
+ if gemname
217
+ discovered_apps[ gemname ].each do |apppath|
218
+ self.log.debug " %s (%s)" % [ apppath, apppath.basename('.rb') ]
219
+ if apppath.basename('.rb').to_s == appname
220
+ path = apppath
221
+ break
222
+ end
223
+ end
224
+ else
225
+ self.log.debug "No gem name; searching them all:"
226
+ discovered_apps.each do |disc_gemname, paths|
227
+ self.log.debug " %s: %d paths" % [ disc_gemname, paths.length ]
228
+ path = paths.find do |apppath|
229
+ self.log.debug " %s (%s)" % [ apppath, apppath.basename('.rb') ]
230
+ self.log.debug " %p vs. %p" % [ apppath.basename('.rb').to_s, appname ]
231
+ apppath.basename('.rb').to_s == appname
232
+ end or next
233
+ gemname = disc_gemname
234
+ break
235
+ end
236
+ end
237
+
238
+ unless path
239
+ msg = "Couldn't find an app named '#{appname}'"
240
+ msg << " in the #{gemname} gem" if gemname
241
+ raise( msg )
242
+ end
243
+ self.log.debug " found: %s" % [ path ]
244
+
245
+ return path, gemname
246
+ end
247
+
248
+
209
249
  ### Load the specified +file+, and return any Strelka::App subclasses that are loaded
210
250
  ### as a result.
211
251
  def self::load( file )
@@ -68,7 +68,7 @@ describe Strelka::App do
68
68
 
69
69
  it "has a method for loading app class/es from a file" do
70
70
  app_file = 'an_app.rb'
71
- app_path = Pathname( 'an_app.rb' ).expand_path
71
+ app_path = Pathname( app_file ).expand_path
72
72
  app_class = nil
73
73
 
74
74
  Kernel.should_receive( :load ).with( app_path.to_s ).and_return do
@@ -386,6 +386,7 @@ describe Strelka::App do
386
386
  res.should be_nil()
387
387
  end
388
388
 
389
+
389
390
  describe "process name" do
390
391
 
391
392
  before( :all ) do
@@ -12,6 +12,15 @@ require 'strelka'
12
12
 
13
13
  describe Strelka do
14
14
 
15
+ before( :all ) do
16
+ setup_logging()
17
+ end
18
+
19
+ after( :all ) do
20
+ reset_logging()
21
+ end
22
+
23
+
15
24
  describe "version methods" do
16
25
  it "returns a version string if asked" do
17
26
  described_class.version_string.should =~ /\w+ [\d.]+/
@@ -23,5 +32,16 @@ describe Strelka do
23
32
  end
24
33
  end
25
34
 
35
+ it "provides syntactic sugar for looking up an app class by name" do
36
+ mox_app = nil
37
+ Pathname.stub( :glob ).with( 'data/*/{apps,handlers}/**/*' ).
38
+ and_return([ Pathname('data/mox/apps/moxthefox') ])
39
+ Kernel.stub( :load ).with( File.expand_path 'data/mox/apps/moxthefox' ).and_return do
40
+ mox_app = Class.new( Strelka::App )
41
+ end
42
+
43
+ described_class::App( 'moxthefox' ).should == mox_app
44
+ end
45
+
26
46
  end
27
47
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strelka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Granger
@@ -30,7 +30,7 @@ cert_chain:
30
30
  6mKCwjpegytE0oifXfF8k75A9105cBnNiMZOe1tXiqYc/exCgWvbggurzDOcRkZu
31
31
  /YSusaiDXHKU2O3Akc3htA==
32
32
  -----END CERTIFICATE-----
33
- date: 2013-03-12 00:00:00.000000000 Z
33
+ date: 2013-03-26 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: configurability
@@ -52,14 +52,14 @@ dependencies:
52
52
  requirements:
53
53
  - - ~>
54
54
  - !ruby/object:Gem::Version
55
- version: '0.61'
55
+ version: '0.62'
56
56
  type: :runtime
57
57
  prerelease: false
58
58
  version_requirements: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - ~>
61
61
  - !ruby/object:Gem::Version
62
- version: '0.61'
62
+ version: '0.62'
63
63
  - !ruby/object:Gem::Dependency
64
64
  name: highline
65
65
  requirement: !ruby/object:Gem::Requirement
@@ -242,6 +242,20 @@ dependencies:
242
242
  - - ~>
243
243
  - !ruby/object:Gem::Version
244
244
  version: '0.7'
245
+ - !ruby/object:Gem::Dependency
246
+ name: rdoc-generator-fivefish
247
+ requirement: !ruby/object:Gem::Requirement
248
+ requirements:
249
+ - - ~>
250
+ - !ruby/object:Gem::Version
251
+ version: '0.2'
252
+ type: :development
253
+ prerelease: false
254
+ version_requirements: !ruby/object:Gem::Requirement
255
+ requirements:
256
+ - - ~>
257
+ - !ruby/object:Gem::Version
258
+ version: '0.2'
245
259
  - !ruby/object:Gem::Dependency
246
260
  name: hoe
247
261
  requirement: !ruby/object:Gem::Requirement
@@ -415,6 +429,8 @@ rdoc_options:
415
429
  - Strelka Web Application Toolkit
416
430
  - -w
417
431
  - '4'
432
+ - -f
433
+ - fivefish
418
434
  require_paths:
419
435
  - lib
420
436
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -429,7 +445,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
429
445
  version: '0'
430
446
  requirements: []
431
447
  rubyforge_project: strelka
432
- rubygems_version: 2.0.0
448
+ rubygems_version: 2.0.3
433
449
  signing_key:
434
450
  specification_version: 4
435
451
  summary: Strelka is a framework for creating and deploying Mongrel2[http://mongrel2.org/]
metadata.gz.sig CHANGED
Binary file