dryml-firemarker 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -7,19 +7,16 @@ Adds DRYML markers viewable with FireMarker (a Firefox/Firebug extension)
7
7
  Dryml FireMarker is a tool composed by 2 components:
8
8
 
9
9
  1. "FireMarker": a Firebug extension that graphically shows special markers embedded in any HTML page.
10
- 2. "dryml-firemarker": a gem to use with Dryml/Hobo that simply marks (with FireMarker markers),
11
- specific parts of HTML with their related metainfo.
10
+ 2. "dryml-firemarker": a gem to use with Dryml/Hobo that simply marks (with FireMarker markers), specific parts of HTML with their related metainfo.
12
11
 
13
12
  ## 1. FireMarker (FF extension)
14
13
 
15
- FireMarker is an extension for Firebug that graphically shows special markers embedded in any HTML page. Its main
16
- benefit is that you can easily read the metainfo related to any specific part of the HTML by just hovering the
17
- mouse on the page-item. It also adds a few interactive features to Firebug and an inline file viewer/editor.
14
+ FireMarker is an extension for Firebug that graphically shows special markers embedded in any HTML page. Its main benefit is that you can easily read the metainfo related to any specific part of the HTML by just hovering the mouse on the page-item. It also adds a few interactive features to Firebug and an inline file viewer/editor.
18
15
 
19
16
  ### 1.1 Requirements
20
17
 
21
18
  - Recent Firefox >= 3.6
22
- - Recent Firebug (I use the 1.7.1 but it might work on older versions too)
19
+ - Recent Firebug
23
20
 
24
21
  ### 1.2 Installation
25
22
 
@@ -35,47 +32,49 @@ Dryml FireMarker is a ruby gem, so you can istall it as usual:
35
32
 
36
33
  $ [sudo] gem install dryml-firemarker
37
34
 
38
- Since Dryml is implemented in 3 different ways in Hobo 1.0.x, Dryml 1.1.x and Dryml >= 1.3,
39
- you must setup your app consistently with the dryml version it uses.
35
+ Since Dryml is implemented in 3 different ways in Hobo 1.0.x, Dryml 1.1.x and Dryml >= 1.3, you must setup your app consistently with the dryml version it uses.
40
36
 
41
- ### 2.1 Hobo 1.0.x and Hobo/Dryml 1.1.x
37
+ ### 2.1 Hobo 1.0.x and Hobo/Dryml 1.1.x Setup
42
38
 
43
- #### Setup
39
+ In an initializer file:
44
40
 
45
- In the `environment.rb` file:
46
-
47
- config.gem 'dryml-firemarker', :lib => 'dryml<version>-firemarker'
41
+ DRYML_METAINFO = RAILS_ENV == 'development'
42
+ require 'dryml<version>-firemarker'
48
43
 
49
44
  \<version\> is '10' for Hobo 1.0.x or '11' for Hobo/Dryml 1.1.x
50
45
 
51
- If you use the `rapid` taglib (i.e. Hobo) you have also to add a tag in the `views/auto/taglibs/application.dryml` file:
46
+ You must set the `DRYML_METAINFO` in order to include the metainfo in the page.
52
47
 
53
- <include plugin="dryml-firemarker"/>
48
+ ### 2.2. Hobo/Dryml >= 1.3 Setup
54
49
 
55
- Notice that you must add it after the inclusion of the `rapid` taglib.
50
+ Add just one line to the `Gemfile` file:
56
51
 
57
- #### Notes
52
+ gem 'dryml-firemarker', :require => 'dryml13-firemarker', :group => :development
58
53
 
59
- If your app uses the `rapid` taglib, the gem for the 1.0.x and 1.1.x should be loaded in the regular `environment.rb`
60
- (i.e. not just in `development.rb`), since it fixes a few consolidated bugs coded in that taglib. Besides,
61
- you can safely load it in all environments, because - by default - it will add the matainfo to the page only in
62
- development mode, and will keep the fixes consistent in all environments.
54
+ There are no bugs to fix in the Hobo/Dryml >= 1.3.0 version, so you don't need to set the `DRYML_METAINFO` in order to include the metainfo in the page. You can add or skip the metainfo by just adding or commenting out the previous statement (and restart the app).
63
55
 
