bahuvrihi-tap 0.11.1 → 0.11.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,54 @@
1
+ var Tap = {
2
+ Run: {},
3
+ };
4
+
5
+ Tap.Run = {
6
+ add: function(id) {
7
+ // Determine the total number of nodes
8
+ nodes = document.getElementById(id).getElementsByClassName('node');
9
+
10
+ // Determine the indicies of source and target nodes
11
+ sources = []
12
+ targets = []
13
+ for (i=0;i<nodes.length;i++) {
14
+ source = nodes[i].getElementsByClassName('source_checkbox')[0];
15
+ if(source.checked) {
16
+ source.checked = false;
17
+ sources.push(i);
18
+ };
19
+
20
+ target = nodes[i].getElementsByClassName('target_checkbox')[0];
21
+ if(target.checked) {
22
+ target.checked = false;
23
+ targets.push(i);
24
+ };
25
+ };
26
+
27
+ // Determine the currently selected tasc
28
+ tasc_manifest = document.getElementById('tasc_manifest');
29
+ tasc = tasc_manifest.value;
30
+ tasc_manifest.value = ""
31
+
32
+ new Ajax.Updater(id, '/run', {
33
+ method: 'post',
34
+ insertion: Insertion.Bottom,
35
+ parameters: {
36
+ action: 'add',
37
+ index: nodes.length,
38
+ sources: sources,
39
+ targets: targets,
40
+ tasc: tasc
41
+ }
42
+ });
43
+ },
44
+
45
+ remove: function() {
46
+ alert('remove');
47
+ },
48
+
49
+ update: function(id) {
50
+ form = document.getElementById(id);
51
+ form.method = "get";
52
+ form.submit();
53
+ },
54
+ };
@@ -0,0 +1,22 @@
1
+ /*
2
+ Adapted by Simon Chiang in 2008 from:
3
+
4
+ Transcending CSS by Andy Clarke
5
+ www.transcendingcss.com/
6
+
7
+
8
+ @import url(http://tap.rubyforge.org/stylesheets/reset.css);
9
+ @import url(http://tap.rubyforge.org/stylesheets/inman.css);
10
+ */
11
+
12
+ /*
13
+ Run Styles
14
+ */
15
+ .identifier { display:none }
16
+
17
+ /* task_manifest */
18
+
19
+ .manifest li.env_manifest_item { display:none }
20
+ .manifest li.selected_item:hover { display:visible }
21
+
22
+ .manifest li:hover {}
data/template/404.erb ADDED
@@ -0,0 +1,12 @@
1
+ <html>
2
+ <body>
3
+ <p>
4
+ # 404 error<br/>
5
+ # Could not handle request:
6
+ </p>
7
+ <code><pre>
8
+ <%= cgi.to_yaml %>
9
+ <%= rack.to_yaml %>
10
+ </pre></code>
11
+ </body>
12
+ </html>
@@ -0,0 +1,56 @@
1
+ <% env_names = {} %>
2
+ <% env.minimap.each do |name, environment| %>
3
+ <% env_names[environment] = name %>
4
+ <% end %>
5
+ <html>
6
+ <head>
7
+ <title>Tap::Manifest</title>
8
+ </head>
9
+ <body>
10
+
11
+ <div id="branding">
12
+ <h1><a href="<%= Tap::WEBSITE %>">Tap (<ins>T</ins>ask <ins>Ap</ins>plication) <%= Tap::VERSION %> </a></h1>
13
+ </div>
14
+
15
+ <div id="content_main">
16
+ <dl id="envs" class="manifest">
17
+ <% env.each do |current| %>
18
+ <dt class="key"><%= env_names[current] %> (<%= current.root.root %>)</dt>
19
+ <dd class="value">
20
+ <dl id="manifests" class="manifest">
21
+
22
+ <!-- cgis manifest -->
23
+ <dt class="key">cgis</dt>
24
+ <dd class="value">
25
+ <ol>
26
+ <% current.cgis.build.minimap.each do |(name, obj)| %>
27
+ <% path = obj.kind_of?(Tap::Support::Constant) ? obj.require_path : name %>
28
+ <li><a href="<%= name %>"><%= name %></a> (<%= current.root.relative_filepath(:root, path) || path %>)</li>
29
+ <% end %>
30
+ </ol>
31
+ </dd>
32
+
33
+ <!-- tasks manifest -->
34
+ <dt class="key">tasks</dt>
35
+ <dd class="value">
36
+ <ol>
37
+ <% current.tasks.build.minimap.each do |(name, obj)| %>
38
+ <% path = obj.kind_of?(Tap::Support::Constant) ? obj.require_path : name %>
39
+ <li><a href="<%= env_names[env] %>%3Arun?tasc=<%= env_names[env] %>%3A<%= name %>"><%= name %></a> (<%= current.root.relative_filepath(:root, path) || path %>)</li>
40
+ <% end %>
41
+ </ol>
42
+ </dd>
43
+ </dl>
44
+ </dd>
45
+ <% end %>
46
+ </dl>
47
+ </div>
48
+
49
+ <div id="nav">
50
+ <ul>
51
+ <li><a href="index?refresh=true">Refresh</a></li>
52
+ </ul>
53
+ </div>
54
+
55
+ </body>
56
+ </html>
data/template/run.erb ADDED
@@ -0,0 +1,31 @@
1
+ <html>
2
+ <head>
3
+ <!-- <link rel="stylesheet" type="text/css" href="/stylesheets/run.css" /> -->
4
+ <script src="/javascripts/prototype.js"></script>
5
+ <script src="/javascripts/run.js"></script>
6
+ </head>
7
+ <body>
8
+ <form id="run-form" enctype="multipart/form-data" method="post" action="run">
9
+ <ol id="schema">
10
+ <% index = 0 %>
11
+ <% schema.nodes.each do |node| %>
12
+ <%= render('run/node.erb', :env => env, :node => node, :index => index ) %>
13
+ <% index += 1 %>
14
+ <% end %>
15
+ <% schema.rounds(true).each do |round| %>
16
+ <%= render('run/round.erb', :env => env, :round => round) %>
17
+ <% end %>
18
+ <% schema.send(:each_join_str) do |join| %>
19
+ <%= render('run/join.erb', :env => env, :join => join) %>
20
+ <% end %>
21
+ </ol>
22
+ <ul class="controls">
23
+ <li><%= render('run/manifest.erb') %></li>
24
+ <li><a href="javascript:Tap.Run.add('schema');">add</a></li>
25
+ <li><a href="javascript:Tap.Run.remove('schema');">remove</a></li>
26
+ <li><a href="javascript:Tap.Run.update('run-form');">update</a></li>
27
+ </ul>
28
+ <input id="submit-form" type="submit" value="Submit" />
29
+ </form>
30
+ </body>
31
+ </html>
@@ -0,0 +1,3 @@
1
+ <li class="task">
2
+ <input name="joins" value="--<%= join %>" />
3
+ </li>
@@ -0,0 +1,8 @@
1
+ <select id="tasc_manifest" class="manifest">
2
+ <option value="">(none)</option>
3
+ <% env.minimap.each do |(env_name, env)| %>
4
+ <% env.tasks.build.minimap.each do |(name, const)| %>
5
+ <option value="<%= env_name %>:<%= name %>"><%= env_name %>:<%= name %></option>
6
+ <% end %>
7
+ <% end %>
8
+ </select>
@@ -0,0 +1,50 @@
1
+ <% argv = node.argv %>
2
+ <% tasc_identifier = argv.shift %>
3
+ <% tasc = env.tasks.search(tasc_identifier).constantize %>
4
+ <% task, args = tasc.parse(argv) %>
5
+ <% lazydoc = tasc.lazydoc[tasc.to_s] %>
6
+ <li id="node_<%= index %>" class="node">
7
+ <!-- controls -->
8
+ <ul>
9
+ <li><input id="source_checkbox_<%= index %>" class="source_checkbox" name="source" value="<%= index %>" type="checkbox" /></li>
10
+ <li><input id="target_checkbox_<%= index %>" class="target_checkbox" name="target" value="<%= index %>" type="checkbox" /></li>
11
+ </ul>
12
+
13
+ <span class="class"><%= tasc %></span>:
14
+ <span class="summary"><%= lazydoc['manifest'].subject %></span>
15
+ <pre><%= lazydoc['manifest'].wrap %></pre>
16
+
17
+ <!-- tasc identifier -->
18
+ <input name="nodes[<%= index %>][0]" type="hidden" value="<%= tasc_identifier %>" />
19
+
20
+ <ul>
21
+ <!-- inputs -->
22
+ <li class="input">
23
+ <% args.collect! {|arg| arg =~ /\s/ ? "'#{arg}'" : arg} %>
24
+ <input class="value" name="nodes[<%= index %>][1]%w" value="<%= args.join(' ') %>" />
25
+ <span class="name"><%= lazydoc['args'].subject %></span>
26
+ </li>
27
+
28
+ <!-- configurations -->
29
+ <% tasc.configurations.each do |receiver, key, config| %>
30
+ <li class="config">
31
+ <input class="key" name="nodes[<%= index %>][2]" type="hidden" value="--<%= key.to_s.gsub('_', '-') %>" />
32
+ <input class="value" name="nodes[<%= index %>][2]" value="<%= task.config[key] %>" />
33
+ <span class="name"><%= key %></span>:
34
+ <span class="desc"><%= config.desc.to_str %></span>
35
+ </li>
36
+ <% end %>
37
+
38
+ <!-- options -->
39
+ <li class="options">
40
+ <input class="key" name="nodes[<%= index %>][2]" type="hidden" value="--name" />
41
+ <input class="value" name="nodes[<%= index %>][2]" value="<%= task.name %>" />
42
+ <span class="name">Name</span>
43
+ </li>
44
+
45
+ <!-- <li class="options">
46
+ <input class="globalize" name="nodes[<%= index %>][2]" type="checkbox" value="--*<%= index %>" />
47
+ <span class="name">Globalize</span>
48
+ </li> -->
49
+ </ul>
50
+ </li>
File without changes
@@ -0,0 +1,93 @@
1
+ require 'strscan'
2
+
3
+ class UrlEncodedPairParser < StringScanner #:nodoc:
4
+ attr_reader :top, :parent, :result
5
+
6
+ def initialize(pairs = [])
7
+ super('')
8
+ @result = {}
9
+ pairs.each { |key, value| parse(key, value) }
10
+ end
11
+
12
+ KEY_REGEXP = %r{([^\[\]=&]+)}
13
+ BRACKETED_KEY_REGEXP = %r{\[([^\[\]=&]+)\]}
14
+
15
+ # Parse the query string
16
+ def parse(key, value)
17
+ self.string = key
18
+ @top, @parent = result, nil
19
+
20
+ # First scan the bare key
21
+ key = scan(KEY_REGEXP) or return
22
+ key = post_key_check(key)
23
+
24
+ # Then scan as many nestings as present
25
+ until eos?
26
+ r = scan(BRACKETED_KEY_REGEXP) or return
27
+ key = self[1]
28
+ key = post_key_check(key)
29
+ end
30
+
31
+ bind(key, value)
32
+ end
33
+
34
+ private
35
+ # After we see a key, we must look ahead to determine our next action. Cases:
36
+ #
37
+ # [] follows the key. Then the value must be an array.
38
+ # = follows the key. (A value comes next)
39
+ # & or the end of string follows the key. Then the key is a flag.
40
+ # otherwise, a hash follows the key.
41
+ def post_key_check(key)
42
+ if scan(/\[\]/) # a[b][] indicates that b is an array
43
+ container(key, Array)
44
+ nil
45
+ elsif check(/\[[^\]]/) # a[b] indicates that a is a hash
46
+ container(key, Hash)
47
+ nil
48
+ else # End of key? We do nothing.
49
+ key
50
+ end
51
+ end
52
+
53
+ # Add a container to the stack.
54
+ def container(key, klass)
55
+ type_conflict! klass, top[key] if top.is_a?(Hash) && top.key?(key) && ! top[key].is_a?(klass)
56
+ value = bind(key, klass.new)
57
+ type_conflict! klass, value unless value.is_a?(klass)
58
+ push(value)
59
+ end
60
+
61
+ # Push a value onto the 'stack', which is actually only the top 2 items.
62
+ def push(value)
63
+ @parent, @top = @top, value
64
+ end
65
+
66
+ # Bind a key (which may be nil for items in an array) to the provided value.
67
+ def bind(key, value)
68
+ if top.is_a? Array
69
+ if key
70
+ if top[-1].is_a?(Hash) && ! top[-1].key?(key)
71
+ top[-1][key] = value
72
+ else
73
+ top << {key => value}#.with_indifferent_access
74
+ push top.last
75
+ end
76
+ else
77
+ top << value
78
+ end
79
+ elsif top.is_a? Hash
80
+ key = CGI.unescape(key)
81
+ parent << (@top = {}) if top.key?(key) && parent.is_a?(Array)
82
+ return top[key] ||= value
83
+ else
84
+ raise ArgumentError, "Don't know what to do: top is #{top.inspect}"
85
+ end
86
+
87
+ return value
88
+ end
89
+
90
+ def type_conflict!(klass, value)
91
+ raise TypeError, "Conflicting types for parameter containers. Expected an instance of #{klass} but found an instance of #{value.class}. This can be caused by colliding Array and Hash parameters like qs[]=value&qs[key]=value."
92
+ end
93
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bahuvrihi-tap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Chiang
@@ -34,6 +34,7 @@ files:
34
34
  - cmd/destroy.rb
