pod_legal 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/.gitignore +7 -0
  2. data/.rspec +1 -0
  3. data/.rvmrc +25 -0
  4. data/.travis.yml +8 -0
  5. data/GNU-AGPL-3.0 +662 -0
  6. data/Gemfile +20 -0
  7. data/README.md +28 -0
  8. data/Rakefile +32 -0
  9. data/app/controllers/pod_legal/application_controller.rb +20 -0
  10. data/app/controllers/pod_legal/legal_controller.rb +25 -0
  11. data/app/helpers/pod_legal/application_helper.rb +22 -0
  12. data/app/overrides/pod_legal.rb +20 -0
  13. data/config/routes.rb +20 -0
  14. data/lib/generators/pod_legal/install_generator.rb +34 -0
  15. data/lib/generators/templates/privacy.html.haml +2 -0
  16. data/lib/generators/templates/terms.html.haml +2 -0
  17. data/lib/pod_legal.rb +20 -0
  18. data/lib/pod_legal/engine.rb +28 -0
  19. data/lib/pod_legal/version.rb +19 -0
  20. data/lib/tasks/pod_legal_tasks.rake +4 -0
  21. data/pod_legal.gemspec +45 -0
  22. data/script/rails +6 -0
  23. data/spec/dummy/Rakefile +7 -0
  24. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  25. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  26. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  27. data/spec/dummy/app/controllers/home_controller.rb +5 -0
  28. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  29. data/spec/dummy/app/helpers/home_helper.rb +2 -0
  30. data/spec/dummy/app/mailers/.gitkeep +0 -0
  31. data/spec/dummy/app/models/.gitkeep +0 -0
  32. data/spec/dummy/app/views/home/index.html.haml +2 -0
  33. data/spec/dummy/app/views/layouts/application.html.haml +12 -0
  34. data/spec/dummy/app/views/pod_legal/legal/privacy.html.haml +2 -0
  35. data/spec/dummy/app/views/pod_legal/legal/terms.html.haml +2 -0
  36. data/spec/dummy/config.ru +4 -0
  37. data/spec/dummy/config/application.rb +50 -0
  38. data/spec/dummy/config/boot.rb +11 -0
  39. data/spec/dummy/config/database.yml +25 -0
  40. data/spec/dummy/config/environment.rb +5 -0
  41. data/spec/dummy/config/environments/development.rb +30 -0
  42. data/spec/dummy/config/environments/production.rb +60 -0
  43. data/spec/dummy/config/environments/test.rb +39 -0
  44. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  45. data/spec/dummy/config/initializers/inflections.rb +10 -0
  46. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  47. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  48. data/spec/dummy/config/initializers/session_store.rb +8 -0
  49. data/spec/dummy/config/initializers/wrap_parameters.rb +15 -0
  50. data/spec/dummy/config/locales/en.yml +6 -0
  51. data/spec/dummy/config/routes.rb +5 -0
  52. data/spec/dummy/lib/assets/.gitkeep +0 -0
  53. data/spec/dummy/log/.gitkeep +0 -0
  54. data/spec/dummy/public/404.html +26 -0
  55. data/spec/dummy/public/422.html +26 -0
  56. data/spec/dummy/public/500.html +26 -0
  57. data/spec/dummy/public/favicon.ico +0 -0
  58. data/spec/dummy/script/rails +6 -0
  59. data/spec/requests/links_spec.rb +28 -0
  60. data/spec/spec_helper.rb +15 -0
  61. metadata +179 -0
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Declare your gem's dependencies in pod_legal.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
7
+
8
+ # Match the main project's Rails version
9
+ gem 'rails', '3.2.2'
10
+
11
+ # jquery-rails is used by the dummy application
12
+ gem 'jquery-rails'
13
+
14
+ # Declare any dependencies that are still in development here instead of in
15
+ # your gemspec. These might include edge Rails or gems from your path or
16
+ # Git. Remember to move these dependencies to your gemspec before releasing
17
+ # your gem to rubygems.org.
18
+
19
+ # To use debugger
20
+ # gem 'ruby-debug19', :require => 'ruby-debug'
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # PodLegal
2
+
3
+ [![Build Status](https://secure.travis-ci.org/stevenh512/pod_legal.png)](http://travis-ci.org/stevenh512/pod_legal)
4
+
5
+ Display links to "Terms and Conditions" and "Privacy Policy" in the footer of your Diaspora pod's layout.
6
+
7
+ This gem does not force any particular terms or privacy policy on you. Instead, it generates two HAML views that you can edit as needed.
8
+
9
+ This is meant to be a proof of concept, but should work for you as long as Travis says the tests are green. :grin:
10
+
11
+ ## Installation
12
+
13
+ Add the following line to your `Gemfile`
14
+
15
+ ```
16
+ gem 'deface', :git => 'git://github.com/railsdog/deface.git', :branch => 'dsl'
17
+ gem 'pod_legal', :git => 'git://github.com/stevenh512/pod_legal.git'
18
+ ```
19
+
20
+ We need the `dsl` branch of Deface for now, it includes fixes to the HAML converter that haven't been released to RubyGems yet.
21
+
22
+ Run `bundle install` and `rails generate pod_legal:install` from the root of your Diaspora pod to generate the default (blank) templates and routes. Note that you can run this command as many times as you need to, it will **not** overwrite your custom templates once you've edited them.
23
+
24
+ ## Copyright
25
+
26
+ Copyright 2012 Steven Hancock, licensed under GNU [AGPL][] v3 or (at your option) any later version.
27
+
28
+ [AGPL]: https://raw.github.com/stevenh512/pod_legal/master/GNU-AGPL-3.0
data/Rakefile ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ require 'rspec/core/rake_task'
16
+ RSpec::Core::RakeTask.new(:spec)
17
+ task :default => :spec
18
+
19
+ RDoc::Task.new(:rdoc) do |rdoc|
20
+ rdoc.rdoc_dir = 'rdoc'
21
+ rdoc.title = 'PodLegal'
22
+ rdoc.options << '--line-numbers'
23
+ rdoc.rdoc_files.include('README.rdoc')
24
+ rdoc.rdoc_files.include('lib/**/*.rb')
25
+ end
26
+
27
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
28
+ load 'rails/tasks/engine.rake'
29
+
30
+
31
+ Bundler::GemHelper.install_tasks
32
+
@@ -0,0 +1,20 @@
1
+ # PodLegal
2
+ # Copyright (C) 2012 Steven Hancock
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU Affero General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ module PodLegal
18
+ class ApplicationController < ::ApplicationController
19
+ end
20
+ end
@@ -0,0 +1,25 @@
1
+ # PodLegal
2
+ # Copyright (C) 2012 Steven Hancock
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU Affero General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ module PodLegal
18
+ class LegalController < ApplicationController
19
+ def terms
20
+ end
21
+
22
+ def privacy
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,22 @@
1
+ # PodLegal
2
+ # Copyright (C) 2012 Steven Hancock
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU Affero General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ module PodLegal
18
+ module ApplicationHelper
19
+ # Give us access to the main_app routes without having to modify the app's views
20
+ include Rails.application.routes.url_helpers
21
+ end
22
+ end
@@ -0,0 +1,20 @@
1
+ # PodLegal
2
+ # Copyright (C) 2012 Steven Hancock
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU Affero General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ Deface::Override.new(:name => 'pod_legal_links',
18
+ :virtual_path => 'layouts/application',
19
+ :insert_top => 'ul#footer_nav',
20
+ :haml => "%li= link_to t('terms_and_conditions'), pod_legal.terms_path\n%li= link_to t('privacy_policy'), pod_legal.privacy_path")
data/config/routes.rb ADDED
@@ -0,0 +1,20 @@
1
+ # PodLegal
2
+ # Copyright (C) 2012 Steven Hancock
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU Affero General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ PodLegal::Engine.routes.draw do
18
+ match 'terms', :to => 'legal#terms'
19
+ match 'privacy', :to => 'legal#privacy'
20
+ end
@@ -0,0 +1,34 @@
1
+ # PodLegal
2
+ # Copyright (C) 2012 Steven Hancock
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU Affero General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ module PodLegal
18
+ module Generators
19
+ class InstallGenerator < Rails::Generators::Base
20
+ source_root File.expand_path("../../templates", __FILE__)
21
+
22
+ desc "Installs PodLegal's routes and view templates."
23
+
24
+ def add_routes
25
+ route "mount PodLegal::Engine => '/legal'"
26
+ end
27
+
28
+ def copy_views
29
+ copy_file "terms.html.haml", "app/views/pod_legal/legal/terms.html.haml", :skip => true
30
+ copy_file "privacy.html.haml", "app/views/pod_legal/legal/privacy.html.haml", :skip => true
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,2 @@
1
+ %h1 Legal#privacy
2
+ %p Find me in app/views/pod_legal/legal/privacy.html.haml
@@ -0,0 +1,2 @@
1
+ %h1 Legal#terms
2
+ %p Find me in app/views/pod_legal/legal/terms.html.haml
data/lib/pod_legal.rb ADDED
@@ -0,0 +1,20 @@
1
+ # PodLegal
2
+ # Copyright (C) 2012 Steven Hancock
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU Affero General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ require "pod_legal/engine"
18
+
19
+ module PodLegal
20
+ end
@@ -0,0 +1,28 @@
1
+ # PodLegal
2
+ # Copyright (C) 2012 Steven Hancock
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU Affero General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ require 'deface'
18
+
19
+ module PodLegal
20
+ class Engine < Rails::Engine
21
+ isolate_namespace PodLegal
22
+
23
+ initializer 'pod_legal.enable_deface' do
24
+ Rails.application.config.deface.enabled = true
25
+ end
26
+ end
27
+ end
28
+
@@ -0,0 +1,19 @@
1
+ # PodLegal
2
+ # Copyright (C) 2012 Steven Hancock
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU Affero General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ module PodLegal
18
+ VERSION = "0.0.1"
19
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :pod_legal do
3
+ # # Task goes here
4
+ # end
data/pod_legal.gemspec ADDED
@@ -0,0 +1,45 @@
1
+ # PodLegal
2
+ # Copyright (C) 2012 Steven Hancock
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU Affero General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU Affero General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Affero General Public License
15
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+
17
+ $:.push File.expand_path("../lib", __FILE__)
18
+
19
+ # Maintain your gem's version:
20
+ require "pod_legal/version"
21
+
22
+ # Describe your gem and declare its dependencies:
23
+ Gem::Specification.new do |s|
24
+ s.name = "pod_legal"
25
+ s.version = PodLegal::VERSION
26
+ s.authors = ["Steven Hancock"]
27
+ s.email = ["stevenh512@gmail.com"]
28
+ s.homepage = "https://github.com/stevenh512/pod_legal"
29
+ s.summary = "Add Terms of Service and Privacy Policy to your Diaspora pod."
30
+ s.description = "Add Terms of Service and Privacy Policy to your Diaspora pod."
31
+
32
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
33
+ s.files = `git ls-files`.split("\n")
34
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
35
+
36
+ s.require_paths = ["lib"]
37
+
38
+ s.add_dependency "railties", "~> 3.1"
39
+ s.add_dependency "deface", "~> 0.9.0"
40
+
41
+ s.add_development_dependency "haml-rails"
42
+ s.add_development_dependency "capybara"
43
+ s.add_development_dependency "rspec-rails"
44
+ s.add_development_dependency "sqlite3"
45
+ end
data/script/rails ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ #!/usr/bin/env ruby
3
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
4
+
5
+ ENGINE_PATH = File.expand_path('../..', __FILE__)
6
+ load File.expand_path('../../spec/dummy/script/rails', __FILE__)
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,9 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require jquery
8
+ //= require jquery_ujs
9
+ //= require_tree .
@@ -0,0 +1,7 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *= require_self
6
+ *= require_tree .
7
+ */
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,5 @@
1
+ class HomeController < ApplicationController
2
+ def index
3
+ end
4
+
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module HomeHelper
2
+ end
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ %h1 Home#index
2
+ %p Find me in app/views/home/index.html.haml
@@ -0,0 +1,12 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{:charset => 'utf-8'}
5
+ -# The following line breaks Deface v 0.8.0
6
+ %meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1'}
7
+ %body
8
+ = yield
9
+ %footer
10
+ .container
11
+ %ul#footer_nav
12
+ %li= link_to 'Home', root_path