64
- You can also force the inclusion or the skipping of the metainfo in the page, by setting the `DRYML_METAINFO`
65
- boolean constant just before the `config.gem 'dryml-firemarker',...` statement.
56
+ ### Notes
66
57
 
67
- If your application needs to override one of `hobo-rapid-javascripts`, `part-contexts-javascripts` or
68
- `page-scripts` helpers/tags, you must take into account that the tags that your application uses are defined in
69
- the `dryml-firemarker.dryml` taglib included in this gem (and not the same tags defined in the regular rapid taglib).
58
+ With an initializer file you can ignore the file from version control, in order to avoid to impose its use to anybody else in your team.
70
59
 
71
- ### 2.2. Hobo/Dryml >= 1.3
60
+ If your app uses the `rapid` taglib, the gem for the 1.0.x and 1.1.x should be loaded in all environments, since it fixes a few consolidated bugs coded in that taglib. Besides, you can safely load it in all environments, because - by default - it will add the matainfo to the page only in development mode, and will keep the fixes consistent in all environments.
72
61
 
73
- Add just one line to the `Gemfile` file:
62
+ There is no clean way to have a local only solution in Rails 3 when you changes the Gemfile, since you have to list all the gems in the Gemfile. If you are working with a team and don't want to impose your Gemfile to the rest of the team and if you are using git, you can use the `git update-index --assume-unchanged Gemfile` command after your change to the Gemfile (and eventually the Gemfile.lock, and git will not bother you as long as you will not change the file again.
74
63
 
75
- gem 'dryml-firemarker', :require => 'dryml13-firemarker', :group => :development
64
+ Notice that you must restart the app when you want to enable/disable the metainfo, since Hobo adds them at template-compilation time (i.e. it's not a limitation of the Dryml FireMarker gem), and since sometimes, some metainfo added to the HTML, may break some non standard tag or javascript, you can use 2 different applications running on 2 different ports: with and without the metainfo. You can load/skip the loading of Dryml FireMarker by using an ENV variable set at server launch:
65
+
66
+ # wrap the loading in the code
67
+ if ENV["DRYML_METAINFO"]
68
+ ...
69
+ end
70
+
71
+ # rails 2
72
+ $ export DRYML_METAINFO=true; script/server -p 3001
73
+
74
+ # rails 3
75
+ $ export DRYML_METAINFO=true; rails s -p 3001
76
76
 
77
- There are no bugs to fix in the Hobo/Dryml >= 1.3.0 version, so you can add or skip the metainfo by just
78
- adding or commenting out the previous statement (and restart the app).
77
+ In the very rare case your application needs to override one of `hobo-rapid-javascripts`, `part-contexts-javascripts` or `page-scripts` helpers/tags, you must take into account that the tags that your application uses are defined in the `dryml-firemarker.dryml` taglib included in this gem (and not the same tags defined in the regular rapid taglib). The current implementation does not support that overriding, unless you also manually load the tag `<include plugin="dryml-firemarker"\>` right after the rapid tag inclusion in the application.dryml file.
79
78
 
80
79
  ## Mini Tutorial
81
80
 
@@ -88,27 +87,17 @@ adding or commenting out the previous statement (and restart the app).
88
87
  5. Select the "HTML" tab
89
88
  6. Uncheck "Show Comments" in the HTML tab menu
90
89
  7. Select the "Markers" tab in the Firebug HTML side panel
91
- 8. Check "dryml" option in the Markers tab menu Usage
90
+ 8. Check "dryml" option in the Markers tab menu
92
91
 
93
92
  ### Usage
94
93
 
95
- Select any node in the HTML panel or click on the Firebug's inspect icon and hover the mouse on any part of the page,
96
- then click on it to select the node: the Markers panel will be populated with all the markers that include that
97
- specific node. They are listed from close to far. The closest are the most specific markers that wrap the selected
98
- node: e.g. an \<a\> tag that produces a specific link; the farest are the most general: e.g. a \<page\> tag that wraps
99
- the whole page (including the \<a\> tag listed at the beginning).
94
+ Select any node in the HTML panel or click on the Firebug's inspect icon and hover the mouse on any part of the page, then click on it to select the node: the Markers panel will be populated with all the markers that include that specific node. They are listed from close to far. The closest are the most specific markers that wrap the selected node: e.g. an \<a\> tag that produces a specific link; the farest are the most general: e.g. a \<page\> tag that wraps the whole page (including the \<a\> tag listed at the beginning).
100
95
 
101
- Hovering up and down in the Markers list may be useful to understand what specific dryml statement is creating the
102
- specific highlighted part in the page and HTML source, and eventually helps to chose what to override. (Notice that
103
- invisible page-parts are highlighted only in the source and have a dimmed color.)
96
+ Hovering up and down in the Markers list may be useful to understand what specific dryml statement is creating the specific highlighted part in the page and HTML source, and eventually helps to chose what to override. (Notice that invisible page-parts are highlighted only in the source and have a dimmed color.)
104
97
 
105
- You can open any dryml file (at the right line) by clicking on the path listed in the marker's table. You can close
106
- it by clicking on it again. If you hold the "Ctrl" or the "Alt" key while you click on a path,
107
- you will open the file in a new FF tab instead: that might be useful when you need to explore a large file.
98
+ You can open any dryml file (at the right line) by clicking on the path listed in the marker's table. You can close it by clicking on it again. If you hold the "Ctrl" or the "Alt" key while you click on a path, you will open the file in a new FF tab instead: that might be useful when you need to explore a large file.
108
99
 
109
- The green paths (with an ending "+") are editable because they are application files,
110
- while the blue paths are just viewable, because they are libraries or auto-generated files that doesn't make sense to
111
- edit.
100
+ The green paths (with an ending "+") are editable because they are application files, while the blue paths are just viewable because they are libraries or auto-generated files that doesn't make sense to edit. Note: if you installed hobo as a pplugin (version
112
101
 
113
102
  If you want to save an edited file, just close it and FireMarker will ask if you want to save it.
114
103
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
@@ -1,9 +1,9 @@
1
- name = File.basename( __FILE__, '.gemspec' )
2
1
  version = File.read(File.expand_path('../VERSION', __FILE__)).strip
3
2
  require 'date'
4
3
 
5
4
  Gem::Specification.new do |s|
6
5
 
6
+ s.name = 'dryml-firemarker'
7
7
  s.summary = 'Adds DRYML markers viewable with FireMarker'
8
8
  s.description = 'Dryml FireMarker annotates the output of Hobo and Rails apps that use the DRYML templating system.',
9
9
  s.authors = ["Domizio Demichelis"]
@@ -12,7 +12,6 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = `git ls-files -z`.split("\0")
14
14
 
15
- s.name = name
16
15
  s.version = version
17
16
  s.date = Date.today.to_s
18
17
 
@@ -0,0 +1,19 @@
1
+ module DrymlFireMarker
2
+ module SharedOverrides
3
+
4
+ def compile_renderer_class_with_firemarker(*args)
5
+ taglibs = args.pop
6
+ taglibs << {:plugin => 'dryml-firemarker'}
7
+ args.push(taglibs)
8
+ compile_renderer_class_without_firemarker(*args)
9
+ end
10
+
11
+ def included(base)
12
+ base.class_eval do
13
+ alias_method_chain :compile_renderer_class, :firemarker
14
+ private :compile_renderer_class_with_firemarker, :compile_renderer_class_without_firemarker
15
+ end
16
+ end
17
+
18
+ end
19
+ end
@@ -1,13 +1,16 @@
1
1
  require 'pathname'
2
2
  require 'rbconfig'
3
+ require 'dryml-firemarker-shared-overrides'
3
4
 
4
5
  module DrymlFireMarker
5
6
 
7
+ extend self
8
+
6
9
  VERSION = File.read(File.expand_path('../../VERSION', __FILE__)).strip
7
10
 
8
11
  WINDOZE = RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw32|windows/i
9
12
 
10
- def self.metadata_to_json(template_path, kind, name, line, *args)
13
+ def metadata_to_json(template_path, kind, name, line, *args)
11
14
  keys = [ ] # we need to keep track of the key order for ruby 1.8.x unordered hashes
12
15
  metadata = { }
13
16
  metadata[kind] = name
@@ -27,17 +30,13 @@ module DrymlFireMarker
27
30
 
28
31
  private
29
32
 
30
- def self.auto_path
31
- if @auto_path.nil?
32
- @auto_path = Object.const_defined?(:Dryml) ?
33
- Dryml::DrymlGenerator.output_directory.to_s :
34
- Hobo::Dryml::DrymlGenerator::OUTPUT.to_s
35
- else
36
- @auto_path
37
- end
33
+ def auto_path
34
+ @auto_path ||= Object.const_defined?(:Dryml) ?
35
+ Dryml::DrymlGenerator.output_directory.to_s :
36
+ Hobo::Dryml::DrymlGenerator::OUTPUT.to_s
38
37
  end
39
38
 
40
- def self.rails_root
39
+ def rails_root
41
40
  @rails_root ||= Object.const_defined?(:Rails) ? Rails.root.to_s : RAILS_ROOT
42
41
  end
43
42
 
@@ -1,7 +1,7 @@
1
- DRYML_METAINFO = RAILS_ENV == "development" unless Object.const_defined?( :DRYML_METAINFO )
2
-
3
1
  module DrymlRootModule
4
2
 
3
+ include DrymlFireMarker::SharedOverrides
4
+
5
5
  class TemplateEnvironment
6
6
  undef_method :part_contexts_javascripts
7
7
  end
@@ -2,6 +2,9 @@ require 'dryml/template'
2
2
  require 'dryml-firemarker'
3
3
 
4
4
  module Dryml
5
+
6
+ include DrymlFireMarker::SharedOverrides
7
+
5
8
  class Template
6
9
 
7
10
  def wrap_source_with_metadata(content, kind, name, line, *args)
metadata CHANGED
@@ -1,67 +1,61 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: dryml-firemarker
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.9
4
5
  prerelease:
5
- version: 0.0.8
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Domizio Demichelis
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-06-06 00:00:00 -04:00
14
- default_executable:
12
+ date: 2011-11-10 00:00:00.000000000Z
15
13
  dependencies: []
16
-
17
- description: "[\"Dryml FireMarker annotates the output of Hobo and Rails apps that use the DRYML templating system.\", [\"Domizio Demichelis\"]]"
14
+ description: ! '["Dryml FireMarker annotates the output of Hobo and Rails apps that
15
+ use the DRYML templating system.", ["Domizio Demichelis"]]'
18
16
  email: dd.nexus@gmail.com
19
17
  executables: []
20
-
21
18
  extensions: []
22
-
23
- extra_rdoc_files:
19
+ extra_rdoc_files:
24
20
  - README.md
25
- files:
21
+ files:
26
22
  - .gitignore
27
23
  - LICENSE
28
24
  - README.md
29
25
  - Rakefile
30
26
  - VERSION
31
27
  - dryml-firemarker.gemspec
28
+ - lib/dryml-firemarker-shared-overrides.rb
32
29
  - lib/dryml-firemarker.dryml
33
30
  - lib/dryml-firemarker.rb
34
31
  - lib/dryml-overrides.rb
35
32
  - lib/dryml10-firemarker.rb
36
- - lib/dryml11_firemarker.rb
33
+ - lib/dryml11-firemarker.rb
37
34
  - lib/dryml13-firemarker.rb
38
- has_rdoc: true
39
- homepage: http://github.com/ddnexus/dryml-firemarker
35
+ homepage: http://github.com/ddnexus/Gem::Specification
40
36
  licenses: []
41
-
42
37
  post_install_message:
43
- rdoc_options:
38
+ rdoc_options:
44
39
  - --charset=UTF-8
45
- require_paths:
40
+ require_paths:
46
41
  - lib
47
- required_ruby_version: !ruby/object:Gem::Requirement
42
+ required_ruby_version: !ruby/object:Gem::Requirement
48
43
  none: false
49
- requirements:
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: "0"
53
- required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
49
  none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
58
53
  version: 1.3.6
59
54
  requirements: []
60
-
61
55
  rubyforge_project:
62
- rubygems_version: 1.5.0
56
+ rubygems_version: 1.8.10
63
57
  signing_key:
64
58
  specification_version: 3
65
59
  summary: Adds DRYML markers viewable with FireMarker
66
60
  test_files: []
67
-
61
+ has_rdoc: