ninjahippo 0.0.1

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.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NjNlMmJkNmE3YzVkN2Y2ZGQxYWQzNzk4YjFiZTFjY2MzOGI0MGI3Mw==
5
+ data.tar.gz: !binary |-
6
+ YzgwN2ZlMTkyZmZiMmY3YzY1Yjk3YjZiZTk1NmNkNGM1YjgyODk4NA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NzFjNWY4MWM5ZjlmMWVkYTQ1MWJhMGU0ZGQxODViYzE2NjU1ZDcxNzcwYWI3
10
+ M2ZkYWQ1OTZmNTI0YThlNDZhZjMwNGJjMGY5MGRkNmU4ODBmYTc0YmUzMWM1
11
+ ZDZjYWU2ZGFhNmNhOGE0YWExZTg4NTUzNmNmZWZiNzUyNTEwNjI=
12
+ data.tar.gz: !binary |-
13
+ YWRkY2Y3YTQxMWI3OWU0NjBmNWJkZDViMTc3OGZmYzQwN2VlMDhhZGVjNDU5
14
+ MTVlZTI3M2M5ZTU2MGU3MzllMGRhNjFjNzJmZDBjNjk1YzQ5MzE2Yzg5OWFl
15
+ NmFkNjYyNGQzZjUwYWM1OTU4NzJlMGFkZjRiYmY3ZmU4NWM0MzM=
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2014 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = Ninjahippo
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,32 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Ninjahippo'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+
20
+ Bundler::GemHelper.install_tasks
21
+
22
+ require 'rake/testtask'
23
+
24
+ Rake::TestTask.new(:test) do |t|
25
+ t.libs << 'lib'
26
+ t.libs << 'test'
27
+ t.pattern = 'test/**/*_test.rb'
28
+ t.verbose = false
29
+ end
30
+
31
+
32
+ task default: :test
@@ -0,0 +1,11 @@
1
+ class NinjahippoGenerator < Rails::Generators::Base
2
+ source_root File.expand_path("../templates", __FILE__)
3
+
4
+ def copy_files
5
+ copy_file 'ninjahippo_creds.rb', 'config/initializers/ninjahippo_creds.rb'
6
+
7
+ copy_file 'ninjahippo_controller.rb', 'app/controllers/ninjahippo_controller.rb'
8
+
9
+ copy_file 'show.html.erb', 'app/views/ninjahippo/show.html.erb'
10
+ end
11
+ end
@@ -0,0 +1,18 @@
1
+ require 'net/http'
2
+ require 'json'
3
+
4
+ class NinjahippoController < ApplicationController
5
+ def index
6
+ @html = JSON.parse(Net::HTTP.get_response(URI.parse(NH_BASE + 'sites/' + APP_NAME + '/pages/' + 'index' + '?application_token=' + APP_TOKEN)).body)['html']
7
+ render 'show'
8
+ end
9
+
10
+ def show
11
+ nh = Net::HTTP.get_response(URI.parse(NH_BASE + 'sites/' + APP_NAME + '/pages/' + params[:slug] + '?application_token=' + APP_TOKEN))
12
+ if nh.code != '401'
13
+ @html = JSON.parse(nh.body)['html']
14
+ else
15
+ render :file => 'public/404.html', :status => :not_found, :layout => false
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,3 @@
1
+ NH_BASE = "http://api.ninjahippo.io/v1/"
2
+ APP_NAME = ENV["APP_SLUG"]
3
+ APP_TOKEN = ENV["APP_TOKEN"]
@@ -0,0 +1 @@
1
+ <%= raw @html %>
data/lib/ninjahippo.rb ADDED
@@ -0,0 +1,3 @@
1
+ module Ninjahippo
2
+
3
+ end
@@ -0,0 +1,3 @@
1
+ module Ninjahippo
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ninjahippo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Joah Gerstenberg
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.11
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 3.2.11
27
+ description: The CMS built for developers by developers.
28
+ email:
29
+ - me@joahg.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - MIT-LICENSE
35
+ - README.rdoc
36
+ - Rakefile
37
+ - lib/generators/ninjahippo/ninjahippo_generator.rb
38
+ - lib/generators/ninjahippo/templates/ninjahippo_controller.rb
39
+ - lib/generators/ninjahippo/templates/ninjahippo_creds.rb
40
+ - lib/generators/ninjahippo/templates/show.html.erb
41
+ - lib/ninjahippo.rb
42
+ - lib/ninjahippo/version.rb
43
+ homepage: http://ninjahippo.io
44
+ licenses: []
45
+ metadata: {}
46
+ post_install_message:
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubyforge_project:
62
+ rubygems_version: 2.3.0
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: The CMS built for developers by developers.
66
+ test_files: []