hobo_support 1.3.3 → 1.4.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/hobo_support.gemspec +2 -1
- data/lib/generators/plugin/templates/README +27 -0
- data/lib/generators/plugin/templates/gitkeep +0 -0
- data/lib/generators/plugin/templates/helper.rb.erb +2 -0
- data/lib/generators/plugin/templates/javascript.js +1 -0
- data/lib/generators/plugin/templates/railtie.rb.erb +7 -0
- data/lib/generators/plugin/templates/stylesheet.css +3 -0
- data/lib/generators/plugin/templates/taglib.dryml +1 -0
- data/lib/hobo_support/command.rb +59 -4
- data/lib/hobo_support/common_tasks.rb +13 -7
- data/lib/hobo_support/fixes/module.rb +3 -17
- data/lib/hobo_support/methodcall.rb +19 -0
- data/test/hobosupport/chronic.rdoctest +1 -0
- metadata +58 -43
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4.0.pre2
|
data/hobo_support.gemspec
CHANGED
@@ -11,8 +11,9 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.summary = 'Core Ruby extensions from the Hobo project'
|
12
12
|
s.description = 'Core Ruby extensions from the Hobo project'
|
13
13
|
|
14
|
-
s.add_runtime_dependency('rails', ["~> 3.
|
14
|
+
s.add_runtime_dependency('rails', ["~> 3.1.0"])
|
15
15
|
s.add_development_dependency('rubydoctest', [">= 0"])
|
16
|
+
s.add_development_dependency('chronic', [">= 0"])
|
16
17
|
|
17
18
|
s.files = `git ls-files -x #{name}/* -z`.split("\0")
|
18
19
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
This is a plugin for [Hobo](http://hobocentral.net) that does lots of
|
2
|
+
cool stuff.
|
3
|
+
|
4
|
+
All text before the first heading is considered the "short description" of this plugin
|
5
|
+
|
6
|
+
### Installation
|
7
|
+
|
8
|
+
It can be installed into a Hobo app by typing:
|
9
|
+
|
10
|
+
hobo generate install_plugin <%= @filename %> git://github.com/my_github_username/<%= @filename %>.git
|
11
|
+
|
12
|
+
Although if this plugin is a theme, it's better to use:
|
13
|
+
|
14
|
+
hobo generate install_plugin <%= @filename %> git://github.com/my_github_username/<%= @filename %>.git --subsite=front --css-top
|
15
|
+
|
16
|
+
If you want it installed in a different subsite, replace "front" with the subsite name.
|
17
|
+
|
18
|
+
You'll have to manually remove references to any old themes from front_site.dryml, front.js & front.css.
|
19
|
+
|
20
|
+
The source for this plugin lives at git://github.com/my_github_username/<%= @filename %>. Pull requests are welcome.
|
21
|
+
|
22
|
+
Documentation for this plugin is in the DRYMLDoc. It will be visible on [the hobo cookbook](http://cookbook.hobocentral.net) once the author pushes it there. Until then it may be viewed directly in the source in the taglibs directly.
|
23
|
+
|
24
|
+
### License
|
25
|
+
|
26
|
+
See MIT-LICENSE
|
27
|
+
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require_tree .
|
@@ -0,0 +1 @@
|
|
1
|
+
<%%# tag definitions for the <%= @filename %> plugin %>
|
data/lib/hobo_support/command.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'tmpdir'
|
3
|
+
require 'rubygems'
|
4
|
+
require 'active_support/inflector'
|
3
5
|
|
4
6
|
module HoboSupport
|
5
7
|
module Command
|
@@ -19,7 +21,11 @@ Usage:
|
|
19
21
|
expect you pass other setup_wizard options
|
20
22
|
--skip-setup generate only the rails infrastructure and
|
21
23
|
expect you launch the setup_wizard manually
|
22
|
-
rails_opt: all the options accepted by the rails command
|
24
|
+
rails_opt: all the options accepted by the rails new command
|
25
|
+
|
26
|
+
hobo plugin <plugin_name> [opt] Creates a new Hobo Plugin
|
27
|
+
opt: all the options accepted by the rails plugin new command
|
28
|
+
|
23
29
|
)
|
24
30
|
|
25
31
|
hobofields_banner = %(
|
@@ -90,8 +96,13 @@ gem 'hobo_fields', :path => '#{dev_root}/hobo_fields'
|
|
90
96
|
)
|
91
97
|
if is_hobo
|
92
98
|
file.puts %(
|
93
|
-
gem 'dryml', :path => '#{dev_root}
|
94
|
-
gem 'hobo', :path => '#{dev_root}
|
99
|
+
gem 'dryml', :path => '#{dev_root}'
|
100
|
+
gem 'hobo', :path => '#{dev_root}'
|
101
|
+
gem 'hobo_rapid', :path => '#{dev_root}'
|
102
|
+
gem 'hobo_clean', :path => '#{dev_root}'
|
103
|
+
gem 'hobo_clean_admin', :path => '#{dev_root}'
|
104
|
+
gem 'hobo_jquery', :path => '#{dev_root}'
|
105
|
+
gem 'hobo_jquery_ui', :path => '#{dev_root}'
|
95
106
|
)
|
96
107
|
end
|
97
108
|
else
|
@@ -141,9 +152,53 @@ say "Please, remember to run `hobo g setup_wizard` from the application root dir
|
|
141
152
|
if ARGV.first =~ /^hobo:(\w+)$/
|
142
153
|
puts "NOTICE: You can omit the 'hobo' namespace: e.g. `hobo #{cmd} #{$1} #{ARGV[1..-1] * ' '}`"
|
143
154
|
end
|
144
|
-
system "rails #{cmd} hobo:#{ARGV * ' '}"
|
155
|
+
system "bundle exec rails #{cmd} hobo:#{ARGV * ' '}"
|
145
156
|
end
|
146
157
|
|
158
|
+
when /^plugin$/
|
159
|
+
if ARGV.empty?
|
160
|
+
puts "\nThe plugin name is missing!\n"
|
161
|
+
puts banner
|
162
|
+
return
|
163
|
+
end
|
164
|
+
plugin_name = ARGV.shift
|
165
|
+
template_path = File.join Dir.tmpdir, "hobo_plugin_template"
|
166
|
+
File.open(template_path, 'w') do |file|
|
167
|
+
source_path = File.expand_path('../../generators/plugin/templates', __FILE__)
|
168
|
+
file.puts %(
|
169
|
+
@filename = "#{plugin_name}"
|
170
|
+
@module_name = "#{plugin_name.camelize}"
|
171
|
+
gsub_file "#{plugin_name}.gemspec", /^ s.files = Dir.*?\\n/m, ''
|
172
|
+
gsub_file "#{plugin_name}.gemspec", /^ s.add_development_dependency "sqlite3".*?\\n/m, ''
|
173
|
+
inject_into_file "#{plugin_name}.gemspec", :before => /end\\s*$/m do
|
174
|
+
""" s.files = `git ls-files -z`.split('\\0')
|
175
|
+
s.add_runtime_dependency('hobo', ['~> #{version}'])
|
176
|
+
"""end
|
177
|
+
inject_into_file 'lib/#{plugin_name}.rb', :before => /end(?!.*end).*?$/m do """
|
178
|
+
@@root = Pathname.new File.expand_path('../..', __FILE__)
|
179
|
+
def self.root; @@root; end
|
180
|
+
|
181
|
+
EDIT_LINK_BASE = 'https://github.com/my_github_username/#{plugin_name}/edit/master'
|
182
|
+
|
183
|
+
if defined?(Rails)
|
184
|
+
require '#{plugin_name}/railtie'
|
185
|
+
|
186
|
+
class Engine < ::Rails::Engine
|
187
|
+
end
|
188
|
+
end
|
189
|
+
"""end
|
190
|
+
template '#{source_path}/railtie.rb.erb', "lib/#{plugin_name}/railtie.rb"
|
191
|
+
template '#{source_path}/taglib.dryml', "taglibs/#{plugin_name}.dryml"
|
192
|
+
template '#{source_path}/javascript.js', "vendor/assets/javascripts/#{plugin_name}.js"
|
193
|
+
template '#{source_path}/stylesheet.css', "vendor/assets/stylesheets/#{plugin_name}.css"
|
194
|
+
template '#{source_path}/gitkeep', "vendor/assets/images/.gitkeep"
|
195
|
+
template '#{source_path}/helper.rb.erb', "app/helpers/#{plugin_name}_helper.rb"
|
196
|
+
template '#{source_path}/README', "README.markdown"
|
197
|
+
remove_file 'README.rdoc'
|
198
|
+
)
|
199
|
+
end
|
200
|
+
system "rails plugin new #{plugin_name} #{ARGV * ' '} -m #{template_path}"
|
201
|
+
#File.delete template_path
|
147
202
|
else
|
148
203
|
puts "\n => '#{command}' is an unknown command!\n"
|
149
204
|
puts banner
|
@@ -4,19 +4,25 @@ module HoboSupport
|
|
4
4
|
CommonTasks = classy_module do
|
5
5
|
|
6
6
|
namespace :test do
|
7
|
-
desc "Run the irt tests"
|
8
|
-
task :irt => :prepare_testapp do |t|
|
9
|
-
chdir TESTAPP_PATH
|
10
|
-
sh %(irt #{File.expand_path('.',GEM_ROOT)})
|
11
|
-
end
|
12
7
|
|
13
8
|
desc "Prepare a rails application for testing"
|
14
9
|
task :prepare_testapp, :force do |t, args|
|
15
10
|
if args.force || !File.directory?(TESTAPP_PATH)
|
16
11
|
remove_entry_secure( TESTAPP_PATH, true )
|
17
|
-
sh %(#{BIN} new #{TESTAPP_PATH} --skip-wizard)
|
12
|
+
sh %(#{BIN} new #{TESTAPP_PATH} --skip-wizard --skip-bundle)
|
18
13
|
chdir TESTAPP_PATH
|
19
|
-
|
14
|
+
if ENV['HOBODEV']
|
15
|
+
rvmrc_path = File.join(ENV['HOBODEV'], '.rvmrc')
|
16
|
+
if File.exist?(rvmrc_path)
|
17
|
+
puts %(Copying .rvmrc file)
|
18
|
+
copy_file rvmrc_path, './.rvmrc'
|
19
|
+
sh %(rvm reload) do |ok|
|
20
|
+
puts 'rvm command skipped' unless ok
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
sh %(bundle install)
|
25
|
+
sh %(echo "gem 'irt', :group => :development" >> Gemfile) # to make the bundler happy
|
20
26
|
sh %(echo "" > app/models/.gitignore) # because git reset --hard would rm the dir
|
21
27
|
rm %(.gitignore) # we need to reset everything in a testapp
|
22
28
|
sh %(git init && git add . && git commit -m "initial commit")
|
@@ -16,22 +16,8 @@ class Module
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
#
|
21
|
-
|
22
|
-
options = methods.pop
|
23
|
-
unless options.is_a?(Hash) && to = options[:to]
|
24
|
-
raise ArgumentError, ("Delegation needs a target. Supply an options hash with a :to key" +
|
25
|
-
"as the last argument (e.g. delegate :hello, :to => :greeter).")
|
26
|
-
end
|
27
|
-
|
28
|
-
methods.each do |method|
|
29
|
-
module_eval(<<-EOS, "(__DELEGATION__)", 1)
|
30
|
-
def #{method}(*args, &block)
|
31
|
-
(_to = #{to}) && _to.__send__(#{method.inspect}, *args, &block)
|
32
|
-
end
|
33
|
-
EOS
|
34
|
-
end
|
35
|
-
end
|
19
|
+
# we used to have a delegate in here that didn't go bang if 'to' is
|
20
|
+
# nil. If you relied on it, use the new :allow_nil option with
|
21
|
+
# active_support's delegate
|
36
22
|
|
37
23
|
end
|
@@ -19,6 +19,25 @@ module HoboSupport
|
|
19
19
|
this.send(*args, &block)
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
if defined? Rails
|
24
|
+
class Railtie < Rails::Railtie
|
25
|
+
initializer 'hobo_support.insert_into_active_record' do
|
26
|
+
ActiveSupport.on_load(:active_record) do
|
27
|
+
# CollectionProxy undef's most of it's methods, so put these
|
28
|
+
# two back
|
29
|
+
ActiveRecord::Associations::CollectionProxy.class_eval do
|
30
|
+
def _?()
|
31
|
+
self
|
32
|
+
end
|
33
|
+
def try(*args, &block)
|
34
|
+
HoboSupport.hobo_try(self, *args, &block)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
22
41
|
end
|
23
42
|
|
24
43
|
class Object
|
metadata
CHANGED
@@ -1,54 +1,59 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: hobo_support
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: 6
|
5
|
+
version: 1.4.0.pre2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Tom Locke
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
|
13
|
+
date: 2012-03-28 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
15
16
|
name: rails
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 3.0.0
|
22
|
-
type: :runtime
|
23
17
|
prerelease: false
|
24
|
-
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
19
|
none: false
|
26
|
-
requirements:
|
20
|
+
requirements:
|
27
21
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 3.
|
30
|
-
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 3.1.0
|
24
|
+
type: :runtime
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
31
27
|
name: rubydoctest
|
32
|
-
|
28
|
+
prerelease: false
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
33
30
|
none: false
|
34
|
-
requirements:
|
35
|
-
- -
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version:
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: "0"
|
38
35
|
type: :development
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: chronic
|
39
39
|
prerelease: false
|
40
|
-
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version:
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id003
|
46
48
|
description: Core Ruby extensions from the Hobo project
|
47
49
|
email: tom@tomlocke.com
|
48
50
|
executables: []
|
51
|
+
|
49
52
|
extensions: []
|
53
|
+
|
50
54
|
extra_rdoc_files: []
|
51
|
-
|
55
|
+
|
56
|
+
files:
|
52
57
|
- CHANGES.txt
|
53
58
|
- README.txt
|
54
59
|
- Rakefile
|
@@ -57,6 +62,13 @@ files:
|
|
57
62
|
- lib/generators/hobo_support/eval_template.rb
|
58
63
|
- lib/generators/hobo_support/model.rb
|
59
64
|
- lib/generators/hobo_support/thor_shell.rb
|
65
|
+
- lib/generators/plugin/templates/README
|
66
|
+
- lib/generators/plugin/templates/gitkeep
|
67
|
+
- lib/generators/plugin/templates/helper.rb.erb
|
68
|
+
- lib/generators/plugin/templates/javascript.js
|
69
|
+
- lib/generators/plugin/templates/railtie.rb.erb
|
70
|
+
- lib/generators/plugin/templates/stylesheet.css
|
71
|
+
- lib/generators/plugin/templates/taglib.dryml
|
60
72
|
- lib/hobo_support.rb
|
61
73
|
- lib/hobo_support/array.rb
|
62
74
|
- lib/hobo_support/blankslate.rb
|
@@ -86,28 +98,31 @@ files:
|
|
86
98
|
- test/hobosupport/xss.rdoctest
|
87
99
|
homepage: http://hobocentral.net
|
88
100
|
licenses: []
|
101
|
+
|
89
102
|
post_install_message:
|
90
|
-
rdoc_options:
|
103
|
+
rdoc_options:
|
91
104
|
- --charset=UTF-8
|
92
|
-
require_paths:
|
105
|
+
require_paths:
|
93
106
|
- lib
|
94
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
108
|
none: false
|
96
|
-
requirements:
|
97
|
-
- -
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version:
|
100
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: "0"
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
114
|
none: false
|
102
|
-
requirements:
|
103
|
-
- -
|
104
|
-
- !ruby/object:Gem::Version
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
105
118
|
version: 1.3.6
|
106
119
|
requirements: []
|
120
|
+
|
107
121
|
rubyforge_project: hobo
|
108
|
-
rubygems_version: 1.8.
|
122
|
+
rubygems_version: 1.8.17
|
109
123
|
signing_key:
|
110
124
|
specification_version: 3
|
111
125
|
summary: Core Ruby extensions from the Hobo project
|
112
126
|
test_files: []
|
127
|
+
|
113
128
|
has_rdoc:
|