hobo 1.4.0.pre4 → 1.4.0.pre5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES-1.4.txt CHANGED
@@ -100,12 +100,20 @@ with
100
100
 
101
101
  <include gem='hobo_rapid'/>
102
102
  <include gem='hobo_jquery'/>
103
+ <include gem='hobo_jquery_ui'/>
103
104
  <include gem='hobo_clean'/>
104
105
 
105
106
  Note that the default Hobo generation now always creates both a
106
107
  front_site.dryml and an application.dryml, even if you don't create
107
108
  any subsites.
108
109
 
110
+ Also be aware that application.dryml is no longer loaded automatically
111
+ if you have a front_site.dryml. Add
112
+
113
+ <include src="application" />
114
+
115
+ to your front_site.dryml, your admin_site.dryml, et cetera.
116
+
109
117
  ### move public/ to app/assets/
110
118
 
111
119
  In Rails 3.1, images, javascripts and stylesheets are loaded from
@@ -144,7 +152,20 @@ these changes have been to the editors.
144
152
  Hobo 1.4 uses the asset pipeline features introduced in Rails 3.1.
145
153
  Hobo 1.4 does not work out of the box with the asset pipeline turned
146
154
  off. It'd certainly be possible to copy all Hobo assets into public/,
147
- but you would have to do that manually.
155
+ but you would have to do so manually, there are no longer any rake
156
+ tasks to do this for you.
157
+
158
+ ## application.dryml is no longer loaded automatically
159
+
160
+ Hobo 1.3 loaded application.dryml and then X_site.dryml, where X was
161
+ front or admin or the name of the current subsite. Hobo 1.4 only
162
+ loads X_site.dryml. If that fails, it loads application.dryml
163
+ instead.
164
+
165
+ A new application generated by Hobo 1.4 will have `<include
166
+ src="application"/>` in X_site.dryml so that application.dryml is
167
+ still loaded. When it is loaded is now controlled by the the author
168
+ rather than always loading first.
148
169
 
149
170
  ## :inverse_of recommended
150
171
 
data/TODO-1.4.txt CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## regressions
4
4
 
5
- * after-submit, sortable-input-many and name-many do not work
5
+ * after-submit, sortable-input-many do not work
6
6
  * Hobo 1.4 breaks default_scope. If you're setting the order, you
7
7
  can use Hobo's set_default_order as a stopgap although once it's
8
8
  fixed please switch back to default_scope as set_default_order
@@ -31,7 +31,6 @@
31
31
 
32
32
  ## Cookbook
33
33
 
34
- * captcha
35
34
  * search
36
35
  * actually use Hobo 1.4's new caching abilities
37
36
  * auto-link tags in manual
@@ -60,6 +59,7 @@ you notice any such omissions, please let us know, it is easy to fix..
60
59
  * trawl the lighthouse && pull requests
61
60
  * steal the tags from Portal
62
61
  * fixup hobo-contrib
62
+ * convert paperclip_with_hobo to gem
63
63
 
64
64
  ## would be nice:
65
65
 
@@ -67,3 +67,4 @@ you notice any such omissions, please let us know, it is easy to fix..
67
67
  * create a bootstrap theme
68
68
  * add theme chooser to setup wizard
69
69
  * add support for has-one
70
+ * convert old Hobo plugins: imaginary-dryml, hoboyui
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.0.pre4
1
+ 1.4.0.pre5
@@ -17,11 +17,11 @@ module Hobo
17
17
  template "users_index.dryml", "app/views/#{file_name}/#{options[:user_resource_name].pluralize.underscore}/index.dryml"
18
18
  end
19
19
 
20
+ include Generators::Hobo::Subsite
21
+
20
22
  def generate_site_taglib
21
23
  invoke 'hobo:subsite_taglib', [name], options.merge(:admin => true)
22
24
  end
23
25
 
24
- include Generators::Hobo::Subsite
25
-
26
26
  end
27
27
  end
@@ -1,3 +1,2 @@
1
- <!-- Global taglib - these tags are shared across all subsites -->
2
-
3
- <include src="rapid" gem="hobo"/>
1
+ <!-- this file is included by front_site.dryml, admin_site.dryml et al, so
2
+ you can place common code in this file. -->
@@ -1,4 +1,3 @@
1
- <!-- Global taglib - these tags are shared across all subsites -->
2
-
3
- <include src="rapid" gem="hobo"/>
1
+ <!-- this file is included by front_site.dryml, admin_site.dryml et al, so
2
+ you can place common code in this file. -->
4
3
 
