diff --git a/app/controllers/import_controller.rb b/app/controllers/import_controller.rb
index db2f30a..b057c7f 100644
--- a/app/controllers/import_controller.rb
+++ b/app/controllers/import_controller.rb
@@ -15,6 +15,8 @@ def request_auth
@request_token=@consumer.get_request_token
session[:request_token]=@request_token
+ session[:feed_url]=params[:feed]
+ session[:tumblr_url]=params[:blog]
redirect_to @request_token.authorize_url
end
@@ -33,14 +35,13 @@ def authorized
end
logger.info "Got access token"
-
create_blog_migration
end
def create_blog_migration
- blog_url = "http://www.ryangerard.net/1/feed"
-
+ #blog_url = "http://www.ryangerard.net/1/feed"
+ blog_url = session[:feed_url]
feed = get_feed(blog_url)
@feed_arr = parse_feed(feed)
@@ -115,14 +116,12 @@ def parse_feed(feed)
def write_posts_to_tumblr(posts)
logger.info "Starting write"
- t_url = "http://api.tumblr.com/v2/blog/ryangerard.tumblr.com/post"
+ #t_url = "http://api.tumblr.com/v2/blog/ryangerard.tumblr.com/post"
+ t_url = "http://api.tumblr.com/v2/blog/" + session[:tumblr_url] + "/post";
- logger.info "Getting access token"
@access_token = session[:access_token]
- count = 0
posts.each do |p|
- logger.info "&&&&&&&&&&&&&&&&&&&&&&"
# build the POST params string
post_params = {
diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb
new file mode 100644
index 0000000..6b57c68
--- /dev/null
+++ b/app/controllers/main_controller.rb
@@ -0,0 +1,7 @@
+class MainController < ApplicationController
+ def start
+ respond_to do |format|
+ format.html # main.html.erb
+ end
+ end
+end
diff --git a/app/helpers/main_helper.rb b/app/helpers/main_helper.rb
new file mode 100644
index 0000000..826effe
--- /dev/null
+++ b/app/helpers/main_helper.rb
@@ -0,0 +1,2 @@
+module MainHelper
+end
diff --git a/app/views/import/authorized.erb b/app/views/import/authorized.erb
index 07e8ac1..b16e231 100644
--- a/app/views/import/authorized.erb
+++ b/app/views/import/authorized.erb
@@ -1 +1,19 @@
-Authorized, bitches!
\ No newline at end of file
+
Listing posts
+
+
+
+ Title |
+ Date |
+
+
+<% @feed_arr.each do |post| %>
+
+ <%= post["title"] %> |
+ <%= post["pubDate"] %> |
+
+<% end %>
+
+
+
+
+<%= link_to 'Migrate Blog', '/import/migrate' %>
\ No newline at end of file
diff --git a/app/views/main/start.erb b/app/views/main/start.erb
new file mode 100644
index 0000000..2b7b85b
--- /dev/null
+++ b/app/views/main/start.erb
@@ -0,0 +1,7 @@
+<%= form_tag "/import/auth" do %>
+ <%= label_tag(:q, "RSS Feed:") %>
+ <%= text_field_tag(:feed) %>
+ <%= label_tag(:q, "Tumblr Blog Domain:") %>
+ <%= text_field_tag(:blog) %>
+ <%= submit_tag "Submit" %>
+<% end %>
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index c991575..521c6a5 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -6,7 +6,9 @@
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
- match 'import' => 'import#create'
+ root :to => 'main#start'
+
+ match 'import' => 'import#request_auth'
match 'import/auth' => 'import#request_auth'
match 'import/authorized' => 'import#authorized'
diff --git a/public/index.html b/public/index.html
deleted file mode 100644
index 75d5edd..0000000
--- a/public/index.html
+++ /dev/null
@@ -1,239 +0,0 @@
-
-
-
- Ruby on Rails: Welcome aboard
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Getting started
-
Here’s how to get rolling:
-
-
- -
-
Use rails generate
to create your models and controllers
- To see all available options, run it without parameters.
-
-
- -
-
Set up a default route and remove or rename this file
- Routes are set up in config/routes.rb.
-
-
- -
-
Create your database
- Run rake db:migrate
to create your database. If you're not using SQLite (the default), edit config/database.yml
with your username and password.
-
-
-
-
-
-
-
-
-
diff --git a/test/functional/main_controller_test.rb b/test/functional/main_controller_test.rb
new file mode 100644
index 0000000..e95c281
--- /dev/null
+++ b/test/functional/main_controller_test.rb
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class MainControllerTest < ActionController::TestCase
+ # Replace this with your real tests.
+ test "the truth" do
+ assert true
+ end
+end
diff --git a/test/unit/helpers/main_helper_test.rb b/test/unit/helpers/main_helper_test.rb
new file mode 100644
index 0000000..22da3c4
--- /dev/null
+++ b/test/unit/helpers/main_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class MainHelperTest < ActionView::TestCase
+end