35
35
  - cmd/generate.rb
36
36
  - cmd/manifest.rb
37
+ - cmd/server.rb
37
38
  - cmd/run.rb
38
39
  - doc/Tutorial
39
40
  - doc/Class Reference
@@ -74,6 +75,7 @@ files:
74
75
  - lib/tap/generator/manifest.rb
75
76
  - lib/tap/patches/optparse/summarize.rb
76
77
  - lib/tap/root.rb
78
+ - lib/tap/spec.rb
77
79
  - lib/tap/support/aggregator.rb
78
80
  - lib/tap/support/assignments.rb
79
81
  - lib/tap/support/audit.rb
@@ -88,6 +90,7 @@ files:
88
90
  - lib/tap/support/dependency.rb
89
91
  - lib/tap/support/executable.rb
90
92
  - lib/tap/support/executable_queue.rb
93
+ - lib/tap/support/gems/rack.rb
91
94
  - lib/tap/support/gems/rake.rb
92
95
  - lib/tap/support/gems.rb
93
96
  - lib/tap/support/instance_configuration.rb
@@ -99,8 +102,8 @@ files:
99
102
  - lib/tap/support/joins/sequence.rb
100
103
  - lib/tap/support/joins/switch.rb
101
104
  - lib/tap/support/joins/sync_merge.rb
