Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jangernert/FeedReader.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Long <self@brendanlong.com>2017-10-22 20:05:26 +0300
committerBrendan Long <self@brendanlong.com>2017-10-22 22:24:36 +0300
commit566d4c6bc9ca15c1e9c1bbe8824f8c657780b608 (patch)
treed815e80f79af386a68a3265690648d0eca0374ed
parentd40594ac81ef0724b79a4f8c075be5f291a4d240 (diff)
Add Feedbin to the CI Docker image
-rw-r--r--circle.yml25
-rw-r--r--docker/Dockerfile25
-rw-r--r--plugins/backend/feedbin/TestFeedbin.vala25
-rw-r--r--plugins/backend/feedbin/feedbinAPI.vala10
4 files changed, 71 insertions, 14 deletions
diff --git a/circle.yml b/circle.yml
index fb0c2e0b..9e712c55 100644
--- a/circle.yml
+++ b/circle.yml
@@ -4,8 +4,33 @@ jobs:
docker:
# See docker/Dockerfile
- image: feedreader/fedora-feedreader-devel
+ environment:
+ ELASTICSEARCH_URL: http://127.0.0.1:9200
+ # Note: The Feedbin API has to run on subdomain "api"
+ FEEDBIN_TEST_HOST: http://api.x.localhost:9292
+ POSTGRES_USERNAME: postgres
+ POSTGRES_HOST: 127.0.0.1
+ DATABASE_URL: postgres://postgres@127.0.0.1:5432/feedbin_db
+ REDIS_URL: redis://127.0.0.1:6379
+ - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.3
+ environment:
+ 'discovery.type': single-node
+ - image: postgres:9.6.5-alpine
+ - image: redis:3.2.11-alpine
+
working_directory: ~/FeedReader
steps:
+ - run:
+ name: Setup Feedbin
+ command: cd /feedbin && rake db:setup && dnf install -y nodejs
+ - run:
+ name: Run Feedbin background processes
+ command: cd /feedbin && bundle exec foreman start
+ background: true
+ - run:
+ name: Run Feedbin
+ command: cd /feedbin && rackup
+ background: true
- checkout
- run:
name: Build
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 32c9ccfa..88f7e363 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -21,3 +21,28 @@ RUN dnf -y install \
sqlite-devel \
vala \
webkitgtk4-devel
+
+# Install Feedbin
+# Note: Some dependencies are duplicates of above, but it's easier to maintain if
+# we use the exact list here: https://github.com/feedbin/feedbin/blob/master/doc/INSTALL-fedora.md
+# TODO: Run Feedbin in its own container
+RUN dnf -y install \
+ gcc \
+ gcc-c++ \
+ git \
+ libcurl-devel \
+ libxml2-devel \
+ libxslt-devel \
+ nodejs \
+ postgresql \
+ postgresql-devel \
+ redhat-rpm-config \
+ rubygems \
+ ruby-devel \
+ rubygem-bundler \
+ ImageMagick-devel \
+ opencv-devel \
+ which
+RUN git clone https://github.com/feedbin/feedbin.git
+RUN gem install bundler
+RUN cd feedbin && bundle
diff --git a/plugins/backend/feedbin/TestFeedbin.vala b/plugins/backend/feedbin/TestFeedbin.vala
index b1f204fc..28ea56e3 100644
--- a/plugins/backend/feedbin/TestFeedbin.vala
+++ b/plugins/backend/feedbin/TestFeedbin.vala
@@ -1,3 +1,4 @@
+const string host_env = "FEEDBIN_TEST_HOST";
const string user_env = "FEEDBIN_TEST_USER";
const string password_env = "FEEDBIN_TEST_PASSWORD";
@@ -13,7 +14,7 @@ void delete_subscription(FeedbinAPI api, string url)
}
}
-void add_login_tests()
+void add_login_tests(string host)
{
string? username = Environment.get_variable(user_env);
string? password = Environment.get_variable(password_env);
@@ -26,10 +27,10 @@ void add_login_tests()
Test.add_data_func ("/feedbinapi/login", () => {
- var api = new FeedbinAPI(username, password);
+ var api = new FeedbinAPI(username, password, null, host);
assert(api.login());
- api = new FeedbinAPI("wrong", "password");
+ api = new FeedbinAPI("wrong", "password", null, host);
assert(!api.login());
api.username = username;
@@ -46,7 +47,7 @@ void add_login_tests()
return;
}
- var api = new FeedbinAPI(username, password);
+ var api = new FeedbinAPI(username, password, null, host);
var url = "https://www.brendanlong.com/feeds/all.atom.xml?feedreader-test-subscribe-$nonce";
delete_subscription(api, url);
@@ -88,7 +89,7 @@ void add_login_tests()
return;
}
- var api = new FeedbinAPI(username, password);
+ var api = new FeedbinAPI(username, password, null, host);
var url = @"https://www.brendanlong.com/feeds/all.atom.xml?feedreader-test-taggings-$nonce";
delete_subscription(api, url);
@@ -140,7 +141,7 @@ void add_login_tests()
return;
}
- var api = new FeedbinAPI(username, password);
+ var api = new FeedbinAPI(username, password, null, host);
// Note: This one shouldn't be deleted or recreated, since we want the entries to be available
var url = "https://www.brendanlong.com/feeds/all.atom.xml?feed-reader-test-entries";
@@ -195,21 +196,25 @@ void add_login_tests()
void main(string[] args)
{
- Test.init(ref args);
+ Test.init(ref args);
+
+ string? host = Environment.get_variable(host_env);
+ if(host == null)
+ host = "https://api.feedbin.com";
// Tests that don't need a login
Test.add_data_func ("/feedbinapi/construct", () => {
- var api = new FeedbinAPI("user", "password");
+ var api = new FeedbinAPI("user", "password", null, host);
assert(api != null);
});
Test.add_data_func ("/feedbinapi/bad login", () => {
- var api = new FeedbinAPI("user", "password");
+ var api = new FeedbinAPI("user", "password", null, host);
assert(!api.login());
});
- add_login_tests();
+ add_login_tests(host);
Test.run ();
}
diff --git a/plugins/backend/feedbin/feedbinAPI.vala b/plugins/backend/feedbin/feedbinAPI.vala
index 872705e4..f7886e68 100644
--- a/plugins/backend/feedbin/feedbinAPI.vala
+++ b/plugins/backend/feedbin/feedbinAPI.vala
@@ -24,16 +24,18 @@ public errordomain FeedbinError {
}
public class FeedbinAPI : Object {
- private const string BASE_URI = "https://api.feedbin.com/v2/";
+ private const string BASE_URI_FORMAT = "%s/v2/";
private Soup.Session m_session;
+ private string m_base_uri;
public string username { get ; set; }
public string password { get ; set; }
- public FeedbinAPI(string username, string password, string? user_agent = null)
+ public FeedbinAPI(string username, string password, string? user_agent = null, string? host = "https://api.feedbin.com")
{
this.username = username;
this.password = password;
+ m_base_uri = BASE_URI_FORMAT.printf(host);
m_session = new Soup.Session();
if(user_agent != null)
@@ -47,7 +49,7 @@ public class FeedbinAPI : Object {
private Soup.Message request(string method, string path, string? input = null) throws FeedbinError
{
- var message = new Soup.Message(method, BASE_URI+path);
+ var message = new Soup.Message(method, m_base_uri + path);
if(method == "POST" || method == "PUT")
message.request_headers.append("Content-Type", "application/json; charset=utf-8");
@@ -65,7 +67,7 @@ public class FeedbinAPI : Object {
case Soup.Status.CANT_RESOLVE_PROXY:
case Soup.Status.CANT_CONNECT:
case Soup.Status.CANT_CONNECT_PROXY:
- throw new FeedbinError.NO_CONNECTION(@"Connection to $BASE_URI failed");
+ throw new FeedbinError.NO_CONNECTION(@"Connection to $m_base_uri failed");
case Soup.Status.UNAUTHORIZED:
throw new FeedbinError.NOT_AUTHORIZED(@"Not authorized to $method $path");
case Soup.Status.NOT_FOUND: