classy-inheritance 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,2 +1,4 @@
1
+ == 0.1.1 2008-05-30
2
+ * Fix: Merge when other conditionals are passed to the find_with method was incorrectly called without bang!
1
3
  == 0.1.0 2008-05-29
2
4
  * Initial release
data/config/hoe.rb CHANGED
@@ -67,7 +67,9 @@ $hoe = Hoe.new(GEM_NAME, VERS) do |p|
67
67
  end
68
68
 
69
69
  CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
70
- PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
70
+ #PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
71
+ PATH = RUBYFORGE_PROJECT
71
72
  $hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
72
- $hoe.rsync_args = '-av --delete --ignore-errors'
73
+ #$hoe.rsync_args = '-av --delete --ignore-errors'
74
+ $hoe.rsync_args = '-av --delete'
73
75
  $hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
@@ -32,7 +32,8 @@ module Stonean
32
32
  # Before save functionality to create/update the requisite object
33
33
  define_save_method(model_sym, options[:as])
34
34
 
35
- define_find_method(model_sym)
35
+ # Adds a find_with_<model_sym> class method
36
+ define_find_with_method(model_sym)
36
37
 
37
38
 
38
39
  options[:attrs].each{|attr| define_accessors(model_sym, attr)}
@@ -61,7 +62,7 @@ module Stonean
61
62
  before_save "save_requisite_#{model_sym}".to_sym
62
63
  end
63
64
 
64
- def define_find_method(model_sym)
65
+ def define_find_with_method(model_sym)
65
66
  self.class.send :define_method, "find_with_#{model_sym}" do |*args|
66
67
  eval <<-CODE
67
68
  if args[1] && args[1].is_a?(Hash)
