Current section

37 Versions

Jump to

Compare versions

18 files changed
+321 additions
-110 deletions
  @@ -0,0 +1,25 @@
1 + Copyright (c) 2016 Infinite Red, Inc.
2 +
3 + Thesis depends on Elixir, which is under the Apache 2 license, and
4 + Phoenix, which is also MIT.
5 +
6 + MIT License
7 +
8 + Permission is hereby granted, free of charge, to any person obtaining
9 + a copy of this software and associated documentation files (the
10 + "Software"), to deal in the Software without restriction, including
11 + without limitation the rights to use, copy, modify, merge, publish,
12 + distribute, sublicense, and/or sell copies of the Software, and to
13 + permit persons to whom the Software is furnished to do so, subject to
14 + the following conditions:
15 +
16 + The above copyright notice and this permission notice shall be
17 + included in all copies or substantial portions of the Software.
18 +
19 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23 + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24 + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  @@ -16,7 +16,7 @@ _If you are having problems, view `README_INSTALL.md` for manual instructions._
16 16
17 17 ```elixir
18 18 def deps do
19 - [{:thesis, "~> 0.0.5"}]
19 + [{:thesis, "~> 0.0.7"}]
20 20 end
21 21
22 22 def application do
  @@ -157,23 +157,7 @@ Also supported by others on the [Infinite Red](https://infinite.red) team.
157 157
158 158 Copyright (c) 2016 Infinite Red, Inc.
159 159
160 - MIT License
160 + Thesis depends on Elixir, which is under the Apache 2 license, and
161 + Phoenix, which is also MIT.
161 162
162 - Permission is hereby granted, free of charge, to any person obtaining
163 - a copy of this software and associated documentation files (the
164 - "Software"), to deal in the Software without restriction, including
165 - without limitation the rights to use, copy, modify, merge, publish,
166 - distribute, sublicense, and/or sell copies of the Software, and to
167 - permit persons to whom the Software is furnished to do so, subject to
168 - the following conditions:
169 -
170 - The above copyright notice and this permission notice shall be
171 - included in all copies or substantial portions of the Software.
172 -
173 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
174 - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
175 - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
176 - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
177 - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
178 - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
179 - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
163 + See LICENSE.md for more information.
  @@ -20,9 +20,9 @@ Run `mix deps.get`.
20 20
21 21 ```elixir
22 22 config :thesis,
23 - store: Thesis.Store,
23 + store: Thesis.EctoStore,
24 24 authorization: IrWebsite.ThesisAuth
25 - config :thesis, Thesis.Store, repo: <MyApp>.Repo
25 + config :thesis, Thesis.EctoStore, repo: <MyApp>.Repo
26 26 ```
27 27
28 28 #### 3. Create `lib/thesis_auth.ex`
  @@ -9,8 +9,8 @@
9 9 <<"lib/thesis/config.ex">>,<<"lib/thesis/controller.ex">>,
10 10 <<"lib/thesis/models/page.ex">>,<<"lib/thesis/models/page_content.ex">>,
11 11 <<"lib/thesis/router.ex">>,<<"lib/thesis/store.ex">>,
12 - <<"lib/thesis/view.ex">>,<<"priv/static/thesis-editor.js">>,
13 - <<"priv/static/thesis.css">>,
12 + <<"lib/thesis/stores/ecto_store.ex">>,<<"lib/thesis/view.ex">>,
13 + <<"priv/static/thesis-editor.js">>,<<"priv/static/thesis.css">>,
14 14 <<"priv/templates/thesis.install/migration.exs">>,
15 15 <<"priv/templates/thesis.install/thesis_auth.exs">>,
16 16 <<"web/static/components/add_button.js">>,
  @@ -23,10 +23,11 @@
23 23 <<"web/static/components/settings_button.js">>,
24 24 <<"web/static/components/style_button.js">>,
25 25 <<"web/static/thesis-editor.js">>,<<"web/static/utilities/net.js">>,
26 - <<"mix.exs">>,<<"README.md">>,<<"README_INSTALL.md">>,<<"package.json">>]}.
26 + <<"mix.exs">>,<<"README.md">>,<<"README_INSTALL.md">>,<<"LICENSE.md">>,
27 + <<"package.json">>]}.
27 28 {<<"licenses">>,[<<"MIT">>]}.
28 29 {<<"links">>,
29 - [{<<"Docs">>,<<"https://hexdocs.pm/thesis/0.0.6/api-reference.html">>},
30 + [{<<"Docs">>,<<"https://hexdocs.pm/thesis/0.0.7/api-reference.html">>},
30 31 {<<"GitHub">>,<<"https://github.com/infinite_red/thesis">>}]}.
31 32 {<<"maintainers">>,
32 33 [<<"Jamon Holmgren">>,<<"Ken Miller">>,<<"Daniel Berkompas">>]}.
  @@ -52,4 +53,4 @@
52 53 [{<<"app">>,<<"plug">>},
53 54 {<<"optional">>,false},
54 55 {<<"requirement">>,<<"~> 1.0">>}]}]}.
55 - {<<"version">>,<<"0.0.6">>}.
56 + {<<"version">>,<<"0.0.7">>}.
  @@ -5,15 +5,25 @@ defmodule Mix.Tasks.Thesis.Install do
5 5 @shortdoc "Generates Thesis code in your Phoenix app"
6 6
7 7 @moduledoc """
8 - TODO: Write docs.
8 + Installs Thesis by adding these to your host app:
9 +
10 + * lib/thesis_auth.ex - Contains a function to handle authorization
11 + * migration - creates the two tables needed for Thesis.EctoStore
12 + * config/config.exs - adds Thesis config code
13 + * web/web.ex - adds Thesis `use` statements
14 +
15 + You should be able to run this mix task multiple times without harm. It will
16 + automatically detect when a file or line of code exists and skip that step.
9 17 """
10 18
19 + @doc false
11 20 def run(_args) do
12 21 thesis_templates
13 22 thesis_config
14 23 thesis_web
15 24 end
16 25
26 + @doc false
17 27 def thesis_templates do
18 28 template_files = [ {"priv/templates/thesis.install/thesis_auth.exs", "lib/thesis_auth.ex" } ]
19 29 migration_exists = File.ls!("priv/repo/migrations") |> Enum.map(fn (f) -> String.contains?(f, "create_thesis_tables") end) |> Enum.any?
  @@ -27,6 +37,7 @@ defmodule Mix.Tasks.Thesis.Install do
27 37 |> Stream.run
28 38 end
29 39
40 + @doc false
30 41 def thesis_config do
31 42 status_msg("updating", "config/config.exs")
32 43 dest_file_path = Path.join [File.cwd! | ~w(config config.exs)]
  @@ -35,6 +46,7 @@ defmodule Mix.Tasks.Thesis.Install do
35 46 |> overwrite_file(dest_file_path)
36 47 end
37 48
49 + @doc false
38 50 def thesis_web do
39 51 status_msg("updating", "web/web.exs")
40 52 dest_file_path = Path.join [File.cwd! | ~w(web web.ex)]
  @@ -71,9 +83,9 @@ defmodule Mix.Tasks.Thesis.Install do
71 83
72 84 # Configure thesis content editor
73 85 config :thesis,
74 - store: Thesis.Store,
86 + store: Thesis.EctoStore,
75 87 authorization: #{Mix.Phoenix.base}.ThesisAuth
76 - config :thesis, Thesis.Store, repo: #{Mix.Phoenix.base}.Repo
88 + config :thesis, Thesis.EctoStore, repo: #{Mix.Phoenix.base}.Repo
77 89 """
78 90 else
79 91 status_msg("skipping", "thesis config. It already exists.")
Loading more files…