censorstrike 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -31,7 +31,8 @@ use Censorstrike::Middleware,
31
31
  :begin => Time.now, # when to start the blackout
32
32
  :end => (Time.now + 500), # when to end the blackout
33
33
  :message => "My HTML", # custom HTML message
34
- :file => "/path/to/my/file" # custom HTML file message
34
+ :file => "/path/to/my/file" # custom HTML file message,
35
+ :footer => "<p>My custom footer</p>" # a custom footer
35
36
  ```
36
37
 
37
38
  ## License
data/lib/censorstrike.rb CHANGED
@@ -32,6 +32,7 @@ module Censorstrike
32
32
  def render
33
33
  response = Rack::Response.new([], 503, 'Content-Type' => 'text/html')
34
34
  body = options[:message] ? options[:message] : File.read(options[:file])
35
+ body.gsub!("{{footer}}", options[:footer] || "")
35
36
  response.write(body)
36
37
  response.finish
37
38
  end
@@ -1,3 +1,3 @@
1
1
  module Censorstrike
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/message.html CHANGED
@@ -53,13 +53,14 @@
53
53
  <h1>We Stand With The Internet</h1>
54
54
 
55
55
  <div id='main_message'>
56
- <p>We apologize, but our site's normal content will be unavailable until 8pm Eastern time today. We have joined with other communities including <a href='http://reddit.com'>Reddit</a> and <a href='http://wikipedia.org'>Wikipedia</a> in using this one day to send a clear message of protest against legislation that stands to threaten everything amazing that has been built on the internet.</p>
56
+ <p>Our site's normal content will be unavailable until 8pm Eastern time today. We have joined with other communities including <a href='http://reddit.com'>Reddit</a> and <a href='http://wikipedia.org'>Wikipedia</a> in using this one day to send a clear message of protest against legislation that stands to threaten everything amazing that has been built on the internet.</p>
57
57
 
58
58
  <p>The Stop Online Piracy Act (SOPA) in the House of Representatives and the Protect Intellectual Property Act (PIPA) in the Senate pose a very real threat to the freedom, collaboration, and openness of the internet. While ostensibly aimed to curtail illegal activities by foreign websites, these bills contain provisions and measures that amount to legal enforcement without due process and, in some cases, could very well damage the infrastructure of the internet as a whole.</p>
59
59
 
60
60
  <p>We do not take shutting our site down, even for just one day, lightly. We believe that this issue is one that is too important for us to remain silent. We urge you to learn more about the bill and what you can do to fight it by visiting the <a href='https://action.eff.org/o/9042/p/dia/action/public/?action_KEY=8173'>Electronic Frontier Foundation</a>.</p>
61
61
  </div>
62
62
 
63
- <div id='small_message'>Do you have a website? Join the protest, <a href='http://github.com/intridea/stand-with-the-internet'>add this message</a> to your own pages!</div>
63
+ <div id='small_message'>Do you have a website? Join the protest, <a href='http://github.com/intridea/censorstrike'>add this message</a> to your own pages!</div>
64
+ {{footer}}
64
65
  </body>
65
66
  </html>
@@ -28,5 +28,16 @@ describe Censorstrike::Middleware do
28
28
  get '/'
29
29
  last_response.body.should == 'Down with censorship!'
30
30
  end
31
+
32
+ it 'should not contain {{footer}}' do
33
+ get '/'
34
+ last_response.body.should_not be_include("{{footer}}")
35
+ end
36
+
37
+ it 'should be able to have a custom footer' do
38
+ options.merge!(:footer => "custom footer")
39
+ get '/'
40
+ last_response.body.should be_include("custom footer")
41
+ end
31
42
  end
32
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: censorstrike
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-17 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
16
- requirement: &70345414450420 !ruby/object:Gem::Requirement
16
+ requirement: &70193749032460 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70345414450420
24
+ version_requirements: *70193749032460
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70345414449780 !ruby/object:Gem::Requirement
27
+ requirement: &70193749031880 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70345414449780
35
+ version_requirements: *70193749031880
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rack-test
38
- requirement: &70345414443420 !ruby/object:Gem::Requirement
38
+ requirement: &70193749031240 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70345414443420
46
+ version_requirements: *70193749031240
47
47
  description: A middleware to display a message in protest of SOPA/PIPA
48
48
  email:
49
49
  - michael@intridea.com