@@ -1,6 +1,9 @@
1
- <!-- Global taglib - these are the tags for your front site -->
1
+ <!-- Global taglib - these are the tags for your front / main site -->
2
+
3
+ <include gem="hobo_rapid"/>
2
4
 
3
5
  <include src="taglibs/auto/rapid/cards"/>
4
6
  <include src="taglibs/auto/rapid/pages"/>
5
7
  <include src="taglibs/auto/rapid/forms"/>
6
8
 
9
+ <include src="application"/>
@@ -0,0 +1,3 @@
1
+ Description:
2
+
3
+ Installs the default set of Hobo plugins to a subsite. It is called from the wizard and subsite generators, it is not likely to be useful on its own.
@@ -0,0 +1,37 @@
1
+ require 'bundler/cli'
2
+ module Hobo
3
+ class InstallDefaultPluginsGenerator < Rails::Generators::Base
4
+
5
+ include Generators::Hobo::Plugin
6
+
7
+ class_option :subsite, :type => :string, :aliases => '-e', :required => true, :desc => "Subsite name (without '_site') or 'all'"
8
+ class_option :theme, :type => :string, :default => "hobo_clean", :desc => "the theme to install"
9
+ class_option :ui_theme, :type => :string, :default => "redmond", :desc => "the jquery-ui theme to require"
10
+ class_option :skip_gem, :type => :boolean, :desc => "add to Gemfile"
11
+
12
+ def install_default_plugins
13
+ opts = options.dup
14
+ opts[:version => Hobo::VERSION]
15
+ say "Installing default plugins for #{opts[:subsite]}..."
16
+ say "Installing hobo_rapid plugin..."
17
+ install_plugin_helper('hobo_rapid', nil, opts)
18
+ say "Installing hobo_jquery plugin..."
19
+ install_plugin_helper('hobo_jquery', nil, opts)
20
+ say "Installing hobo_jquery_ui plugin..."
21
+ install_plugin_helper('hobo_jquery_ui', nil, opts)
22
+
23
+ say "Installing #{opts[:theme]} theme..."
24
+ inject_css_require("jquery-ui/#{opts[:ui_theme]}", opts[:subsite], nil)
25
+ install_plugin_helper(opts[:theme], nil, opts)
26
+
27
+ unless opts[:skip_gem]
28
+ gem_with_comments("jquery-ui-themes", "~> 0.0.4")
29
+ Bundler.with_clean_env do
30
+ run "bundle install"
31
+ end
32
+ end
33
+
34
+ end
35
+ end
36
+ end
37
+
@@ -11,9 +11,6 @@ to get it. If the second argument is not supplied, it is installed
11
11
  from rubygems.org or any other gem source listed in your Gemfile. If
12
12
  the second argument contains a colon (:), it is assumed to be a git
13
13
  URL. Otherwise it is considered to be a path.
