Combine apps to single mebe_web app
This commit is contained in:
parent
5d6cef5588
commit
e19dc4a70f
61 changed files with 56 additions and 240 deletions
16
.gitignore
vendored
16
.gitignore
vendored
|
@ -5,3 +5,19 @@ erl_crash.dump
|
|||
config.exs
|
||||
|
||||
/data
|
||||
|
||||
# Configs
|
||||
config/*.exs
|
||||
|
||||
# Static artifacts
|
||||
/node_modules
|
||||
/bower_components
|
||||
|
||||
# Since we are building js and css from web/static,
|
||||
# we ignore priv/static/{css,js}. You may want to
|
||||
# comment this depending on your deployment strategy.
|
||||
/priv/static/
|
||||
|
||||
# Custom templates should be ignored
|
||||
/web/templates/custom/
|
||||
|
||||
|
|
4
apps/mebe_engine/.gitignore
vendored
4
apps/mebe_engine/.gitignore
vendored
|
@ -1,4 +0,0 @@
|
|||
/_build
|
||||
/deps
|
||||
erl_crash.dump
|
||||
*.ez
|
|
@ -1,4 +0,0 @@
|
|||
MebeEngine
|
||||
==========
|
||||
|
||||
** TODO: Add description **
|
|
@ -1,29 +0,0 @@
|
|||
# This file is responsible for configuring your application
|
||||
# and its dependencies with the aid of the Mix.Config module.
|
||||
use Mix.Config
|
||||
|
||||
# This configuration is loaded before any dependency and is restricted
|
||||
# to this project. If another project depends on this project, this
|
||||
# file won't be loaded nor affect the parent project. For this reason,
|
||||
# if you want to provide default values for your application for third-
|
||||
# party users, it should be done in your mix.exs file.
|
||||
|
||||
# Sample configuration:
|
||||
#
|
||||
# config :logger, :console,
|
||||
# level: :info,
|
||||
# format: "$date $time [$level] $metadata$message\n",
|
||||
# metadata: [:user_id]
|
||||
|
||||
# It is also possible to import configuration files, relative to this
|
||||
# directory. For example, you can emulate configuration per environment
|
||||
# by uncommenting the line below and defining dev.exs, test.exs and such.
|
||||
# Configuration from the imported file will override the ones defined
|
||||
# here (which is why it is important to import them last).
|
||||
#
|
||||
# import_config "#{Mix.env}.exs"
|
||||
|
||||
config :mebe_engine,
|
||||
|
||||
# The path to crawl post and page data from. No trailing slash, use an absolute path.
|
||||
data_path: "/path/to/data"
|
|
@ -1,20 +0,0 @@
|
|||
defmodule MebeEngine do
|
||||
use Application
|
||||
|
||||
def worker_name, do: :mebe_db_worker
|
||||
|
||||
# See http://elixir-lang.org/docs/stable/elixir/Application.html
|
||||
# for more information on OTP Applications
|
||||
def start(_type, _args) do
|
||||
import Supervisor.Spec, warn: false
|
||||
|
||||
children = [
|
||||
worker(MebeEngine.Worker, [[name: worker_name]])
|
||||
]
|
||||
|
||||
# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
|
||||
# for other strategies and supported options
|
||||
opts = [strategy: :one_for_one, name: MebeEngine.Supervisor]
|
||||
Supervisor.start_link(children, opts)
|
||||
end
|
||||
end
|
|
@ -1,41 +0,0 @@
|
|||
defmodule MebeEngine.Mixfile do
|
||||
use Mix.Project
|
||||
|
||||
def project do
|
||||
[app: :mebe_engine,
|
||||
version: "0.0.1",
|
||||
deps_path: "../../deps",
|
||||
lockfile: "../../mix.lock",
|
||||
elixir: "~> 1.1.0",
|
||||
build_embedded: Mix.env == :prod,
|
||||
start_permanent: Mix.env == :prod,
|
||||
deps: deps]
|
||||
end
|
||||
|
||||
# Configuration for the OTP application
|
||||
#
|
||||
# Type `mix help compile.app` for more information
|
||||
def application do
|
||||
[applications: [:logger],
|
||||
mod: {MebeEngine, []}]
|
||||
end
|
||||
|
||||
# Dependencies can be Hex packages:
|
||||
#
|
||||
# {:mydep, "~> 0.3.0"}
|
||||
#
|
||||
# Or git/path repositories:
|
||||
#
|
||||
# {:mydep, git: "https://github.com/elixir-lang/mydep.git", tag: "0.1.0"}
|
||||
#
|
||||
# To depend on another app inside the umbrella:
|
||||
#
|
||||
# {:myapp, in_umbrella: true}
|
||||
#
|
||||
# Type `mix help deps` for more examples and options
|
||||
defp deps do
|
||||
[
|
||||
{:earmark, "~> 0.1.16"}
|
||||
]
|
||||
end
|
||||
end
|
|
@ -1,7 +0,0 @@
|
|||
defmodule MebeEngineTest do
|
||||
use ExUnit.Case
|
||||
|
||||
test "the truth" do
|
||||
assert 1 + 1 == 2
|
||||
end
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
ExUnit.start()
|
22
apps/mebe_web/.gitignore
vendored
22
apps/mebe_web/.gitignore
vendored
|
@ -1,22 +0,0 @@
|
|||
# Mix artifacts
|
||||
/_build
|
||||
/deps
|
||||
/*.ez
|
||||
|
||||
# Generate on crash by the VM
|
||||
erl_crash.dump
|
||||
|
||||
# Configs
|
||||
/config/*.exs
|
||||
|
||||
# Static artifacts
|
||||
/node_modules
|
||||
/bower_components
|
||||
|
||||
# Since we are building js and css from web/static,
|
||||
# we ignore priv/static/{css,js}. You may want to
|
||||
# comment this depending on your deployment strategy.
|
||||
/priv/static/
|
||||
|
||||
# Custom templates should be ignored
|
||||
/web/templates/custom/
|
|
@ -1,8 +0,0 @@
|
|||
# MebeWeb
|
||||
|
||||
To start your new Phoenix application:
|
||||
|
||||
1. Install dependencies with `mix deps.get`
|
||||
2. Start Phoenix endpoint with `mix phoenix.server`
|
||||
|
||||
Now you can visit `localhost:4000` from your browser.
|
|
@ -1,41 +0,0 @@
|
|||
defmodule MebeWeb.Mixfile do
|
||||
use Mix.Project
|
||||
|
||||
def project do
|
||||
[app: :mebe_web,
|
||||
version: "1.0.0",
|
||||
deps_path: "../../deps",
|
||||
lockfile: "../../mix.lock",
|
||||
elixir: "~> 1.1.0",
|
||||
elixirc_paths: elixirc_paths(Mix.env),
|
||||
compilers: [:phoenix] ++ Mix.compilers,
|
||||
build_embedded: Mix.env == :prod,
|
||||
start_permanent: Mix.env == :prod,
|
||||
deps: deps]
|
||||
end
|
||||
|
||||
# Configuration for the OTP application
|
||||
#
|
||||
# Type `mix help compile.app` for more information
|
||||
def application do
|
||||
[mod: {MebeWeb, []},
|
||||
applications: [:phoenix, :cowboy, :logger]]
|
||||
end
|
||||
|
||||
# Specifies which paths to compile per environment
|
||||
defp elixirc_paths(:test), do: ["lib", "web", "test/support"]
|
||||
defp elixirc_paths(_), do: ["lib", "web"]
|
||||
|
||||
# Specifies your project dependencies
|
||||
#
|
||||
# Type `mix help deps` for examples and options
|
||||
defp deps do
|
||||
[
|
||||
{:phoenix, "~> 1.0"},
|
||||
{:phoenix_live_reload, "~> 1.0", only: :dev},
|
||||
{:phoenix_html, "~> 2.2"},
|
||||
{:cowboy, "~> 1.0"},
|
||||
{:mebe_engine, in_umbrella: true}
|
||||
]
|
||||
end
|
||||
end
|
|
@ -1,7 +0,0 @@
|
|||
This directory is for your custom templates. Should you wish to use a custom template
|
||||
for a view, copy the corresponding view's directory from the templates directory
|
||||
and modify the files as you see fit.
|
||||
|
||||
Note that if a view uses custom templates, each template must have a custom version.
|
||||
This means you need to copy over every template file. Naturally you can just leave
|
||||
the templates you do not want to modify untouched.
|
|
@ -1,40 +0,0 @@
|
|||
# This file is responsible for configuring your application
|
||||
# and its dependencies with the aid of the Mix.Config module.
|
||||
use Mix.Config
|
||||
|
||||
# This configuration is loaded before any dependency and is restricted
|
||||
# to this project. If another project depends on this project, this
|
||||
# file won't be loaded nor affect the parent project. For this reason,
|
||||
# if you want to provide default values for your application for third-
|
||||
# party users, it should be done in your mix.exs file.
|
||||
|
||||
# Sample configuration:
|
||||
#
|
||||
# config :logger, :console,
|
||||
# level: :info,
|
||||
# format: "$date $time [$level] $metadata$message\n",
|
||||
# metadata: [:user_id]
|
||||
|
||||
# It is also possible to import configuration files, relative to this
|
||||
# directory. For example, you can emulate configuration per environment
|
||||
# by uncommenting the line below and defining dev.exs, test.exs and such.
|
||||
# Configuration from the imported file will override the ones defined
|
||||
# here (which is why it is important to import them last).
|
||||
#
|
||||
# import_config "#{Mix.env}.exs"
|
||||
# This file is responsible for configuring your application
|
||||
# and its dependencies with the aid of the Mix.Config module.
|
||||
use Mix.Config
|
||||
|
||||
# The configuration defined here will only affect the dependencies
|
||||
# in the apps directory when commands are executed from the umbrella
|
||||
# project. For this reason, it is preferred to configure each child
|
||||
# application directly and import its configuration, as done below.
|
||||
import_config "../apps/*/config/config.exs"
|
||||
|
||||
# Sample configuration (overrides the imported configuration above):
|
||||
#
|
||||
# config :logger, :console,
|
||||
# level: :info,
|
||||
# format: "$date $time [$level] $metadata$message\n",
|
||||
# metadata: [:user_id]
|
|
@ -15,7 +15,10 @@ config :mebe_web, MebeWeb.Endpoint,
|
|||
adapter: Phoenix.PubSub.PG2]
|
||||
|
||||
# Custom blog configs
|
||||
config :mebe_web,
|
||||
config :mebe_web,,
|
||||
# The path to crawl post and page data from. No trailing slash, use an absolute path.
|
||||
data_path: "/path/to/mebe/data",
|
||||
|
||||
blog_name: "My awesome blog",
|
||||
blog_author: "Author McAuthor",
|
||||
absolute_url: "http://localhost:4000", # Absolute URL to the site without trailing slash, including protocol
|
4
lib/mebe_engine.ex
Normal file
4
lib/mebe_engine.ex
Normal file
|
@ -0,0 +1,4 @@
|
|||
defmodule MebeEngine do
|
||||
# Name of the database worker
|
||||
def worker_name, do: :mebe_db_worker
|
||||
end
|
|
@ -8,7 +8,7 @@ defmodule MebeEngine.Worker do
|
|||
alias MebeEngine.Crawler
|
||||
alias MebeEngine.DB
|
||||
|
||||
@data_path Application.get_env(:mebe_engine, :data_path)
|
||||
@data_path Application.get_env(:mebe_web, :data_path)
|
||||
|
||||
def start_link(opts \\ []) do
|
||||
GenServer.start_link(__MODULE__, :ok, opts)
|
|
@ -7,8 +7,10 @@ defmodule MebeWeb do
|
|||
import Supervisor.Spec, warn: false
|
||||
|
||||
children = [
|
||||
worker(MebeEngine.Worker, [[name: MebeEngine.worker_name]]),
|
||||
|
||||
# Start the endpoint when the application starts
|
||||
supervisor(MebeWeb.Endpoint, []),
|
||||
supervisor(MebeWeb.Endpoint, [])
|
||||
]
|
||||
|
||||
# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
|
41
mix.exs
41
mix.exs
|
@ -1,26 +1,41 @@
|
|||
defmodule Mebe.Mixfile do
|
||||
defmodule MebeWeb.Mixfile do
|
||||
use Mix.Project
|
||||
|
||||
def project do
|
||||
[apps_path: "apps",
|
||||
[app: :mebe_web,
|
||||
version: "1.0.0",
|
||||
deps_path: "../../deps",
|
||||
lockfile: "../../mix.lock",
|
||||
elixir: "~> 1.1.0",
|
||||
elixirc_paths: elixirc_paths(Mix.env),
|
||||
compilers: [:phoenix] ++ Mix.compilers,
|
||||
build_embedded: Mix.env == :prod,
|
||||
start_permanent: Mix.env == :prod,
|
||||
deps: deps]
|
||||
end
|
||||
|
||||
# Dependencies can be Hex packages:
|
||||
# Configuration for the OTP application
|
||||
#
|
||||
# {:mydep, "~> 0.3.0"}
|
||||
# Type `mix help compile.app` for more information
|
||||
def application do
|
||||
[mod: {MebeWeb, []},
|
||||
applications: [:phoenix, :cowboy, :logger]]
|
||||
end
|
||||
|
||||
# Specifies which paths to compile per environment
|
||||
defp elixirc_paths(:test), do: ["lib", "web", "test/support"]
|
||||
defp elixirc_paths(_), do: ["lib", "web"]
|
||||
|
||||
# Specifies your project dependencies
|
||||
#
|
||||
# Or git/path repositories:
|
||||
#
|
||||
# {:mydep, git: "https://github.com/elixir-lang/mydep.git", tag: "0.1.0"}
|
||||
#
|
||||
# Type `mix help deps` for more examples and options.
|
||||
#
|
||||
# Dependencies listed here are available only for this project
|
||||
# and cannot be accessed from applications inside the apps folder
|
||||
# Type `mix help deps` for examples and options
|
||||
defp deps do
|
||||
[]
|
||||
[
|
||||
{:phoenix, "~> 1.0"},
|
||||
{:phoenix_live_reload, "~> 1.0", only: :dev},
|
||||
{:phoenix_html, "~> 2.2"},
|
||||
{:cowboy, "~> 1.0"},
|
||||
{:earmark, "~> 0.1.16"}
|
||||
]
|
||||
end
|
||||
end
|
||||
|
|
Reference in a new issue