jakewendt-simply_discussable 0.2.2

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.
data/README.rdoc ADDED
@@ -0,0 +1,59 @@
1
+ = SimplyDiscussable
2
+
3
+ A forum framework.
4
+
5
+ == ToDo
6
+
7
+ * Everything
8
+
9
+ == Required Gem Sources
10
+
11
+ gem sources -a http://rubygems.org
12
+ gem sources -a http://gems.github.com
13
+
14
+ == Required Gems
15
+
16
+ * {ruby_extension}[http://github.com/jakewendt/ruby_extension] - modifications, updates and patches for ruby.
17
+ * rails ~> 2
18
+ * ssl_requirement
19
+ * ryanb-acts-as-list
20
+ * RedCloth
21
+ * paperclip
22
+ * thoughtbot-factory_girl
23
+ * jakewendt-simply_helpful
24
+ * jakewendt-ruby_extension
25
+ * jakewendt-calnet_authenticated
26
+ * jakewendt-simply_authorized
27
+
28
+ == Installation and Usage
29
+
30
+ config.gem "jakewendt-simply_discussable",
31
+ :source => 'http://rubygems.org'
32
+
33
+ script/generate simply_discussable
34
+
35
+ User.find_create_and_update_by_uid('859908').deputize
36
+
37
+ == Testing (as an app)
38
+
39
+ rake db:migrate
40
+ rake db:fixtures:load
41
+ rake test
42
+ script/server
43
+
44
+ == Gemified with Jeweler
45
+
46
+ vi Rakefile
47
+ rake version:write
48
+
49
+ rake version:bump:patch
50
+ rake version:bump:minor
51
+ rake version:bump:major
52
+
53
+ rake gemspec
54
+
55
+ rake install
56
+ rake release
57
+
58
+
59
+ Copyright (c) 2010 [Jake Wendt], released under the MIT license
data/config/routes.rb ADDED
@@ -0,0 +1,4 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+
3
+
4
+ end
File without changes
@@ -0,0 +1,87 @@
1
+ class SimplyDiscussableGenerator < Rails::Generator::Base
2
+
3
+ def manifest
4
+ # See Rails::Generator::Commands::Create
5
+ # rails-2.3.10/lib/rails_generator/commands.rb
6
+ # for code methods for record (Manifest)
7
+ record do |m|
8
+ m.directory('config/autotest')
9
+ m.file('autotest_simply_discussable.rb', 'config/autotest/simply_discussable.rb')
10
+ m.directory('lib/tasks')
11
+ m.file('simply_discussable.rake', 'lib/tasks/simply_discussable.rake')
12
+
13
+ # File.open('Rakefile','a'){|f|
14
+ # f.puts <<-EOF
15
+ ## From `script/generate simply_discussable` ...
16
+ #require 'simply_discussable/test_tasks'
17
+ # EOF
18
+ # }
19
+ #
20
+ # File.open('.autotest','a'){|f|
21
+ # f.puts <<-EOF
22
+ ## From `script/generate simply_discussable` ...
23
+ #require 'simply_discussable/autotest'
24
+ # EOF
25
+ # }
26
+
27
+ # %w( create_documents
28
+ # add_attachments_document_to_document
29
+ # polymorphicize_document_owner
30
+ # ).each do |migration|
31
+ # m.migration_template "migrations/#{migration}.rb",
32
+ # 'db/migrate', :migration_file_name => migration
33
+ # end
34
+
35
+ m.directory('public/javascripts')
36
+ Dir["#{File.dirname(__FILE__)}/templates/javascripts/*js"].each{|file|
37
+ f = file.split('/').slice(-2,2).join('/')
38
+ m.file(f, "public/javascripts/#{File.basename(file)}")
39
+ }
40
+ m.directory('public/stylesheets')
41
+ Dir["#{File.dirname(__FILE__)}/templates/stylesheets/*css"].each{|file|
42
+ f = file.split('/').slice(-2,2).join('/')
43
+ m.file(f, "public/stylesheets/#{File.basename(file)}")
44
+ }
45
+ # m.directory('test/functional/simply_discussable')
46
+ # Dir["#{File.dirname(__FILE__)}/templates/functional/*rb"].each{|file|
47
+ # f = file.split('/').slice(-2,2).join('/')
48
+ # m.file(f, "test/functional/simply_discussable/#{File.basename(file)}")
49
+ # }
50
+ # m.directory('test/unit/simply_discussable')
51
+ # Dir["#{File.dirname(__FILE__)}/templates/unit/*rb"].each{|file|
52
+ # f = file.split('/').slice(-2,2).join('/')
53
+ # m.file(f, "test/unit/simply_discussable/#{File.basename(file)}")
54
+ # }
55
+ end
56
+ end
57
+
58
+ end
59
+ module Rails::Generator::Commands
60
+ class Create
61
+ def migration_template(relative_source,
62
+ relative_destination, template_options = {})
63
+ migration_directory relative_destination
64
+ migration_file_name = template_options[
65
+ :migration_file_name] || file_name
66
+ if migration_exists?(migration_file_name)
67
+ puts "Another migration is already named #{migration_file_name}: #{existing_migrations(migration_file_name).first}: Skipping"
68
+ else
69
+ template(relative_source, "#{relative_destination}/#{next_migration_string}_#{migration_file_name}.rb", template_options)
70
+ end
71
+ end
72
+ end # Create
73
+ class Base
74
+ protected
75
+ # the loop through migrations happens so fast
76
+ # that they all have the same timestamp which
77
+ # won't work when you actually try to migrate.
78
+ # All the timestamps MUST be unique.
79
+ def next_migration_string(padding = 3)
80
+ @s = (!@s.nil?)? @s.to_i + 1 : if ActiveRecord::Base.timestamped_migrations
81
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
82
+ else
83
+ "%.#{padding}d" % next_migration_number
84
+ end
85
+ end
86
+ end # Base
87
+ end
@@ -0,0 +1,2 @@
1
+ # From `script/generate simply_discussable` ...
2
+ require 'simply_discussable/autotest'
@@ -0,0 +1,5 @@
1
+ # From `script/generate simply_discussable` ...
2
+ unless Gem.source_index.find_name('jakewendt-simply_discussable').empty?
3
+ gem 'jakewendt-simply_discussable'
4
+ require 'simply_discussable/test_tasks'
5
+ end
@@ -0,0 +1 @@
1
+ require 'simply_discussable'
@@ -0,0 +1,42 @@
1
+ require 'active_record'
2
+ require 'active_support'
3
+ require 'ruby_extension'
4
+ require 'simply_helpful'
5
+ require 'simply_authorized'
6
+ #require 'calnet_authenticated'
7
+ require 'acts_as_list'
8
+ module SimplyDiscussable
9
+ # predefine namespace
10
+ end
11
+ #require 'documents/owner'
12
+
13
+ # This doesn't seem necessary
14
+ %w{models controllers}.each do |dir|
15
+ path = File.expand_path(File.join(File.dirname(__FILE__), '../app', dir))
16
+ ActiveSupport::Dependencies.autoload_paths << path
17
+ ActiveSupport::Dependencies.autoload_once_paths << path
18
+ end
19
+
20
+ require 'action_controller' # loads HTML
21
+ HTML::WhiteListSanitizer.allowed_attributes.merge(%w(
22
+ id class style
23
+ ))
24
+
25
+ if defined?(Rails) && Rails.env == 'test' && Rails.class_variable_defined?("@@configuration")
26
+ require 'active_support/test_case'
27
+ require 'factory_girl'
28
+ require 'simply_discussable/factories'
29
+ # else
30
+ # running a rake task
31
+ end
32
+
33
+ ActionController::Routing::Routes.add_configuration_file(
34
+ File.expand_path(
35
+ File.join(
36
+ File.dirname(__FILE__), '../config/routes.rb')))
37
+
38
+ ActionController::Base.view_paths <<
39
+ File.expand_path(
40
+ File.join(
41
+ File.dirname(__FILE__), '../app/views'))
42
+
@@ -0,0 +1,26 @@
1
+ class Autotest::Rails
2
+
3
+ #
4
+ # Need both the mapping and the extra files
5
+ #
6
+ def run_with_simply_discussable
7
+ add_exception %r%config/%
8
+ add_exception %r%versions/%
9
+ add_exception %r%\.git/%
10
+ self.extra_files << File.expand_path(File.join(
11
+ File.dirname(__FILE__),'/../../test/unit/discussable/'))
12
+
13
+ self.extra_files << File.expand_path(File.join(
14
+ File.dirname(__FILE__),'/../../test/functional/discussable/'))
15
+
16
+ add_mapping(
17
+ %r{^#{File.expand_path(File.join(File.dirname(__FILE__),'/../../test/'))}/(unit|functional)/discussable/.*_test\.rb$}
18
+ ) do |filename, _|
19
+ filename
20
+ end
21
+ run_without_simply_discussable
22
+ end
23
+ alias_method_chain :run, :simply_discussable
24
+
25
+
26
+ end
@@ -0,0 +1,4 @@
1
+ Factory.define :document do |f|
2
+ f.sequence(:title) { |n| "Title#{n}" }
3
+ # f.sequence(:document_file_name) { |n| "document_file_name#{n}" }
4
+ end
@@ -0,0 +1,12 @@
1
+ module Documents::Owner
2
+ def self.included(base)
3
+ base.extend(PrepMethod)
4
+ end
5
+ module PrepMethod
6
+ def document_owner(*args)
7
+ options = args.extract_options!
8
+ has_many :documents, :as => :owner
9
+ end
10
+ end
11
+ end
12
+ ActiveRecord::Base.send(:include,Documents::Owner)
@@ -0,0 +1 @@
1
+ Dir["#{File.dirname(__FILE__)}/../tasks/**/*.rake"].sort.each { |ext| load ext }
@@ -0,0 +1,38 @@
1
+ module SimplyDiscussable;end
2
+ namespace :test do
3
+ namespace :units do
4
+ Rake::TestTask.new(:simply_discussable => "db:test:prepare") do |t|
5
+ t.pattern = File.expand_path(File.join(
6
+ File.dirname(__FILE__),'/../../test/unit/discussable/*_test.rb'))
7
+ t.libs << "test"
8
+ t.verbose = true
9
+ end
10
+ end
11
+ namespace :functionals do
12
+ Rake::TestTask.new(:simply_discussable => "db:test:prepare") do |t|
13
+ t.pattern = File.expand_path(File.join(
14
+ File.dirname(__FILE__),'/../../test/functional/discussable/*_test.rb'))
15
+ t.libs << "test"
16
+ t.verbose = true
17
+ end
18
+ end
19
+ end
20
+ Rake::Task['test:functionals'].prerequisites.unshift(
21
+ "test:functionals:simply_discussable" )
22
+ Rake::Task['test:units'].prerequisites.unshift(
23
+ "test:units:simply_discussable" )
24
+
25
+ # I thought of possibly just including this file
26
+ # but that would make __FILE__ different.
27
+ # Hmmm
28
+
29
+ #
30
+ # used in simply_helpful's rake test:coverage to run gem's
31
+ # tests in the context of the application
32
+ #
33
+ @gem_test_dirs ||= []
34
+ @gem_test_dirs << File.expand_path(File.join(File.dirname(__FILE__),
35
+ '/../../test/unit/discussable/'))
36
+ @gem_test_dirs << File.expand_path(File.join(File.dirname(__FILE__),
37
+ '/../../test/functional/discussable/'))
38
+
@@ -0,0 +1,2 @@
1
+ # From `script/generate simply_authorized` ...
2
+ require 'simply_authorized/test_tasks'
@@ -0,0 +1,2 @@
1
+ # From `script/generate simply_helpful` ...
2
+ require 'simply_helpful/test_tasks'
@@ -0,0 +1,5 @@
1
+ # From `script/generate simply_sessions` ...
2
+ unless Gem.source_index.find_name('jakewendt-simply_sessions').empty?
3
+ gem 'jakewendt-simply_sessions'
4
+ require 'simply_sessions/test_tasks'
5
+ end
@@ -0,0 +1,16 @@
1
+ class ApplicationController < ActionController::Base
2
+
3
+ helper :all # include all helpers, all the time
4
+
5
+ # See ActionController::RequestForgeryProtection for details
6
+ protect_from_forgery
7
+
8
+ def redirections
9
+ @redirections ||= HashWithIndifferentAccess.new({
10
+ :not_be_user => {
11
+ :redirect_to => user_path(current_user)
12
+ }
13
+ })
14
+ end
15
+
16
+ end
@@ -0,0 +1,10 @@
1
+ class HomeController < ApplicationController
2
+
3
+ skip_before_filter :login_required
4
+
5
+ def show
6
+ render :text => "You are home.",
7
+ :layout => true
8
+ end
9
+
10
+ end
@@ -0,0 +1,3 @@
1
+ class User < ActiveRecord::Base
2
+ authorized
3
+ end
@@ -0,0 +1,23 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+ # map.root :controller => "pages", :action => "show", :path => [""]
3
+
4
+ # I need this route and I don't know why.
5
+ # I expected that including the authorized gem
6
+ # would have included it since I told it too?
7
+ # The photos gem doesn't seem to need it.
8
+ #
9
+ # map.resources :users, :only => [:destroy,:show,:index],
10
+ # :collection => { :menu => :get } do |user|
11
+ # user.resources :roles, :only => [:update,:destroy]
12
+ # end
13
+ #
14
+ # # MUST BE LAST OR WILL BLOCK ALL OTHER ROUTES!
15
+ # # catch all route to manage admin created pages.
16
+ # map.connect '*path', :controller => 'pages', :action => 'show'
17
+
18
+
19
+ map.resource :home, :only => :show
20
+ map.root :controller => :home, :action => :show
21
+
22
+
23
+ end
metadata ADDED
@@ -0,0 +1,200 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jakewendt-simply_discussable
3
+ version: !ruby/object:Gem::Version
4
+ hash: 19
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 2
10
+ version: 0.2.2
11
+ platform: ruby
12
+ authors:
13
+ - George 'Jake' Wendt
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-05-26 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rails
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 7
30
+ segments:
31
+ - 2
32
+ version: "2"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: jakewendt-simply_helpful
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: jakewendt-ruby_extension
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :runtime
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: jakewendt-rails_extension
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ type: :runtime
76
+ version_requirements: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ name: jakewendt-simply_authorized
79
+ prerelease: false
80
+ requirement: &id005 !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ type: :runtime
90
+ version_requirements: *id005
91
+ - !ruby/object:Gem::Dependency
92
+ name: chronic
93
+ prerelease: false
94
+ requirement: &id006 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ hash: 3
100
+ segments:
101
+ - 0
102
+ version: "0"
103
+ type: :runtime
104
+ version_requirements: *id006
105
+ - !ruby/object:Gem::Dependency
106
+ name: ssl_requirement
107
+ prerelease: false
108
+ requirement: &id007 !ruby/object:Gem::Requirement
109
+ none: false
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ hash: 3
114
+ segments:
115
+ - 0
116
+ version: "0"
117
+ type: :runtime
118
+ version_requirements: *id007
119
+ - !ruby/object:Gem::Dependency
120
+ name: ryanb-acts-as-list
121
+ prerelease: false
122
+ requirement: &id008 !ruby/object:Gem::Requirement
123
+ none: false
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ hash: 3
128
+ segments:
129
+ - 0
130
+ version: "0"
131
+ type: :runtime
132
+ version_requirements: *id008
133
+ description: longer description of your gem
134
+ email: github@jake.otherinbox.com
135
+ executables: []
136
+
137
+ extensions: []
138
+
139
+ extra_rdoc_files:
140
+ - README.rdoc
141
+ files:
142
+ - config/routes.rb
143
+ - generators/simply_discussable/USAGE
144
+ - generators/simply_discussable/simply_discussable_generator.rb
145
+ - generators/simply_discussable/templates/autotest_simply_discussable.rb
146
+ - generators/simply_discussable/templates/simply_discussable.rake
147
+ - lib/jakewendt-simply_discussable.rb
148
+ - lib/simply_discussable.rb
149
+ - lib/simply_discussable/autotest.rb
150
+ - lib/simply_discussable/factories.rb
151
+ - lib/simply_discussable/owner.rb
152
+ - lib/simply_discussable/tasks.rb
153
+ - lib/simply_discussable/test_tasks.rb
154
+ - lib/tasks/simply_authorized.rake
155
+ - lib/tasks/simply_helpful.rake
156
+ - lib/tasks/simply_sessions.rake
157
+ - README.rdoc
158
+ - test/app/controllers/application_controller.rb
159
+ - test/app/controllers/home_controller.rb
160
+ - test/app/models/user.rb
161
+ - test/config/routes.rb
162
+ has_rdoc: true
163
+ homepage: http://github.com/jakewendt/simply_discussable
164
+ licenses: []
165
+
166
+ post_install_message:
167
+ rdoc_options: []
168
+
169
+ require_paths:
170
+ - lib
171
+ required_ruby_version: !ruby/object:Gem::Requirement
172
+ none: false
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ hash: 3
177
+ segments:
178
+ - 0
179
+ version: "0"
180
+ required_rubygems_version: !ruby/object:Gem::Requirement
181
+ none: false
182
+ requirements:
183
+ - - ">="
184
+ - !ruby/object:Gem::Version
185
+ hash: 3
186
+ segments:
187
+ - 0
188
+ version: "0"
189
+ requirements: []
190
+
191
+ rubyforge_project:
192
+ rubygems_version: 1.6.2
193
+ signing_key:
194
+ specification_version: 3
195
+ summary: one-line summary of your gem
196
+ test_files:
197
+ - test/app/controllers/application_controller.rb
198
+ - test/app/controllers/home_controller.rb
199
+ - test/app/models/user.rb
200
+ - test/config/routes.rb