pakyow-rake 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fef7380574c8a0ef363994834a70679f4190f2df
4
+ data.tar.gz: be5d6ef32bd5dc1f133f617151fc7807a48bf5dc
5
+ SHA512:
6
+ metadata.gz: 287c70d6624fcd91134c000515303286fca47dd6a118148da7b8ef165890bf30f390a75e64523e8f5d87e509fec56819a6f13b0ba2e6bd2055474b08d9f5affb
7
+ data.tar.gz: a2f27cb1e876d765e62405158c6cbe387a68cae653b3b7de95609a01666263006477b207586af0f567268280c9ec30b310199209c5f99de6b401a493dc94841f
@@ -0,0 +1,3 @@
1
+ = 0.9.0
2
+
3
+ * Initial gem release
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 Bryan Powell
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
File without changes
@@ -0,0 +1,4 @@
1
+ libdir = File.dirname(__FILE__)
2
+ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
3
+
4
+ Dir["#{libdir}/tasks/*.rake"].sort.each { |task| load task }
@@ -0,0 +1,13 @@
1
+ namespace :pakyow do
2
+ desc 'Prepare the app by configuring and loading code'
3
+ task :prepare do
4
+ require './app'
5
+ Pakyow::App.prepare(ENV['APP_ENV'] || ENV['RACK_ENV'])
6
+ end
7
+
8
+ desc 'Stage the app by preparing and loading routes / views'
9
+ task :stage do
10
+ require './app'
11
+ Pakyow::App.stage(ENV['APP_ENV'] || ENV['RACK_ENV'])
12
+ end
13
+ end
@@ -0,0 +1,57 @@
1
+ namespace :pakyow do
2
+ desc 'List bindings across all views, or a specific view path'
3
+ task :bindings, [:view_path] => :stage do |t, args|
4
+ BindingAnalyzer.analyze(args[:view_path])
5
+ end
6
+ end
7
+
8
+ class BindingAnalyzer
9
+ def self.analyze(view_path)
10
+ bindings = []
11
+
12
+ Pakyow::Config.presenter.view_stores.each_pair do |view_store, store_path|
13
+ Pakyow.app.presenter.store(view_store).infos do |info, path|
14
+ path = String.normalize_path(path) unless path == "/"
15
+ next if view_path && path != String.normalize_path(view_path)
16
+ next if bindings.select{|b| b[:path] == path}.length > 0
17
+
18
+ view = Pakyow.app.presenter.store(view_store).view(path)
19
+ bindings << { path: path, scopes: view.doc.scopes}
20
+ end
21
+ end
22
+
23
+ bindings.each do |set|
24
+ set[:path] = '/' if set[:path].empty?
25
+ next if set[:scopes].empty?
26
+
27
+ Pakyow.logger << "\n" + set[:path]
28
+
29
+ log_bindings(set[:scopes])
30
+ end
31
+ end
32
+
33
+ def self.log_bindings(bindings, nested = "")
34
+ bindings.each do |binding|
35
+ space = " "
36
+
37
+ scope_str = space.dup
38
+ scope_str << "#{nested} > " unless nested.empty?
39
+ scope_str << binding[:scope].to_s
40
+ Pakyow.logger << scope_str
41
+
42
+ props = binding[:props]
43
+ if props.count > 0
44
+ binding[:props].each {|prop|
45
+ Pakyow.logger << space + " #{prop[:prop]}"
46
+ }
47
+ else
48
+ Pakyow.logger << space + " (no props)"
49
+ end
50
+
51
+
52
+ next_nested = binding[:scope]
53
+ next_nested = "#{nested} > #{next_nested}" unless nested.empty?
54
+ log_bindings(binding[:nested], next_nested)
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,42 @@
1
+ namespace :pakyow do
2
+ desc 'List all routes (method, path, group[name])'
3
+ task :routes => [:stage] do
4
+ Pakyow::Router.instance.sets.each do |set_data|
5
+ set_name, set = set_data
6
+
7
+ Pakyow.logger << "\n#{set_name} routes"
8
+
9
+ all_routes = []
10
+ set.routes.each {|route_data|
11
+ method, routes = route_data
12
+
13
+ routes.each {|route|
14
+ group = nil
15
+ set.lookup[:grouped].each_pair {|name,routes|
16
+ if routes.values.include?(route)
17
+ group = name
18
+ break
19
+ end
20
+ }
21
+
22
+ name = route[2]
23
+ name = "#{group}[#{name}]" if group
24
+
25
+ all_routes << {
26
+ method: method,
27
+ path: File.join('/', route[4]),
28
+ name: name
29
+ }
30
+ }
31
+ }
32
+
33
+ all_routes.sort{|a,b| a[:path] <=> b[:path]}.each {|route|
34
+ s = " #{route[:method].upcase}\t#{route[:path]}"
35
+ s << ", #{route[:name]}" if route[:name]
36
+ Pakyow.logger << s
37
+ }
38
+
39
+ Pakyow.logger << ''
40
+ end
41
+ end
42
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pakyow-rake
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.0
5
+ platform: ruby
6
+ authors:
7
+ - Bryan Powell
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pakyow-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.9.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.9.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: pakyow-presenter
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.9.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.9.0
41
+ description: A collection of rake tasks for Pakyow apps.
42
+ email: bryan@metabahn.com
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - pakyow-rake/CHANGES
48
+ - pakyow-rake/MIT-LICENSE
49
+ - pakyow-rake/README
50
+ - pakyow-rake/lib/pakyow-rake.rb
51
+ - pakyow-rake/lib/tasks/app.rake
52
+ - pakyow-rake/lib/tasks/bindings.rake
53
+ - pakyow-rake/lib/tasks/routes.rake
54
+ homepage: http://pakyow.com
55
+ licenses:
56
+ - MIT
57
+ metadata: {}
58
+ post_install_message:
59
+ rdoc_options: []
60
+ require_paths:
61
+ - pakyow-rake/lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 2.0.0
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ requirements: []
73
+ rubyforge_project: pakyow-rake
74
+ rubygems_version: 2.2.2
75
+ signing_key:
76
+ specification_version: 4
77
+ summary: Rake tasks for Pakyow apps.
78
+ test_files: []
79
+ has_rdoc: