tagz 0.0.4 → 1.0.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.
Files changed (70) hide show
  1. data/README +240 -0
  2. data/README.tmpl +240 -0
  3. data/install.rb +4 -0
  4. data/lib/tagz.rb +146 -351
  5. data/test/tagz.rb +226 -191
  6. metadata +3 -106
  7. data/lib/tagz/rails.rb +0 -198
  8. data/rails/README +0 -182
  9. data/rails/Rakefile +0 -10
  10. data/rails/app/controllers/application.rb +0 -7
  11. data/rails/app/controllers/tagz_controller.rb +0 -51
  12. data/rails/app/helpers/application_helper.rb +0 -3
  13. data/rails/app/helpers/tagz_helper.rb +0 -2
  14. data/rails/app/views/layouts/layout.rb +0 -16
  15. data/rails/app/views/tagz/b.rb +0 -19
  16. data/rails/app/views/tagz/c.rb +0 -9
  17. data/rails/app/views/tagz/d.rhtml +0 -17
  18. data/rails/app/views/tagz/e.rb +0 -3
  19. data/rails/config/boot.rb +0 -45
  20. data/rails/config/database.yml +0 -36
  21. data/rails/config/environment.rb +0 -65
  22. data/rails/config/environments/development.rb +0 -21
  23. data/rails/config/environments/production.rb +0 -18
  24. data/rails/config/environments/test.rb +0 -19
  25. data/rails/config/lighttpd.conf +0 -54
  26. data/rails/config/routes.rb +0 -23
  27. data/rails/doc/README_FOR_APP +0 -2
  28. data/rails/log/development.log +0 -6713
  29. data/rails/log/fastcgi.crash.log +0 -103
  30. data/rails/log/lighttpd.access.log +0 -171
  31. data/rails/log/lighttpd.error.log +0 -116
  32. data/rails/log/production.log +0 -0
  33. data/rails/log/server.log +0 -0
  34. data/rails/log/test.log +0 -0
  35. data/rails/public/404.html +0 -30
  36. data/rails/public/500.html +0 -30
  37. data/rails/public/dispatch.cgi +0 -10
  38. data/rails/public/dispatch.fcgi +0 -24
  39. data/rails/public/dispatch.rb +0 -10
  40. data/rails/public/favicon.ico +0 -0
  41. data/rails/public/images/rails.png +0 -0
  42. data/rails/public/index.html +0 -277
  43. data/rails/public/javascripts/application.js +0 -2
  44. data/rails/public/javascripts/controls.js +0 -833
  45. data/rails/public/javascripts/dragdrop.js +0 -942
  46. data/rails/public/javascripts/effects.js +0 -1088
  47. data/rails/public/javascripts/prototype.js +0 -2515
  48. data/rails/public/robots.txt +0 -1
  49. data/rails/script/about +0 -3
  50. data/rails/script/breakpointer +0 -3
  51. data/rails/script/console +0 -3
  52. data/rails/script/destroy +0 -3
  53. data/rails/script/generate +0 -3
  54. data/rails/script/performance/benchmarker +0 -3
  55. data/rails/script/performance/profiler +0 -3
  56. data/rails/script/plugin +0 -3
  57. data/rails/script/process/inspector +0 -3
  58. data/rails/script/process/reaper +0 -3
  59. data/rails/script/process/spawner +0 -3
  60. data/rails/script/runner +0 -3
  61. data/rails/script/server +0 -4
  62. data/rails/test/functional/tagz_controller_test.rb +0 -18
  63. data/rails/test/test_helper.rb +0 -28
  64. data/rails/tmp/cache/index.html-gzip-1958902-7552-1181801882 +0 -0
  65. data/rails/tmp/cache/javascripts/effects.js-gzip-1958907-38200-1181801882 +0 -0
  66. data/rails/tmp/cache/javascripts/prototype.js-gzip-1958906-71260-1181801882 +0 -0
  67. data/rails/tmp/sessions/ruby_sess.365e696810aa7418 +0 -0
  68. data/rails/tmp/sessions/ruby_sess.3ab0cb2f589d3855 +0 -0
  69. data/rails/tmp/sessions/ruby_sess.c812e68d96a6e99f +0 -0
  70. data/rails/tmp/sessions/ruby_sess.e0a954440a7e27d7 +0 -0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tagz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ara T. Howard
@@ -26,112 +26,9 @@ files:
26
26
  - gen_readme.rb
27
27
  - install.rb
28
28
  - lib
29
- - lib/tagz
30
- - lib/tagz/rails.rb
31
29
  - lib/tagz.rb
32
- - rails
33
- - rails/app
34
- - rails/app/controllers
35
- - rails/app/controllers/application.rb
36
- - rails/app/controllers/tagz_controller.rb
37
- - rails/app/helpers
38
- - rails/app/helpers/application_helper.rb
39
- - rails/app/helpers/tagz_helper.rb
40
- - rails/app/models
41
- - rails/app/views
42
- - rails/app/views/layouts
43
- - rails/app/views/layouts/layout.rb
44
- - rails/app/views/layouts/tagz
45
- - rails/app/views/tagz
46
- - rails/app/views/tagz/b.rb
47
- - rails/app/views/tagz/c.rb
48
- - rails/app/views/tagz/d.rhtml
49
- - rails/app/views/tagz/e.rb
50
- - rails/components
51
- - rails/config
52
- - rails/config/boot.rb
53
- - rails/config/database.yml
54
- - rails/config/environment.rb
55
- - rails/config/environments
56
- - rails/config/environments/development.rb
57
- - rails/config/environments/production.rb
58
- - rails/config/environments/test.rb
59
- - rails/config/lighttpd.conf
60
- - rails/config/routes.rb
61
- - rails/db
62
- - rails/doc
63
- - rails/doc/README_FOR_APP
64
- - rails/lib
65
- - rails/lib/tasks
66
- - rails/log
67
- - rails/log/development.log
68
- - rails/log/fastcgi.crash.log
69
- - rails/log/lighttpd.access.log
70
- - rails/log/lighttpd.error.log
71
- - rails/log/production.log
72
- - rails/log/server.log
73
- - rails/log/test.log
74
- - rails/public
75
- - rails/public/404.html
76
- - rails/public/500.html
77
- - rails/public/dispatch.cgi
78
- - rails/public/dispatch.fcgi
79
- - rails/public/dispatch.rb
80
- - rails/public/favicon.ico
81
- - rails/public/images
82
- - rails/public/images/rails.png
83
- - rails/public/index.html
84
- - rails/public/javascripts
85
- - rails/public/javascripts/application.js
86
- - rails/public/javascripts/controls.js
87
- - rails/public/javascripts/dragdrop.js
88
- - rails/public/javascripts/effects.js
89
- - rails/public/javascripts/prototype.js
90
- - rails/public/robots.txt
91
- - rails/public/stylesheets
92
- - rails/Rakefile
93
- - rails/README
94
- - rails/script
95
- - rails/script/about
96
- - rails/script/breakpointer
97
- - rails/script/console
98
- - rails/script/destroy
99
- - rails/script/generate
100
- - rails/script/performance
101
- - rails/script/performance/benchmarker
102
- - rails/script/performance/profiler
103
- - rails/script/plugin
104
- - rails/script/process
105
- - rails/script/process/inspector
106
- - rails/script/process/reaper
107
- - rails/script/process/spawner
108
- - rails/script/runner
109
- - rails/script/server
110
- - rails/test
111
- - rails/test/fixtures
112
- - rails/test/functional
113
- - rails/test/functional/tagz_controller_test.rb
114
- - rails/test/integration
115
- - rails/test/mocks
116
- - rails/test/mocks/development
117
- - rails/test/mocks/test
118
- - rails/test/test_helper.rb
119
- - rails/test/unit
120
- - rails/tmp
121
- - rails/tmp/cache
122
- - rails/tmp/cache/index.html-gzip-1958902-7552-1181801882
123
- - rails/tmp/cache/javascripts
124
- - rails/tmp/cache/javascripts/effects.js-gzip-1958907-38200-1181801882
125
- - rails/tmp/cache/javascripts/prototype.js-gzip-1958906-71260-1181801882
126
- - rails/tmp/pids
127
- - rails/tmp/sessions
128
- - rails/tmp/sessions/ruby_sess.365e696810aa7418
129
- - rails/tmp/sessions/ruby_sess.3ab0cb2f589d3855
130
- - rails/tmp/sessions/ruby_sess.c812e68d96a6e99f
131
- - rails/tmp/sessions/ruby_sess.e0a954440a7e27d7
132
- - rails/tmp/sockets
133
- - rails/vendor
134
- - rails/vendor/plugins
30
+ - README
31
+ - README.tmpl
135
32
  - sample
136
33
  - sample/a.rb
137
34
  - test
@@ -1,198 +0,0 @@
1
- module Tagz::Rails
2
- class Renderer
3
- class Erbout
4
- def self.for *a, &b
5
- new *a, &b
6
- end
7
- def initialize context
8
- @context = context
9
- end
10
- def nil?
11
- true
12
- end
13
- def method_missing m, *a, &b
14
- @context.send m, *a, &b
15
- end
16
- end
17
-
18
- class Context
19
- include Tagz
20
-
21
- attr_accessor "__view__"
22
- attr_accessor "__erbout__"
23
- attr_accessor "__eol__"
24
-
25
- def self.create view, local_assigns
26
- context = new
27
- context.__view__ = view
28
-
29
- view.assigns.merge(local_assigns).each do |k,v|
30
- context.instance_variable_set "@#{ k }", v
31
- end
32
-
33
- local_assigns.each do |k,v|
34
- context.singleton_class{ define_method(k.to_s){ v } }
35
- end
36
-
37
- context.instance_variable_set "@content_for_layout", view.instance_variable_get("@content_for_layout")
38
- context
39
- end
40
-
41
- def self.render view, local_assigns, *argv
42
- context = create view, local_assigns
43
-
44
- pushing context do
45
- source = argv.first
46
- filename = argv.last
47
-
48
- content_for_lookup = lambda do |*names|
49
- name = names.shift || :layout
50
- context.instance_variable_get "@content_for_#{ name }"
51
- end
52
-
53
- before_ivars = context.instance_variables
54
-
55
- content_for_layout = context.__render__ source, filename, &content_for_lookup
56
-
57
- after_ivars = context.instance_variables
58
-
59
- #new_ivars = ( after_ivars - before_ivars ).delete_if{|ivar| ivar =~ %r/^@(__|content_for_)/o}
60
- new_ivars = ( after_ivars - before_ivars ).delete_if{|ivar| ivar =~ %r/^@(__)/o}
61
-
62
- new_ivars.each do |ivar|
63
- key = ivar[1..-1]
64
- value = context.instance_variable_get ivar
65
- view.assigns[key] = value
66
- end
67
-
68
- content_for_layout
69
- end
70
- end
71
-
72
- def self.stack
73
- @stack ||= []
74
- end
75
-
76
- def self.pushing context
77
- stack.push context
78
- begin
79
- yield
80
- ensure
81
- stack.pop
82
- end
83
- end
84
-
85
- def self.depth
86
- stack.size
87
- end
88
-
89
- def __render__ source, filename
90
- tagz {
91
- content_for_layout = eval source.to_s, binding, filename
92
- }
93
- end
94
-
95
- def singleton_class &b
96
- sc =
97
- class << self
98
- self
99
- end
100
- b ? sc.module_eval(&b) : sc
101
- end
102
-
103
- def method_missing m, *a, &b
104
- case m.to_s
105
- when %r/^(.*[^_])_(!)?$/o
106
- m, bang = $1, $2
107
- unless bang
108
- __tag_start__ m, *a, &b
109
- else
110
- __tag_start__(m, *a){}
111
- end
112
- when %r/^_([^_].*)$/o
113
- m = $1
114
- __tag_stop__ m, *a, &b
115
- else
116
- __view__.send m, *a, &b
117
- end
118
- end
119
-
120
- def flash *a, &b
121
- __view__.controller.send :flash, *a, &b
122
- end
123
-
124
- def _erbout
125
- self.__erbout__ ||= Erbout.for(self)
126
- #Erbout.for self
127
- end
128
-
129
- def << s
130
- __ s; nil
131
- end
132
-
133
- def puts *a
134
- a.each{|elem| self << "#{ elem.to_s.chomp }#{ eol }"}
135
- end
136
-
137
- def p *a
138
- a.each{|elem| self << "#{ CGI.escapeHTML elem.inspect }#{ eol }"}
139
- end
140
-
141
- def print *a
142
- a.each{|elem| self << elem}
143
- end
144
-
145
- def eol
146
- if __view__.controller.response.content_type =~ %r|text/plain|io
147
- "\n"
148
- else
149
- "<br />"
150
- end
151
- end
152
-
153
- def capture *a, &b
154
- b.call *a
155
- end
156
-
157
- def content_for(name, &block)
158
- name, ivar = "content_for_#{ name }", "@content_for_#{ name }"
159
- value = instance_variable_get(ivar).to_s
160
- value << capture(&block).to_s
161
- instance_variable_set ivar, value
162
- __view__.assigns[name] = value
163
- nil
164
- end
165
-
166
- end
167
-
168
- def initialize view
169
- @view = view
170
- end
171
-
172
- def render template, local_assigns, path
173
- (( Context.render @view, local_assigns, template, path )).to_s
174
- end
175
- end
176
-
177
- def self.new *a, &b
178
- Renderer.new *a, &b
179
- end
180
-
181
- #if defined? ::ActionView and defined? ::ActionView::Base
182
- ### TODO - see if this hack can be pulled out
183
- module ::ActionView # thanks _why !
184
- class Base
185
- def render_template(template_extension, template, file_path = nil, local_assigns = {})
186
- if handler = @@template_handlers[template_extension]
187
- template ||= read_template_file(file_path, template_extension)
188
- handler.new(self).render(template, local_assigns, file_path)
189
- else
190
- compile_and_render_template(template_extension, template, file_path, local_assigns)
191
- end
192
- end
193
- end
194
- end
195
- ::ActionView::Base.register_template_handler 'rb', Tagz::Rails
196
- ::ActionView::Base.register_template_handler 'tagz', Tagz::Rails
197
- #end
198
- end
@@ -1,182 +0,0 @@
1
- == Welcome to Rails
2
-
3
- Rails is a web-application and persistence framework that includes everything
4
- needed to create database-backed web-applications according to the
5
- Model-View-Control pattern of separation. This pattern splits the view (also
6
- called the presentation) into "dumb" templates that are primarily responsible
7
- for inserting pre-built data in between HTML tags. The model contains the
8
- "smart" domain objects (such as Account, Product, Person, Post) that holds all
9
- the business logic and knows how to persist themselves to a database. The
10
- controller handles the incoming requests (such as Save New Account, Update
11
- Product, Show Post) by manipulating the model and directing data to the view.
12
-
13
- In Rails, the model is handled by what's called an object-relational mapping
14
- layer entitled Active Record. This layer allows you to present the data from
15
- database rows as objects and embellish these data objects with business logic
16
- methods. You can read more about Active Record in
17
- link:files/vendor/rails/activerecord/README.html.
18
-
19
- The controller and view are handled by the Action Pack, which handles both
20
- layers by its two parts: Action View and Action Controller. These two layers
21
- are bundled in a single package due to their heavy interdependence. This is
22
- unlike the relationship between the Active Record and Action Pack that is much
23
- more separate. Each of these packages can be used independently outside of
24
- Rails. You can read more about Action Pack in
25
- link:files/vendor/rails/actionpack/README.html.
26
-
27
-
28
- == Getting started
29
-
30
- 1. At the command prompt, start a new rails application using the rails command
31
- and your application name. Ex: rails myapp
32
- (If you've downloaded rails in a complete tgz or zip, this step is already done)
33
- 2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
34
- 3. Go to http://localhost:3000/ and get "Welcome aboard: You’re riding the Rails!"
35
- 4. Follow the guidelines to start developing your application
36
-
37
-
38
- == Web Servers
39
-
40
- By default, Rails will try to use Mongrel and lighttpd if they are installed, otherwise
41
- Rails will use the WEBrick, the webserver that ships with Ruby. When you run script/server,
42
- Rails will check if Mongrel exists, then lighttpd and finally fall back to WEBrick. This ensures
43
- that you can always get up and running quickly.
44
-
45
- Mongrel is a Ruby-based webserver with a C-component (which requires compilation) that is
46
- suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
47
- getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
48
- More info at: http://mongrel.rubyforge.org
49
-
50
- If Mongrel is not installed, Rails will look for lighttpd. It's considerably faster than
51
- Mongrel and WEBrick and also suited for production use, but requires additional
52
- installation and currently only works well on OS X/Unix (Windows users are encouraged
53
- to start with Mongrel). We recommend version 1.4.11 and higher. You can download it from
54
- http://www.lighttpd.net.
55
-
56
- And finally, if neither Mongrel or lighttpd are installed, Rails will use the built-in Ruby
57
- web server, WEBrick. WEBrick is a small Ruby web server suitable for development, but not
58
- for production.
59
-
60
- But of course its also possible to run Rails on any platform that supports FCGI.
61
- Apache, LiteSpeed, IIS are just a few. For more information on FCGI,
62
- please visit: http://wiki.rubyonrails.com/rails/pages/FastCGI
63
-
64
-
65
- == Debugging Rails
66
-
67
- Have "tail -f" commands running on the server.log and development.log. Rails will
68
- automatically display debugging and runtime information to these files. Debugging
69
- info will also be shown in the browser on requests from 127.0.0.1.
70
-
71
-
72
- == Breakpoints
73
-
74
- Breakpoint support is available through the script/breakpointer client. This
75
- means that you can break out of execution at any point in the code, investigate
76
- and change the model, AND then resume execution! Example:
77
-
78
- class WeblogController < ActionController::Base
79
- def index
80
- @posts = Post.find(:all)
81
- breakpoint "Breaking out from the list"
82
- end
83
- end
84
-
85
- So the controller will accept the action, run the first line, then present you
86
- with a IRB prompt in the breakpointer window. Here you can do things like:
87
-
88
- Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint'
89
-
90
- >> @posts.inspect
91
- => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
92
- #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
93
- >> @posts.first.title = "hello from a breakpoint"
94
- => "hello from a breakpoint"
95
-
96
- ...and even better is that you can examine how your runtime objects actually work:
97
-
98
- >> f = @posts.first
99
- => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
100
- >> f.
101
- Display all 152 possibilities? (y or n)
102
-
103
- Finally, when you're ready to resume execution, you press CTRL-D
104
-
105
-
106
- == Console
107
-
108
- You can interact with the domain model by starting the console through <tt>script/console</tt>.
109
- Here you'll have all parts of the application configured, just like it is when the
110
- application is running. You can inspect domain models, change values, and save to the
111
- database. Starting the script without arguments will launch it in the development environment.
112
- Passing an argument will specify a different environment, like <tt>script/console production</tt>.
113
-
114
- To reload your controllers and models after launching the console run <tt>reload!</tt>
115
-
116
- To reload your controllers and models after launching the console run <tt>reload!</tt>
117
-
118
-
119
-
120
- == Description of contents
121
-
122
- app
123
- Holds all the code that's specific to this particular application.
124
-
125
- app/controllers
126
- Holds controllers that should be named like weblogs_controller.rb for
127
- automated URL mapping. All controllers should descend from ApplicationController
128
- which itself descends from ActionController::Base.
129
-
130
- app/models
131
- Holds models that should be named like post.rb.
132
- Most models will descend from ActiveRecord::Base.
133
-
134
- app/views
135
- Holds the template files for the view that should be named like
136
- weblogs/index.rhtml for the WeblogsController#index action. All views use eRuby
137
- syntax.
138
-
139
- app/views/layouts
140
- Holds the template files for layouts to be used with views. This models the common
141
- header/footer method of wrapping views. In your views, define a layout using the
142
- <tt>layout :default</tt> and create a file named default.rhtml. Inside default.rhtml,
143
- call <% yield %> to render the view using this layout.
144
-
145
- app/helpers
146
- Holds view helpers that should be named like weblogs_helper.rb. These are generated
147
- for you automatically when using script/generate for controllers. Helpers can be used to
148
- wrap functionality for your views into methods.
149
-
150
- config
151
- Configuration files for the Rails environment, the routing map, the database, and other dependencies.
152
-
153
- components
154
- Self-contained mini-applications that can bundle together controllers, models, and views.
155
-
156
- db
157
- Contains the database schema in schema.rb. db/migrate contains all
158
- the sequence of Migrations for your schema.
159
-
160
- doc
161
- This directory is where your application documentation will be stored when generated
162
- using <tt>rake doc:app</tt>
163
-
164
- lib
165
- Application specific libraries. Basically, any kind of custom code that doesn't
166
- belong under controllers, models, or helpers. This directory is in the load path.
167
-
168
- public
169
- The directory available for the web server. Contains subdirectories for images, stylesheets,
170
- and javascripts. Also contains the dispatchers and the default HTML files. This should be
171
- set as the DOCUMENT_ROOT of your web server.
172
-
173
- script
174
- Helper scripts for automation and generation.
175
-
176
- test
177
- Unit and functional tests along with fixtures. When using the script/generate scripts, template
178
- test files will be generated for you and placed in this directory.
179
-
180
- vendor
181
- External libraries that the application depends on. Also includes the plugins subdirectory.
182
- This directory is in the load path.