-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update google scraper, now with capybara / ajax support - also feelin…
…g out an initial UI
- Loading branch information
Showing
25 changed files
with
274 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
class TasksController < ApplicationController | ||
# GET /Tasks | ||
# GET /Tasks.json | ||
def index | ||
@tasks = Task.all | ||
|
||
respond_to do |format| | ||
format.html # index.html.erb | ||
format.json { render json: @tasks } | ||
end | ||
end | ||
|
||
# GET /Tasks/1 | ||
# GET /Tasks/1.json | ||
def show | ||
@task = Task.find(params[:id]) | ||
|
||
respond_to do |format| | ||
format.html # show.html.erb | ||
format.json { render json: @task } | ||
end | ||
end | ||
|
||
# GET /Tasks/new | ||
# GET /Tasks/new.json | ||
def new | ||
@task = Task.new | ||
|
||
respond_to do |format| | ||
format.html # new.html.erb | ||
format.json { render json: @task } | ||
end | ||
end | ||
|
||
# GET /Tasks/1/edit | ||
def edit | ||
@task = Task.find(params[:id]) | ||
end | ||
|
||
# POST /Tasks | ||
# POST /Tasks.json | ||
def create | ||
@task = Task.new(params[:Task]) | ||
|
||
respond_to do |format| | ||
if @task.save | ||
format.html { redirect_to @task, notice: 'Task was successfully created.' } | ||
format.json { render json: @task, status: :created, location: @task } | ||
else | ||
format.html { render action: "new" } | ||
format.json { render json: @task.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PUT /Tasks/1 | ||
# PUT /Tasks/1.json | ||
def update | ||
@task = Task.find(params[:id]) | ||
|
||
respond_to do |format| | ||
if @task.update_attributes(params[:Task]) | ||
format.html { redirect_to @task, notice: 'Task was successfully updated.' } | ||
format.json { head :ok } | ||
else | ||
format.html { render action: "edit" } | ||
format.json { render json: @task.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /Tasks/1 | ||
# DELETE /Tasks/1.json | ||
def destroy | ||
@task = Task.find(params[:id]) | ||
@task.destroy | ||
|
||
respond_to do |format| | ||
format.html { redirect_to Tasks_url } | ||
format.json { head :ok } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,9 @@ | ||
<p id="notice"><%= notice %></p> | ||
|
||
<p> | ||
<b>Name:</b> | ||
<%= @host.name %> | ||
</p> | ||
|
||
<p> | ||
<b>Ip address:</b> | ||
<%= @host.ip_address %> | ||
</p> | ||
|
||
<p> | ||
<b>Organization:</b> | ||
<%= @host.organization_id %> | ||
</p> | ||
|
||
|
||
<%= link_to 'Edit', edit_host_path(@host) %> | | ||
<%= link_to 'Back', hosts_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<h1>Listing maps</h1> | ||
<table> | ||
<tr> | ||
<th>Type</th> | ||
</tr> | ||
<tr> | ||
<td>Google Map</td> | ||
</tr> | ||
</table> | ||
<br /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<%= form_for(@task) do |f| %> | ||
<% if @task.errors.any? %> | ||
<div id="error_explanation"> | ||
<h2><%= pluralize(@task.errors.count, "error") %> prohibited this task from being saved:</h2> | ||
|
||
<ul> | ||
<% @task.errors.full_messages.each do |msg| %> | ||
<li><%= msg %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
<div class="actions"> | ||
<%= f.submit %> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<h1>Editing task</h1> | ||
|
||
<%= render 'form' %> | ||
|
||
<%= link_to 'Show', @domain %> | | ||
<%= link_to 'Back', domains_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<h1>Listing tasks</h1> | ||
|
||
<table> | ||
<tr> | ||
<th>Name</th> | ||
<th>Accepts</th> | ||
</tr> | ||
|
||
<% @tasks.each do |task| %> | ||
<tr> | ||
<td><%= task.name %></td> | ||
<td><%= x =[]; task.allowed_types.each {|t| x << t.name};x %> </td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
|
||
<br /> | ||
|
||
<%= link_to 'New task', new_task_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<h1>New task</h1> | ||
|
||
<%= render 'form' %> | ||
|
||
<%= link_to 'Back', tasks_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<p id="notice"><%= notice %></p> | ||
|
||
<p> | ||
<b>Name:</b> | ||
<%= @task.name %> | ||
</p> | ||
|
||
<%= link_to 'Edit', edit_task_path(@task) %> | | ||
<%= link_to 'Back', tasks_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
$:.unshift(File.dirname(__FILE__)) | ||
|
||
require '../../../config/environment' | ||
require 'test/unit' | ||
|
||
class TestGoogleSearchScraper < Test::Unit::TestCase | ||
|
||
def test_google_search_scraper_test | ||
scraper = Ear::Client::Google::SearchScraper.new | ||
results = scraper.search("test") | ||
assert results.count == 10,"Wrong count, should be 10, is #{results.count}" | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.