ecrire 0.23.0 → 0.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +14 -46
- data/lib/ecrire/app/controllers/application_controller.rb +1 -1
- data/lib/ecrire/app/controllers/ecrire/{posts_controller.rb → theme_controller.rb} +1 -1
- data/lib/ecrire/app/controllers/sessions_controller.rb +1 -1
- data/lib/ecrire/app/controllers/static_controller.rb +1 -1
- data/lib/ecrire/app/helpers/posts_helper.rb +6 -0
- data/lib/ecrire/app/views/layouts/admin/application.html.erb +1 -1
- data/lib/ecrire/application.rb +26 -5
- data/lib/ecrire/commands/console.rb +0 -1
- data/lib/ecrire/commands/new.rb +1 -1
- data/lib/ecrire/config/environment.rb +1 -1
- data/lib/ecrire/onboarding/controllers/databases_controller.rb +63 -0
- data/lib/ecrire/{app → onboarding}/controllers/onboarding_controller.rb +2 -0
- data/lib/ecrire/onboarding/controllers/users_controller.rb +30 -0
- data/lib/ecrire/onboarding/engine.rb +73 -0
- data/lib/ecrire/onboarding/routes.rb +8 -0
- data/lib/ecrire/onboarding/views/{onboarding/databases → databases}/index.html.erb +1 -1
- data/lib/ecrire/onboarding/views/onboarding/welcome.html.erb +1 -1
- data/lib/ecrire/onboarding/views/{onboarding/users → users}/index.html.erb +1 -1
- data/lib/ecrire/routes.rb +29 -0
- data/lib/ecrire/theme/engine.rb +66 -0
- data/lib/ecrire/{template → theme/template}/Gemfile +2 -2
- data/lib/ecrire/{template → theme/template}/assets/stylesheets/code.css.scss +1 -0
- data/lib/ecrire/theme/template/controllers/posts_controller.rb +2 -0
- data/lib/ecrire/theme/template/routes.rb +14 -0
- data/lib/ecrire/{template → theme/template}/views/layouts/application.html.erb +1 -1
- data/lib/ecrire/version.rb +1 -1
- data/test/editor/controllers/sessions_controller_test.rb +5 -2
- data/test/editor/helpers/base_helper_test.rb +2 -0
- data/test/editor/models/image_test.rb +1 -0
- data/test/editor/models/post_test.rb +1 -0
- data/test/editor/models/title_test.rb +1 -1
- data/test/editor/models/user_test.rb +1 -0
- data/test/editor/test_helper.rb +25 -21
- data/test/editor/theme/routes.rb +8 -0
- data/test/{themes/template → editor/theme}/secrets.yml +2 -0
- data/test/initializations/{railtie_test.rb → engine_test.rb} +6 -8
- data/test/onboarding/controllers/databases_controller_test.rb +4 -0
- data/test/{editor/controllers/base_controller_test.rb → test_controller.rb} +9 -8
- data/test/test_helper.rb +31 -0
- data/test/test_task.rb +28 -0
- metadata +55 -54
- data/lib/ecrire/app/controllers/onboarding/databases_controller.rb +0 -67
- data/lib/ecrire/app/controllers/onboarding/users_controller.rb +0 -32
- data/lib/ecrire/config/onboarding_routes.rb +0 -11
- data/lib/ecrire/config/routes.rb +0 -32
- data/lib/ecrire/railtie/onboarding.rb +0 -63
- data/lib/ecrire/railtie/theme.rb +0 -69
- data/lib/ecrire/railtie.rb +0 -30
- data/lib/ecrire/tasks/routes.rake +0 -6
- data/lib/ecrire/template/controllers/posts_controller.rb +0 -2
- data/test/isolation.rb +0 -16
- data/test/themes/onboarding/.keep +0 -0
- /data/lib/ecrire/{template → theme/template}/Procfile +0 -0
- /data/lib/ecrire/{template → theme/template}/Rakefile +0 -0
- /data/lib/ecrire/{app/controllers/concerns → theme/template/assets/images}/.keep +0 -0
- /data/lib/ecrire/{template → theme/template}/assets/javascripts/base.js.coffee +0 -0
- /data/lib/ecrire/{template → theme/template}/assets/stylesheets/base.css.scss +0 -0
- /data/lib/ecrire/{template → theme/template}/assets/stylesheets/footer.css.scss +0 -0
- /data/lib/ecrire/{template → theme/template}/assets/stylesheets/header.css.scss +0 -0
- /data/lib/ecrire/{template → theme/template}/assets/stylesheets/home.css.scss +0 -0
- /data/lib/ecrire/{template → theme/template}/config.ru +0 -0
- /data/lib/ecrire/{template → theme/template}/helpers/blog_helper.rb +0 -0
- /data/lib/ecrire/{template → theme/template}/views/posts/_post.html.erb +0 -0
- /data/lib/ecrire/{template → theme/template}/views/posts/index.html.erb +0 -0
- /data/lib/ecrire/{template → theme/template}/views/posts/show.html.erb +0 -0
- /data/lib/ecrire/{template → theme/template}/views/static/about.html +0 -0
- /data/lib/ecrire/{template → theme/template}/views/static/customize/_helper.html +0 -0
- /data/lib/ecrire/{template → theme/template}/views/static/customize/_helper_used.html +0 -0
- /data/lib/ecrire/{template → theme/template}/views/static/customize/_image.html +0 -0
- /data/lib/ecrire/{template → theme/template}/views/static/customize/_index.html +0 -0
- /data/lib/ecrire/{template → theme/template}/views/static/customize/_javascript.html +0 -0
- /data/lib/ecrire/{template → theme/template}/views/static/customize/_layout.html.erb +0 -0
- /data/lib/ecrire/{template → theme/template}/views/static/customize/_post.html +0 -0
- /data/lib/ecrire/{template → theme/template}/views/static/customize.html +0 -0
- /data/test/{themes/template → editor/theme}/Gemfile +0 -0
- /data/test/{themes/template → editor/theme}/assets/javascripts/blog.js.coffee +0 -0
- /data/test/{themes/template → editor/theme}/assets/javascripts/post.js.coffee +0 -0
- /data/test/{themes/template → editor/theme}/assets/stylesheets/blog.css.scss +0 -0
- /data/test/{themes/template → editor/theme}/assets/stylesheets/post.css.scss +0 -0
- /data/test/{themes/template → editor/theme}/config.ru +0 -0
- /data/test/{themes/template → editor/theme}/views/layouts/application.html.erb +0 -0
- /data/test/{themes/template → editor/theme}/views/posts/index.html.erb +0 -0
- /data/{lib/ecrire/template/assets/images → test/onboarding/theme}/.keep +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5491fb6276085642111510a2bf4885d7ccd4402c
|
4
|
+
data.tar.gz: b85b3e9c8f2bc19192fa81af08d19f528b2e742d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ae319240cb15d7bc70b16ef3492e5c7ff32f099c97c203a1fd6199ac4f715166d521a2e625d10b08560a6db3893936a8b1bebca7bb31f67c85dd494051c8862
|
7
|
+
data.tar.gz: e312c1b38f18775a2edd4472d5433576a217c7268461aa21fe7a89ae27fd7a327579f14396cb0f4d7e1432dd11b9ae8849544e898e2ce93017394dc8f8cd4fe6
|
data/Rakefile
CHANGED
@@ -2,71 +2,39 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
2
2
|
|
3
3
|
ENV['RAILS_ENV'] ||= 'test'
|
4
4
|
|
5
|
-
require 'rake/testtask'
|
6
5
|
require 'ecrire'
|
6
|
+
require_relative 'test/test_task'
|
7
7
|
|
8
8
|
task default: :test
|
9
9
|
|
10
10
|
namespace :database do
|
11
11
|
|
12
|
-
task initialize: %w(configure) do
|
13
|
-
|
14
|
-
begin
|
15
|
-
# ActiveRecord's configuration assignation is done at the same time as the connection is tried
|
16
|
-
# If it fails, the configurations aren't set in AR::Base.
|
17
|
-
# This is why this is set here
|
18
|
-
ActiveRecord::Base.configurations = Rails.application.config.database_configuration
|
19
|
-
|
20
|
-
path = Rails.application.paths['db/migrate'].existent
|
21
|
-
ActiveRecord::Migrator.migrations_paths = path
|
22
|
-
if ActiveRecord::Migrator.needs_migration?
|
23
|
-
ActiveRecord::Migrator.migrate(path)
|
24
|
-
end
|
25
|
-
rescue ActiveRecord::NoDatabaseError
|
26
|
-
puts 'Database does not exist. Creating...'
|
27
|
-
ActiveRecord::Tasks::DatabaseTasks.create_current
|
28
|
-
puts 'Database created, migrating now...'
|
29
|
-
ActiveRecord::Migrator.migrate(path)
|
30
|
-
puts "Migration completed."
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
task :configure do
|
35
|
-
Dir.chdir Dir.pwd + '/test/themes/template' do
|
36
|
-
Ecrire::Application.initialize!
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
12
|
task :purge do
|
41
13
|
[User, Post, Image, Partial, Title].each(&:delete_all)
|
42
14
|
end
|
43
15
|
|
44
16
|
end
|
45
17
|
|
46
|
-
desc 'Configure postgres and run all tests'
|
47
|
-
|
48
|
-
task :test do
|
49
|
-
%w(test:initializations test:editor test:themes).each do |name|
|
50
|
-
Rake::Task[name].invoke
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
18
|
namespace :test do
|
55
|
-
|
56
|
-
|
57
|
-
|
19
|
+
['editor', 'onboarding'].each do |name|
|
20
|
+
task = Ecrire::TestTask.new(name) do |t|
|
21
|
+
t.theme = Dir.pwd + "/test/#{name}/theme"
|
58
22
|
t.libs << "test"
|
59
23
|
t.test_files = FileList["test/#{name}/**/*_test.rb"]
|
60
|
-
t.verbose =
|
61
|
-
Rake::Task['database:initialize'].invoke
|
24
|
+
t.verbose = true
|
62
25
|
end
|
26
|
+
end
|
63
27
|
|
64
|
-
|
65
|
-
|
66
|
-
|
28
|
+
end
|
29
|
+
|
30
|
+
task :test do
|
31
|
+
%w(test:editor test:onboarding).each do |name|
|
32
|
+
Rake::Task[name].invoke
|
67
33
|
end
|
68
34
|
end
|
69
35
|
|
70
36
|
at_exit do
|
71
|
-
|
37
|
+
unless Ecrire::Application.onboarding?
|
38
|
+
Rake::Task['database:purge'].invoke
|
39
|
+
end
|
72
40
|
end
|
data/lib/ecrire/application.rb
CHANGED
@@ -7,12 +7,33 @@ require 'observejs'
|
|
7
7
|
module Ecrire
|
8
8
|
class Application < Rails::Application
|
9
9
|
require 'ecrire/config/environment'
|
10
|
-
require 'ecrire/railtie'
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
alias :require_environment! :initialize!
|
12
|
+
|
13
|
+
initializer 'ecrire.secrets', before: :bootstrap_hook do |app|
|
14
|
+
app.paths.add 'config/secrets', with: Dir.pwd + '/secrets.yml'
|
15
|
+
end
|
16
|
+
|
17
|
+
Rails.application.paths.add 'config/database', with: Dir.pwd + '/secrets.yml'
|
18
|
+
|
19
|
+
if File.exist?(Dir.pwd + '/secrets.yml')
|
20
|
+
require 'ecrire/theme/engine'
|
21
|
+
else
|
22
|
+
require 'ecrire/onboarding/engine'
|
23
|
+
end
|
24
|
+
|
25
|
+
def paths
|
26
|
+
@paths ||= begin
|
27
|
+
paths = super
|
28
|
+
paths.add 'config/routes.rb', with: 'routes.rb'
|
29
|
+
paths.add 'config/locales', with: 'locales', glob: "*.{rb,yml}"
|
30
|
+
paths
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.onboarding?
|
35
|
+
defined?(Ecrire::Onboarding::Engine)
|
36
|
+
end
|
16
37
|
|
17
38
|
end
|
18
39
|
end
|
data/lib/ecrire/commands/new.rb
CHANGED
@@ -0,0 +1,63 @@
|
|
1
|
+
class DatabasesController < OnboardingController
|
2
|
+
|
3
|
+
helper_method :user, :password, :database
|
4
|
+
|
5
|
+
def index; end;
|
6
|
+
|
7
|
+
def create
|
8
|
+
info ||= {
|
9
|
+
'adapter' => 'postgresql',
|
10
|
+
'database' => database,
|
11
|
+
'user' => user,
|
12
|
+
'password' => password,
|
13
|
+
'encoding' => 'utf8'
|
14
|
+
}
|
15
|
+
begin
|
16
|
+
ActiveRecord::Base.configurations = {
|
17
|
+
'development' => info,
|
18
|
+
'production' => info
|
19
|
+
}
|
20
|
+
ActiveRecord::Base.establish_connection
|
21
|
+
ActiveRecord::Base.connection
|
22
|
+
migrate!
|
23
|
+
rescue Exception => e
|
24
|
+
@exception = e
|
25
|
+
ActiveRecord::Base.clear_all_connections!
|
26
|
+
render 'index' and return
|
27
|
+
end
|
28
|
+
|
29
|
+
redirect_to :users
|
30
|
+
end
|
31
|
+
|
32
|
+
protected
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def migrate!
|
37
|
+
ActiveRecord::Tasks::DatabaseTasks.database_configuration = ActiveRecord::Base.configurations
|
38
|
+
ActiveRecord::Migrator.migrations_paths = ActiveRecord::Tasks::DatabaseTasks.migrations_paths
|
39
|
+
ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
|
40
|
+
ActiveRecord::Migrator.migrate(ActiveRecord::Migrator.migrations_paths, ENV["VERSION"] ? ENV["VERSION"].to_i : nil) do |migration|
|
41
|
+
ENV["SCOPE"].blank? || (ENV["SCOPE"] == migration.scope)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def db_params
|
46
|
+
params.fetch(:database, {})
|
47
|
+
end
|
48
|
+
|
49
|
+
def user
|
50
|
+
@user ||= "ecrire#{SecureRandom.hex(2)}"
|
51
|
+
db_params.fetch(:user, @user)
|
52
|
+
end
|
53
|
+
|
54
|
+
def password
|
55
|
+
@password ||= SecureRandom.hex(16)
|
56
|
+
db_params.fetch(:password, @password)
|
57
|
+
end
|
58
|
+
|
59
|
+
def database
|
60
|
+
@database ||= "ecrire"
|
61
|
+
db_params.fetch(:name, @database)
|
62
|
+
end
|
63
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
class OnboardingController < ApplicationController
|
2
|
+
include Ecrire::Onboarding::Engine.routes.url_helpers
|
2
3
|
|
3
4
|
def index
|
4
5
|
if File.exist?(Rails.application.paths['config/secrets'].expanded.last)
|
@@ -18,3 +19,4 @@ class OnboardingController < ApplicationController
|
|
18
19
|
end
|
19
20
|
|
20
21
|
end
|
22
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class UsersController < OnboardingController
|
2
|
+
|
3
|
+
helper_method :user
|
4
|
+
|
5
|
+
def index;end;
|
6
|
+
|
7
|
+
def create
|
8
|
+
@user = User.find_or_initialize_by(email: user_params[:email])
|
9
|
+
@user.update(user_params)
|
10
|
+
|
11
|
+
if user.errors.blank?
|
12
|
+
save_configurations!
|
13
|
+
redirect_to :root
|
14
|
+
else
|
15
|
+
render 'index'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
protected
|
20
|
+
|
21
|
+
|
22
|
+
def user_params
|
23
|
+
params.require(:user).permit(:email, :password, :password_confirmation)
|
24
|
+
end
|
25
|
+
|
26
|
+
def user
|
27
|
+
@user ||= User.new
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module Ecrire
|
2
|
+
module Onboarding
|
3
|
+
class Engine < Rails::Engine
|
4
|
+
|
5
|
+
Rails.application.config.active_record.migration_error = :none
|
6
|
+
ActiveRecord::Base.configurations = {}
|
7
|
+
|
8
|
+
initializer 'ecrire.onboarding.dynamic_settings' do |app|
|
9
|
+
app.config.secret_key_base = SecureRandom.hex(16)
|
10
|
+
end
|
11
|
+
|
12
|
+
initializer 'ecrire.load_paths', before: :bootstrap_hook do |app|
|
13
|
+
ActiveSupport::Dependencies.autoload_paths.unshift(*self.paths.autoload_paths)
|
14
|
+
ActiveSupport::Dependencies.autoload_once_paths.unshift(*self.paths.autoload_once)
|
15
|
+
end
|
16
|
+
|
17
|
+
initializer 'ecrire.append_paths', before: :set_autoload_paths do |app|
|
18
|
+
app.config.eager_load_paths.unshift *paths.eager_load
|
19
|
+
app.config.autoload_once_paths.unshift *paths.autoload_once
|
20
|
+
app.config.autoload_paths.unshift *paths.autoload_paths
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def paths
|
25
|
+
@paths ||= begin
|
26
|
+
paths = Rails::Paths::Root.new(root_path)
|
27
|
+
paths.add 'config/routes.rb', with: 'routes.rb'
|
28
|
+
paths.add 'app/views', with: 'views'
|
29
|
+
paths.add 'app/controllers', with: 'controllers', eager_load: true
|
30
|
+
paths.add 'app/assets', with: 'assets', glob: '*'
|
31
|
+
paths.add 'app/helpers', with: 'helpers', eager_load: true
|
32
|
+
|
33
|
+
paths.add 'config/routes.rb', with: 'routes.rb'
|
34
|
+
paths.add 'config/locales', with: 'locales', glob: '**/*.{rb,yml}'
|
35
|
+
paths.add 'config/environments', with: 'environments', glob: "#{Rails.env}.rb"
|
36
|
+
|
37
|
+
paths.add 'public', with: 'tmp/public'
|
38
|
+
|
39
|
+
paths.add "lib/assets", glob: "*"
|
40
|
+
paths.add "vendor/assets", glob: "*"
|
41
|
+
paths.add "lib/tasks"
|
42
|
+
paths
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def has_migrations?
|
47
|
+
false
|
48
|
+
end
|
49
|
+
|
50
|
+
def root_path
|
51
|
+
Pathname.new(__FILE__).dirname
|
52
|
+
end
|
53
|
+
|
54
|
+
# This hack is done because ActiveRecord raise an error that makes
|
55
|
+
# Ecrire exit which makes it impossible to have an instance working without a
|
56
|
+
# database. By doing this, it becomes possible to Ecrire to load the server and
|
57
|
+
# serve the onboarding theme for the user.
|
58
|
+
ActiveRecord::Railtie.initializers.select do |initializer|
|
59
|
+
initializer.name.eql? 'active_record.initialize_database'
|
60
|
+
end.first.instance_variable_set :@block, Proc.new { |app|
|
61
|
+
ActiveSupport.on_load(:active_record) do
|
62
|
+
begin
|
63
|
+
establish_connection
|
64
|
+
rescue ActiveRecord::NoDatabaseError, ActiveRecord::AdapterNotSpecified => e
|
65
|
+
app.config.middleware.delete 'ActiveRecord::QueryCache'
|
66
|
+
app.config.middleware.delete 'ActiveRecord::ConnectionAdapters::ConnectionManagement'
|
67
|
+
end
|
68
|
+
end
|
69
|
+
}
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<section>
|
3
3
|
<h2>Create a user</h2>
|
4
4
|
|
5
|
-
<%= form_for
|
5
|
+
<%= form_for user, method: :post do |f| %>
|
6
6
|
<% if user.errors.any? %>
|
7
7
|
<%= content_tag :div, class: %w(error), as: 'Message' do %>
|
8
8
|
<%= content_tag :p, user.errors.full_messages.first %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Ecrire::Application.routes.draw do
|
2
|
+
|
3
|
+
if defined?(Ecrire::Theme::Engine)
|
4
|
+
resource :session, only: [:new, :create, :destroy]
|
5
|
+
|
6
|
+
namespace :admin do
|
7
|
+
root 'posts#index'
|
8
|
+
resources :posts do
|
9
|
+
collection do
|
10
|
+
get 'help', controller: :posts, action: :help
|
11
|
+
end
|
12
|
+
resources :tags, only: [:index, :create, :update], module: 'posts'
|
13
|
+
resources :titles, shallow: true
|
14
|
+
resource :image, shallow: true
|
15
|
+
resource :properties, only: [:create, :destroy]
|
16
|
+
end
|
17
|
+
|
18
|
+
namespace :configurations do
|
19
|
+
resource :images, only: [:show, :create]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
mount Ecrire::Theme::Engine => '/', as: 'theme'
|
24
|
+
else
|
25
|
+
mount Ecrire::Onboarding::Engine => '/'
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Ecrire
|
2
|
+
module Theme
|
3
|
+
class Engine < Rails::Engine
|
4
|
+
|
5
|
+
initializer 'ecrire.logs', before: :initialize_logger do |app|
|
6
|
+
unless Rails.env.test?
|
7
|
+
app.paths.add "log", with: "log/#{Rails.env}.log"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
initializer 'ecrire.load_paths', before: :bootstrap_hook do |app|
|
12
|
+
ActiveSupport::Dependencies.autoload_paths.unshift(*self.paths.autoload_paths)
|
13
|
+
ActiveSupport::Dependencies.autoload_once_paths.unshift(*self.paths.autoload_once)
|
14
|
+
end
|
15
|
+
|
16
|
+
initializer 'ecrire.append_paths', before: :set_autoload_paths do |app|
|
17
|
+
app.config.eager_load_paths.unshift *paths.eager_load
|
18
|
+
app.config.autoload_once_paths.unshift *paths.autoload_once
|
19
|
+
app.config.autoload_paths.unshift *paths.autoload_paths
|
20
|
+
end
|
21
|
+
|
22
|
+
def paths
|
23
|
+
@paths ||= begin
|
24
|
+
paths = Rails::Paths::Root.new(root_path)
|
25
|
+
paths.add 'app/views', with: 'views'
|
26
|
+
paths.add 'app/controllers', with: 'controllers', eager_load: true
|
27
|
+
paths.add 'app/assets', with: 'assets', glob: '*'
|
28
|
+
paths.add 'app/helpers', with: 'helpers', eager_load: true
|
29
|
+
|
30
|
+
paths.add 'config/routes.rb', with: 'routes.rb'
|
31
|
+
paths.add 'config/locales', with: 'locales', glob: '**/*.{rb,yml}'
|
32
|
+
paths.add 'config/environments', with: 'environments', glob: "#{Rails.env}.rb"
|
33
|
+
|
34
|
+
paths.add 'public', with: 'tmp/public'
|
35
|
+
|
36
|
+
paths.add "lib/assets", glob: "*"
|
37
|
+
paths.add "vendor/assets", glob: "*"
|
38
|
+
paths.add "lib/tasks"
|
39
|
+
|
40
|
+
paths
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def has_migrations?
|
45
|
+
false
|
46
|
+
end
|
47
|
+
|
48
|
+
def root_path(file = 'config.ru')
|
49
|
+
begin
|
50
|
+
pathname = Pathname.pwd
|
51
|
+
|
52
|
+
while !(pathname + file).exist? do
|
53
|
+
pathname = pathname.parent
|
54
|
+
if pathname.root?
|
55
|
+
raise "Could not find #{file}. Type 'ecrire new blog_name' to create a new blog"
|
56
|
+
break
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
pathname
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -4,7 +4,7 @@ gem 'ecrire', path: '~/Develop/ecrire'
|
|
4
4
|
|
5
5
|
group :required do
|
6
6
|
gem 'rails', '~> 4.2'
|
7
|
-
gem 'observejs', '
|
7
|
+
gem 'observejs', git: 'https://github.com/pothibo/observejs'
|
8
8
|
gem 'warden', '~> 1.2'
|
9
9
|
gem 'bcrypt', '~> 3.1'
|
10
10
|
gem 'nokogiri', '~> 1.6'
|
@@ -19,7 +19,7 @@ group :required do
|
|
19
19
|
gem 'turbolinks', '~> 2.2'
|
20
20
|
gem 'bourbon', '~> 3.2'
|
21
21
|
gem 'uglifier', '~> 2.5'
|
22
|
-
gem 'jbuilder'
|
22
|
+
gem 'jbuilder', '~> 2.2'
|
23
23
|
end
|
24
24
|
|
25
25
|
group :server do
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Ecrire::Theme::Engine.routes.draw do
|
2
|
+
root 'posts#index'
|
3
|
+
|
4
|
+
get '/:year/:month/:id', controller: :posts, action: :show, constraints: { year: /\d+/, month: /\d+/ }, as: "post"
|
5
|
+
get '/feed', controller: :posts, action: :index, defaults: { format: :rss }
|
6
|
+
|
7
|
+
resources :posts, only: [:index]
|
8
|
+
|
9
|
+
resources :tags
|
10
|
+
|
11
|
+
get '/:view', to: 'static#show'
|
12
|
+
|
13
|
+
end
|
14
|
+
|
data/lib/ecrire/version.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
|
1
|
+
require 'test_controller'
|
2
|
+
require 'editor/test_helper'
|
3
|
+
|
4
|
+
class SessionsControllerTest < TestController
|
2
5
|
test 'should be able to log in' do
|
3
6
|
post :create, session: {email: "pothibo@gmail.com", password: "123456789"}
|
4
7
|
assert !proxy.user.nil?, "#{users(:pothibo).email} should be logged in"
|
5
|
-
assert_redirected_to
|
8
|
+
assert_redirected_to '/'
|
6
9
|
end
|
7
10
|
|
8
11
|
|