14
-
15
- If you are installing a Hobo theme, you probably want to use the options
16
- `--subsite=front --css-top`.
17
14
  """
18
15
 
19
16
  argument :name, :desc => "the plugin name"
@@ -23,12 +20,13 @@ If you are installing a Hobo theme, you probably want to use the options
23
20
  class_option :skip_css, :type => :boolean, :aliases => '-C', :desc => "doesn't add require to application.css"
24
21
  class_option :version, :type => :string, :aliases => '-v', :desc => "Gemspec version string"
25
22
  class_option :comments, :type => :string, :desc => "comments to add before require/include"
26
- class_option :subsite, :type => :string, :aliases => '-e', :default => "application", :desc => "Subsite name (without '_site') or 'all' or 'application'"
27
- class_option :css_top, :type => :boolean, :desc => "add the require statement to the top of the CSS file rather tahn the bottom."
23
+ class_option :subsite, :type => :string, :aliases => '-e', :default => "all", :desc => "Subsite name (without '_site') or 'all'"
28
24
 
29
25
  def install_plugin
30
26
  if install_plugin_helper(name, git_path, options)
31
- invoke(Bundler::CLI, :update, [], {})
27
+ Bundler.with_clean_env do
28
+ run "bundle install"
29
+ end
32
30
  end
33
31
  end
34
32
  end
@@ -34,19 +34,15 @@ module Generators
34
34
  need_update = gem_with_comments(plugin, options[:version], gem_options)
35
35
  end
36
36
 
37
- if options[:subsite] == "all"
38
- if Hobo.subsites.blank?
39
- subsites = ['application']
40
- else
41
- subsites = ['front'] + Hobo.subsites
42
- end
37
+ if options[:subsite].nil? || options[:subsite] == "all"
38
+ subsites = ['front'] + Hobo.subsites
43
39
  else
44
- subsites = [options[:subsite] || 'application']
40
+ subsites = [options[:subsite]]
45
41
  end
46
42
 
47
43
  subsites.each do |subsite|
48
44
  inject_js_require(name, subsite, options[:comments]) unless options[:skip_js]
49
- inject_css_require(name, subsite, options[:comments], options[:css_top]) unless options[:skip_css]
45
+ inject_css_require(name, subsite, options[:comments]) unless options[:skip_css]
50
46
  inject_dryml_include(name, subsite, options[:comments])
51
47
  end
52
48
 
@@ -71,13 +67,9 @@ module Generators
71
67
  end
72
68
  end
73
69
 
74
- def inject_css_require(name, subsite, comments, css_top)
70
+ def inject_css_require(name, subsite, comments)
75
71
  application_file = "app/assets/stylesheets/#{subsite}.css"
76
- if css_top
77
- opts = {:after => /^\/\*.*?\*=.*?\n /m}
78
- else
79
- opts = {:before => /\*=(?!.*\*=).*?$/m}
80
- end
72
+ opts = {:before => /\*=(?!.*\*=).*?$/m}
81
73
 
82
74
  raise Thor::Error, "Couldn't find #{subsite}.css!" unless exists?(application_file)
83
75
 
@@ -91,7 +83,7 @@ module Generators
91
83
  def inject_dryml_include(name, subsite, comments)
92
84
  subsite = "#{subsite}_site" unless subsite=="application"
93
85
  application_file = "app/views/taglibs/#{subsite}.dryml"
94
- pattern = /\<include.*?\>(?!.*\<include.*?\>).*?\n/m
86
+ pattern = /\<include gem=.*?\>(?!.*\<include gem=.*?\>).*?\n/m
95
87
 
96
88
  raise Thor::Error, "Couldn't find #{subsite}.dryml!" unless exists?(application_file)
97
89
 
@@ -150,6 +150,10 @@ EOI
150
150
  invoke 'hobo:front_controller', [front_controller_name], :user_resource_name => @user_resource_name, :invite_only => @invite_only
151
151
  end
152
152
 
153
+ def install_default_plugins
154
+ invoke 'hobo:install_default_plugins', [], {:subsite => 'front', :theme => 'hobo_clean', :ui_theme => 'redmond', :skip_gem => false}
155
+ end
156
+
153
157
  def admin_subsite
154
158
  if wizard?
155
159
  say_title 'Admin Subsite'
@@ -178,30 +182,6 @@ EOI
178
182
  end
179
183
  end
180
184
 
181
- def installing_plugins
182
- say "Installing hobo_rapid plugin..."
183
- install_plugin_helper('hobo_rapid', nil, :version => Hobo::VERSION)
184
- say "Installing hobo_jquery plugin..."
185
- install_plugin_helper('hobo_jquery', nil, :version => Hobo::VERSION)
186
- say "Installing hobo_jquery_ui plugin..."
187
- install_plugin_helper('hobo_jquery_ui', nil, :version => Hobo::VERSION)
188
-
189
- say "Installing hobo_clean theme..."
190
- inject_css_require("jquery-ui/redmond", "front", nil, true)
191
- inject_css_require("jquery-ui/flick", "admin", nil, true) if @add_admin_subsite
192
- if @add_admin_subsite
193
- install_plugin_helper('hobo_clean', nil, :version => Hobo::VERSION, :subsite => "front", :comments => "The default Hobo theme", :css_top => true)
194
- install_plugin_helper('hobo_clean_admin', nil, :version => Hobo::VERSION, :subsite => @admin_subsite_name, :css_top => true)
195
- else
196
- install_plugin_helper('hobo_clean', nil, :version => Hobo::VERSION, :comments => "The default Hobo theme", :subsite => "front", :css_top => true)
197
- end
198
-
199
- gem_with_comments("jquery-ui-themes", "~> 0.0.4")
200
- Bundler.with_clean_env do
201
- run "bundle install"
202
- end
203
- end
204
-
205
185
  def add_dev_tweaks
206
186
  invoke 'hobo:dev_tweaks'
207
187
  end
@@ -1,14 +1,6 @@
1
1
  require 'fileutils'
2
2
  require 'thor/parser/option'
3
3
 
4
- # we want the option :make_front_site required even if it is boolean
5
- # Thor does not allow it, so we patch it
6
- class Thor
7
- class Option
8
- def validate!; end
9
- end
10
- end
11
-
12
4
  module Generators
13
5
  module Hobo
14
6
  Subsite = classy_module do
@@ -16,31 +8,14 @@ module Generators
16
8
  include Generators::Hobo::InviteOnly
17
9
  include Generators::Hobo::Taglib
18
10
 
19
- class_option :make_front_site,
20
- :type => :boolean,
21
- :required => true,
22
- :desc => "Rename application.dryml to front_site.dryml"
23
-
24
11
  # check_class_collision :suffix => 'SiteController'
25
12
 
26
13
  def move_and_generate_files
27
- if options[:make_front_site]
28
- unless can_mv_application_to_front_site?
29
- say "Cannot rename application.dryml to #{file_name}_site.dryml"
30
- exit 1
31
- end
14
+ if can_mv_application_to_front_site?
32
15
  say "Renaming app/views/taglibs/application.dryml to app/views/taglibs/front_site.dryml" unless options[:quiet]
33
16
  unless options[:pretend]
34
17
  FileUtils.mv('app/views/taglibs/application.dryml', "app/views/taglibs/front_site.dryml")
35
18
  copy_file "application.dryml", 'app/views/taglibs/application.dryml'
36
-
37
- # remove lines from front_site.dryml that exist in both front_site.dryml & application.dryml
38
- front_site = File.readlines('app/views/taglibs/front_site.dryml') - File.readlines('app/views/taglibs/application.dryml').reject{|l| l.blank?}
39
- File.open('app/views/taglibs/front_site.dryml', 'wb') do |file|
40
- front_site.each do
41
- |line| file.write(line)
42
- end
43
- end
44
19
  end
45
20
  end
46
21
 
@@ -1 +1,2 @@
1
- <!-- Global taglib - these tags are shared across all subsites -->
1
+ <!-- this file is included by front_site.dryml, admin_site.dryml et al, so
2
+ you can place common code in this file. -->
@@ -10,6 +10,7 @@ module Hobo
10
10
 
11
11
  def generate_taglib
12
12
  template "taglib.dryml.erb", File.join('app/views/taglibs', "#{file_name}_site.dryml")
13
+ Rails::Generators.invoke('hobo:install_default_plugins', ["--subsite=#{file_name}", "--theme=hobo_clean_admin", "--ui_theme=flick", "--skip_gem"])
13
14
  end
14
15
 
15
16
  end
@@ -1,9 +1,13 @@
1
1
  <!-- Tag definitions for the <%= file_name %> subsite -->
2
2
 
3
+ <include gem="hobo_rapid"/>
4
+
3
5
  <include src="taglibs/auto/<%= file_name %>/rapid/cards"/>
4
6
  <include src="taglibs/auto/<%= file_name %>/rapid/pages"/>
5
7
  <include src="taglibs/auto/<%= file_name %>/rapid/forms"/>
6
8
 
9
+ <include src="application"/>
10
+
7
11
  <% if invite_only? -%>
8
12
 
9
13
  <extend tag="card" for="<%= options[:user_resource_name].camelcase %>">
@@ -747,9 +747,11 @@ module Hobo
747
747
 
748
748
  # --- Miscelaneous Actions --- #
749
749
 
750
+ # Hobo 1.3's name one uses params[:query], jQuery-UI's autocomplete
751
+ # uses params[:term] and jQuery Tokeninput uses params[:q]
750
752
  def hobo_completions(attribute, finder, options={})
751
753
  options = options.reverse_merge(:limit => 10, :query_scope => "#{attribute}_contains")
752
- options[:param] ||= params[:query].nil? ? :term : :query
754
+ options[:param] ||= [:term, :q, :query].find{|k| !params[k].nil?}
753
755
  finder = finder.limit(options[:limit]) unless finder.try.limit_value
754
756
 
755
757
  begin
@@ -763,7 +765,11 @@ module Hobo
763
765
  end
764
766
  end
765
767
  if request.xhr?
766
- render :json => items.map {|i| i.send(attribute)}
768
+ if options[:param] == :q
769
+ render :json => items.map {|i| {:id => "@#{i.send(i.class.primary_key)}", :name => i.send(attribute)}}
770
+ else
771
+ render :json => items.map {|i| i.send(attribute)}
772
+ end
767
773
  else
768
774
  render :text => "<ul>\n" + items.map {|i| "<li>#{i.send(attribute)}</li>\n"}.join + "</ul>"
769
775
  end
@@ -11,8 +11,10 @@ module ActiveRecord
11
11
  module SpawnMethods
12
12
  def merge_with_origin(r)
13
13
  merged = merge_without_origin(r)
14
- merged.origin ||= r.respond_to?(:origin) && r.origin
15
- merged.origin_attribute ||= r.respond_to?(:origin_attribute) && r.origin_attribute
14
+ # LH#1002: cannot call respond_to? because default_scope ends
15
+ # up calling merge and we end up with infinite recursion
16
+ merged.origin = r.origin rescue nil unless merged.instance_variable_defined?("@origin")
17
+ merged.origin_attribute = r.origin_attribute rescue nil unless merged.instance_variable_defined?("@origin_attribute")
16
18
  merged
17
19
  end
18
20
 
@@ -71,9 +71,9 @@ module Hobo
71
71
  # Due to the way that rails works, there's no good way to tell
72
72
  # the difference between an empty array and a params hash that
73
73
  # just isn't making any updates to the array. So we're
74
- # hacking this in: if you pash an empty string where an array
74
+ # hacking this in: if you pass an empty string where an array
75
75
  # is expected, we assume you wanted an empty array.
76
- []
76
+ array_or_hash.split(',')
77
77
  else
78
78
  array_or_hash
79
79
  end
@@ -91,7 +91,7 @@ module Hobo
91
91
 
92
92
  def finder_for_belongs_to(record, name)
93
93
  refl = record.class.reflections[name]
94
- conditions = ActiveRecord::Associations::BelongsToAssociation.new(record, refl).send(:conditions)
94
+ conditions = ActiveRecord::Associations::BelongsToAssociation.new(record, refl).reflection.send(:conditions)
95
95
  finder = refl.klass.scoped(:conditions => conditions)
96
96
  end
97
97
 
@@ -1,6 +1,4 @@
1
- tags = %(<!-- Tag definitions for the subs subsite -->
2
-
3
- <include src="taglibs/auto/subs/rapid/cards"/>
1
+ tags = %(<include src="taglibs/auto/subs/rapid/cards"/>
4
2
  <include src="taglibs/auto/subs/rapid/pages"/>
5
3
  <include src="taglibs/auto/subs/rapid/forms"/>
6
4
  )
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hobo
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 1.4.0.pre4
5
+ version: 1.4.0.pre5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tom Locke
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-03-28 00:00:00 Z
13
+ date: 2012-04-23 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: hobo_support
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - "="
22
22
  - !ruby/object:Gem::Version
23
- version: 1.4.0.pre4
23
+ version: 1.4.0.pre5
24
24
  type: :runtime
25
25
  version_requirements: *id001
26
26
  - !ruby/object:Gem::Dependency
@@ -31,7 +31,7 @@ dependencies:
31
31
  requirements:
32
32
  - - "="
33
33
  - !ruby/object:Gem::Version
34
- version: 1.4.0.pre4
34
+ version: 1.4.0.pre5
35
35
  type: :runtime
36
36
  version_requirements: *id002
37
37
  - !ruby/object:Gem::Dependency
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - "="
44
44
  - !ruby/object:Gem::Version
45
- version: 1.4.0.pre4
45
+ version: 1.4.0.pre5
46
46
  type: :runtime
47
47
  version_requirements: *id003
48
48
  - !ruby/object:Gem::Dependency
@@ -170,6 +170,8 @@ files:
170
170
  - lib/generators/hobo/i18n/templates/hobo.nb.yml
171
171
  - lib/generators/hobo/i18n/templates/hobo.pt-PT.yml
172
172
  - lib/generators/hobo/i18n/templates/hobo.ru.yml
173
+ - lib/generators/hobo/install_default_plugins/USAGE
174
+ - lib/generators/hobo/install_default_plugins/install_default_plugins_generator.rb
173
175
  - lib/generators/hobo/install_plugin/USAGE
174
176
  - lib/generators/hobo/install_plugin/install_plugin_generator.rb
175
177
  - lib/generators/hobo/invite_only.rb