102
- - lib/tap/support/lazy_attributes.rb
103
105
  - lib/tap/support/lazydoc.rb
106
+ - lib/tap/support/lazydoc/attributes.rb
104
107
  - lib/tap/support/lazydoc/comment.rb
105
108
  - lib/tap/support/lazydoc/config.rb
106
109
  - lib/tap/support/lazydoc/definition.rb
@@ -137,6 +140,17 @@ files:
137
140
  - lib/tap/test/utils.rb
138
141
  - lib/tap/test.rb
139
142
  - lib/tap.rb
143
+ - public/javascripts/prototype.js
144
+ - public/javascripts/run.js
145
+ - public/stylesheets/run.css
146
+ - template/404.erb
147
+ - template/index.erb
148
+ - template/run.erb
149
+ - template/run/join.erb
150
+ - template/run/manifest.erb
151
+ - template/run/node.erb
152
+ - template/run/round.erb
153
+ - vendor/url_encoded_pair_parser.rb
140
154
  - README
141
155
  - MIT-LICENSE
142
156
  - History
@@ -1,45 +0,0 @@
1
- require 'tap/support/lazydoc'
2
-
3
- module Tap
4
- module Support
5
-
6
- # LazyAttributes adds methods to declare class-level accessors
7
- # for Lazydoc attributes. The source_file for the class must
8
- # be set manually.
9
- #
10
- # # ConstName::key value
11
- # class ConstName
12
- # extend LazyAttributes
13
- #
14
- # self.source_file = __FILE__
15
- # lazy_attr :key
16
- # end
17
- #
18
- # ConstName::key.subject # => 'value'
19
- #
20
- module LazyAttributes
21
-
22
- # The source_file for self. Must be set independently.
23
- attr_accessor :source_file
24
-
25
- # Returns the lazydoc for source_file
26
- def lazydoc(resolve=true)
27
- lazydoc = Lazydoc[source_file]
28
- lazydoc.resolve if resolve
29
- lazydoc
30
- end
31
-
32
- # Creates a lazy attribute accessor for the specified attribute.
33
- def lazy_attr(key, attribute=key)
34
- instance_eval %Q{
35
- def #{key}
36
- lazydoc[to_s]['#{attribute}'] ||= Lazydoc::Comment.new
37
- end
38
-
39
- def #{key}=(comment)
40
- Lazydoc[source_file][to_s]['#{attribute}'] = comment
41
- end}
42
- end
43
- end
44
- end
45
- end