@@ -70,7 +71,7 @@ module Stonean
70
71
  new_val = inc_val.is_a?(Array) ? inc_val.push(:#{:model_sym}) : [inc_val, :#{model_sym}]
71
72
  args[1][:include] = new_val
72
73
  else
73
- args[1].merge({:include => :#{model_sym}})
74
+ args[1].merge!({:include => :#{model_sym}})
74
75
  end
75
76
  else
76
77
  args << {:include => :#{model_sym}}
@@ -101,7 +102,6 @@ module Stonean
101
102
  { :foreign_key => "#{polymorphic_name}_id",
102
103
  :conditions => "#{polymorphic_name}_type = '#{self.name}'"}
103
104
  end
104
-
105
105
  end # ClassMethods
106
106
  end # ClassyInheritance module
107
107
  end # Stonean module
@@ -2,7 +2,7 @@ module ClassyInheritance #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/script/txt2html CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  GEM_NAME = 'classy-inheritance' # what ppl will type to install your gem
4
- RUBYFORGE_PROJECT = 'classy-inheritance'
4
+ RUBYFORGE_PROJECT = 'classyinherit'
5
5
 
6
6
  require 'rubygems'
7
7
  begin
data/website/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
6
6
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
7
  <title>
8
- classy inheritance
8
+ Classy Inheritance
9
9
  </title>
10
10
  <script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
11
11
  <style>
@@ -30,112 +30,100 @@
30
30
  <body>
31
31
  <div id="main">
32
32
 
33
- <h1>classy inheritance</h1>
34
- <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/classy-inheritance"; return false'>
33
+ <h1>Classy Inheritance</h1>
34
+ <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/classyinherit"; return false'>
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/classy-inheritance" class="numbers">0.1.0</a>
36
+ <a href="http://rubyforge.org/projects/classyinherit" class="numbers">0.1.1</a>
37
37
  </div>
38
- <h1>&#x2192; &#8216;classy-inheritance&#8217;</h1>
38
+ <p><i>&#8220;You stay classy, inheritance&#8221; &#8211; Gibson</i></p>
39
39
 
40
40
 
41
41
  <h2>What</h2>
42
42
 
43
43
 
44
- <h2>Installing</h2>
45
-
46
-
47
- <p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">classy</span><span class="punct">-</span><span class="ident">inheritance</span></pre></p>
48
-
49
-
50
- <h2>The basics</h2>
51
-
52
-
53
- <h2>Demonstration of usage</h2>
54
-
55
-
56
- <h2>Forum</h2>
57
-
58
-
59
- <p><a href="http://groups.google.com/group/classy-inheritance">http://groups.google.com/group/classy-inheritance</a></p>
60
-
61
-
62
- <p><span class="caps">TODO</span> &#8211; create Google Group &#8211; classy-inheritance</p>
63
-
44
+ <p>For now, Classy Inheritance adds a depends_on class method to your ActiveRecord model so that you can define requisite objects.
45
+ More functionality coming for optional relationships.</p>
64
46
 
65
- <h2>How to submit patches</h2>
66
-
67
-
68
- <p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people&#8217;s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
69
47
 
48
+ You can define the relationship to be polymorphic:
49
+ <pre>
50
+ class Picture &lt; ActiveRecord::Base
51
+ depends_on :image, :attrs =&gt; [:filename, :height, :width], :as =&gt; "imageable"
52
+ end
53
+ </pre>
70
54
 
71
- <p><span class="caps">TODO</span> &#8211; pick <span class="caps">SVN</span> or Git instructions</p>
55
+ <p>This will look for &#8220;imageable_type&#8221; and &#8220;imageable_id&#8221; on the images table add set them accordingly.</p>
72
56
 
73
57
 
74
- <p>The trunk repository is <code>svn://rubyforge.org/var/svn/classy-inheritance/trunk</code> for anonymous access.</p>
58
+ Or you can define a standard belongs_to relationship:
59
+ <pre>
60
+ class User &lt; ActiveRecord::Base
61
+ depends_on :profile, :attrs =&gt; [:first_name, :last_name, :email]
62
+ end
63
+ </pre>
75
64
 
65
+ <h3>What does it do for me?</h3>
76
66
 
77
- <p><span class="caps">OOOORRRR</span></p>
78
67
 
68
+ <p>Well, for starters you get pass-through methods added to your model. So, in the above User example you would get the following:</p>
79
69
 
80
- <p>You can fetch the source from either:</p>
81
70
 
71
+ <pre>
72
+ @user.first_name
73
+ @user.last_name
74
+ @user.email
75
+ @user.first_name=
76
+ @user.last_name=
77
+ @user.email=
78
+ </pre>
82
79
 
83
- <ul>
84
- <li>rubyforge: <span class="caps">MISSING IN ACTION</span></li>
85
- </ul>
80
+ <p>This means you can use these attributes on your form and in your controller instead of having to worry about creating/updating a separate Profile model.</p>
86
81
 
87
82
 
88
- <p><span class="caps">TODO</span> &#8211; You can not created a RubyForge project, OR have not run <code>rubyforge config</code>
89
- yet to refresh your local rubyforge data with this projects&#8217; id information.</p>
83
+ <p>For the above example, you&#8217;ll also get a &#8220;find_with_profile&#8221; class method that will do the :include =&gt; :profile addition to your find call for you.</p>
90
84
 
91
85
 
92
- <p>When you do this, this message will magically disappear!</p>
93
-
94
-
95
- <p>Or you can hack website/index.txt and make it all go away!!</p>
86
+ <h2>Installing</h2>
96
87
 
97
88
 
98
- <ul>
99
- <li>github: <a href="http://github.com/GITHUB_USERNAME/classy-inheritance/tree/master">http://github.com/GITHUB_USERNAME/classy-inheritance/tree/master</a></li>
100
- </ul>
89
+ <pre>
90
+ $ sudo gem install classy-inheritance
101
91
 
92
+ # in environment.rb add:
93
+ require "classy-inheritance"
102
94
 
103
- <pre>git clone git://github.com/GITHUB_USERNAME/classy-inheritance.git</pre>
95
+ </pre>
104
96
 
105
- <p><span class="caps">TODO</span> &#8211; add &#8220;github_username: username&#8221; to ~/.rubyforge/user-config.yml and newgem will reuse it for future projects.</p>
97
+ <h2>How to submit patches</h2>
106
98
 
107
99
 
108
- <ul>
109
- <li>gitorious: <a href="git://gitorious.org/classy-inheritance/mainline.git">git://gitorious.org/classy-inheritance/mainline.git</a></li>
110
- </ul>
100
+ <p>The Clone <span class="caps">URL</span>: git://github.com/stonean/classy-inheritance.git</p>
111
101
 
112
102
 
113
- <pre>git clone git://gitorious.org/classy-inheritance/mainline.git</pre>
103
+ <p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people&#8217;s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
114
104
 
115
- <h3>Build and test instructions</h3>
116
105
 
106
+ <p>I&#8217;m new to git and this whole opensource project admin gig, so please be patient with my stumbling around.</p>
117
107
 
118
- <pre>cd classy-inheritance
119
- rake test
120
- rake install_gem</pre>
121
108
 
122
109
  <h2>License</h2>
123
110
 
124
111
 
125
112
  <p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
126
-
127
-
128
- <h2>Contact</h2>
129
-
130
-
131
- <p>Comments are welcome. Send an email to <a href="mailto:FIXME"><span class="caps">FIXME</span> full name</a> email via the <a href="http://groups.google.com/group/classy-inheritance">forum</a></p>
132
113
  <p class="coda">
133
- <a href="FIXME email">FIXME full name</a>, 29th May 2008<br>
114
+ <a href="http://blog.stonean.com">Andrew Stone</a>, 29th May 2008<br>
134
115
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
135
116
  </p>
136
117
  </div>
137
-
138
- <!-- insert site tracking codes here, like Google Urchin -->
118
+ <script type="text/javascript">
119
+ var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
120
+ document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
121
+ </script>
122
+ <script type="text/javascript">
123
+ var pageTracker = _gat._getTracker("UA-4555592-1");
124
+ pageTracker._initData();
125
+ pageTracker._trackPageview();
126
+ </script>
139
127
 
140
128
  </body>
141
129
  </html>
data/website/index.txt CHANGED
@@ -1,83 +1,63 @@
1
- h1. classy inheritance
2
-
3
- h1. &#x2192; 'classy-inheritance'
1
+ h1. <a href="http://lockdown.rubyforge.org">Classy Inheritance</a>
4
2
 
3
+ <i>"You stay classy, inheritance" - Gibson</i>
5
4
 
6
5
  h2. What
7
6
 
7
+ For now, Classy Inheritance adds a depends_on class method to your ActiveRecord model so that you can define requisite objects.
8
+ More functionality coming for optional relationships.
8
9
 
9
- h2. Installing
10
-
11
- <pre syntax="ruby">sudo gem install classy-inheritance</pre>
12
-
13
- h2. The basics
14
-
15
-
16
- h2. Demonstration of usage
17
-
18
-
19
-
20
- h2. Forum
21
-
22
- "http://groups.google.com/group/classy-inheritance":http://groups.google.com/group/classy-inheritance
23
-
24
- TODO - create Google Group - classy-inheritance
25
-
26
- h2. How to submit patches
27
-
28
- Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/ and for section "8b: Submit patch to Google Groups":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups, use the Google Group above.
10
+ You can define the relationship to be polymorphic:
11
+ <pre>
12
+ class Picture < ActiveRecord::Base
13
+ depends_on :image, :attrs => [:filename, :height, :width], :as => "imageable"
14
+ end
15
+ </pre>
29
16
 
30
- TODO - pick SVN or Git instructions
17
+ This will look for "imageable_type" and "imageable_id" on the images table add set them accordingly.
31
18
 
32
- The trunk repository is <code>svn://rubyforge.org/var/svn/classy-inheritance/trunk</code> for anonymous access.
19
+ Or you can define a standard belongs_to relationship:
20
+ <pre>
21
+ class User < ActiveRecord::Base
22
+ depends_on :profile, :attrs => [:first_name, :last_name, :email]
23
+ end
24
+ </pre>
33
25
 
34
- OOOORRRR
26
+ h3. What does it do for me?
35
27
 
36
- You can fetch the source from either:
28
+ Well, for starters you get pass-through methods added to your model. So, in the above User example you would get the following:
37
29
 
38
- <% if rubyforge_project_id %>
30
+ <pre>
31
+ @user.first_name
32
+ @user.last_name
33
+ @user.email
34
+ @user.first_name=
35
+ @user.last_name=
36
+ @user.email=
37
+ </pre>
39
38
 
40
- * rubyforge: "http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>":http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>
39
+ This means you can use these attributes on your form and in your controller instead of having to worry about creating/updating a separate Profile model.
41
40
 
42
- <pre>git clone git://rubyforge.org/classy-inheritance.git</pre>
43
-
44
- <% else %>
45
-
46
- * rubyforge: MISSING IN ACTION
47
-
48
- TODO - You can not created a RubyForge project, OR have not run <code>rubyforge config</code>
49
- yet to refresh your local rubyforge data with this projects' id information.
50
-
51
- When you do this, this message will magically disappear!
52
-
53
- Or you can hack website/index.txt and make it all go away!!
54
-
55
- <% end %>
56
-
57
- * github: "http://github.com/GITHUB_USERNAME/classy-inheritance/tree/master":http://github.com/GITHUB_USERNAME/classy-inheritance/tree/master
58
-
59
- <pre>git clone git://github.com/GITHUB_USERNAME/classy-inheritance.git</pre>
41
+ For the above example, you'll also get a "find_with_profile" class method that will do the :include => :profile addition to your find call for you.
60
42
 
43
+ h2. Installing
61
44
 
62
- TODO - add "github_username: username" to ~/.rubyforge/user-config.yml and newgem will reuse it for future projects.
45
+ <pre>
46
+ $ sudo gem install classy-inheritance
63
47
 
48
+ # in environment.rb add:
49
+ require "classy-inheritance"
64
50
 
65
- * gitorious: "git://gitorious.org/classy-inheritance/mainline.git":git://gitorious.org/classy-inheritance/mainline.git
51
+ </pre>
66
52
 
67
- <pre>git clone git://gitorious.org/classy-inheritance/mainline.git</pre>
53
+ h2. How to submit patches
68
54
 
69
- h3. Build and test instructions
55
+ The Clone URL: git://github.com/stonean/classy-inheritance.git
70
56
 
71
- <pre>cd classy-inheritance
72
- rake test
73
- rake install_gem</pre>
57
+ Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/ and for section "8b: Submit patch to Google Groups":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups, use the Google Group above.
74
58
 
59
+ I'm new to git and this whole opensource project admin gig, so please be patient with my stumbling around.
75
60
 
76
61
  h2. License
77
62
 
78
- This code is free to use under the terms of the MIT license.
79
-
80
- h2. Contact
81
-
82
- Comments are welcome. Send an email to "FIXME full name":mailto:FIXME email via the "forum":http://groups.google.com/group/classy-inheritance
83
-
63
+ This code is free to use under the terms of the MIT license.
@@ -37,12 +37,19 @@
37
37
  </div>
38
38
  <%= body %>
39
39
  <p class="coda">
40
- <a href="FIXME email">FIXME full name</a>, <%= modified.pretty %><br>
40
+ <a href="http://blog.stonean.com">Andrew Stone</a>, <%= modified.pretty %><br>
41
41
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
42
42
  </p>
43
43
  </div>
44
-
45
- <!-- insert site tracking codes here, like Google Urchin -->
44
+ <script type="text/javascript">
45
+ var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
46
+ document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
47
+ </script>
48
+ <script type="text/javascript">
49
+ var pageTracker = _gat._getTracker("UA-4555592-1");
50
+ pageTracker._initData();
51
+ pageTracker._trackPageview();
52
+ </script>
46
53
 
47
54
  </body>
48
55
  </html>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: classy-inheritance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Stone
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-05-29 00:00:00 -04:00
12
+ date: 2008-05-30 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15