eucalypt 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e520c9680993730a49c3ec87c04f358ea17607420dce59d11b03dbcfb34c67a0
4
- data.tar.gz: d20522c6f917515fe8762a6cdb72608d886fb7a0b1d8913f54b16f07da07d91a
3
+ metadata.gz: 2dd8989666dd4b95e017bc50fcb59257a2d1137239fa285c4c91bdd90e9b15a8
4
+ data.tar.gz: 6758de1df95de41ef8aafdb3c904bbd2c86555b1c9b02ac49d5d0c850e6f7045
5
5
  SHA512:
6
- metadata.gz: 4f68cde88435a9368929ab30006c9248c131fc276286cfd42068b6dc52632feb8b952fefce41da41167c76b1c3c6b545968eb13bf5012c9adb32340d69428e6f
7
- data.tar.gz: af70583560eadded293d15c7cea6f390d75494709d4ece3e6cb57232677eb34a2e7aa634202772c65c18e8cb3057ba253fc643913876bdee8384d590829e6ec1
6
+ metadata.gz: 2d38e7bfe7f9e53011b7fb4955b6509a45f08fdbc52b2294b17838c15f88095415f700d64ab34a7dc4a7f8feb27e68348fad6f4ec4e37d9be725bfd10cfa6708
7
+ data.tar.gz: 3d1a8a905f2beec4298c9c2767bc3b0b688e42becc33f36dc7092f2316ee39a1c6b5623309cde3301cb7e99bc4b18e950d0f00df18f4a10ce4c938123a032a6b
@@ -33,13 +33,13 @@ module Eucalypt
33
33
  asset_pipeline_file = File.join(directory, 'config', 'asset_pipeline.rb')
34
34
 
35
35
  File.open(asset_pipeline_file) do |f|
36
- return if f.read.include? "environment.append_path Eucalypt.path 'app', 'assets', 'blog'"
36
+ return if f.read.include? "assets.append_path Eucalypt.path 'app', 'assets', 'blog'"
37
37
  end
38
38
 
39
39
  insert_into_file(
40
40
  asset_pipeline_file,
41
- "\tenvironment.append_path Eucalypt.path 'app', 'assets', 'blog'\n",
42
- after: "set :environment, Sprockets::Environment.new\n"
41
+ "\tassets.append_path Eucalypt.path 'app', 'assets', 'blog'\n",
42
+ after: "set :assets, Sprockets::Environment.new\n"
43
43
  )
44
44
  else
45
45
  Eucalypt::Error.wrong_directory
@@ -1 +1 @@
1
- web: bundle exec rackup -p $PORT
1
+ web: bundle exec eucalypt launch production -p $PORT
@@ -1,17 +1,6 @@
1
1
  require 'bundler'
2
2
  Bundler.require :default
3
-
4
- Eucalypt::ROOT = __dir__.freeze
5
-
6
- module Eucalypt
7
- class << self
8
- def root() ROOT end
9
- def path(*args) File.join(ROOT, *args) end
10
- def glob(*args, &block) Dir.glob(self.path(*args), &block) end
11
- end
12
- end
13
-
14
- Eucalypt.glob 'config', 'initializers', '*.rb', &method(:require)
3
+ Eucalypt.set_root __dir__
15
4
 
16
5
  Static = Eucalypt::Static.new(Eucalypt.path('app', 'static'), symbolize: true).freeze
17
6
 
@@ -31,12 +20,12 @@ class ApplicationController < Sinatra::Base
31
20
  # Set default ERB template
32
21
  set :erb, layout: :'layouts/main'
33
22
 
34
- # Set Hanami asset helpers
23
+ # Set Hanami HTML and asset helpers
35
24
  helpers Hanami::Helpers, Hanami::Assets::Helpers
36
25
  end
37
26
 
38
- require Eucalypt.path 'config', 'logging'
39
- Eucalypt.glob 'config', '*.rb', &method(:require)
40
- Eucalypt.glob 'app', 'helpers', '{application_helper.rb}', &method(:require)
41
- require Eucalypt.path 'app', 'controllers', 'application_controller'
42
- Eucalypt.glob 'app', '{models,policies,helpers,controllers}', '*.rb', &method(:require)
27
+ Eucalypt.require 'config', '*.rb'
28
+ Eucalypt.require 'config', 'initializers', '*.rb'
29
+ Eucalypt.require 'app', 'helpers', '{application_helper.rb}'
30
+ Eucalypt.require 'app', 'controllers', 'application_controller.rb'
31
+ Eucalypt.require 'app', '{models,policies,helpers,controllers}', '*.rb'
@@ -1,15 +1,15 @@
1
1
  class ApplicationController < Sinatra::Base
2
- set :environment, Sprockets::Environment.new
3
- environment.append_path Eucalypt.path 'app', 'assets', 'stylesheets'
4
- environment.append_path Eucalypt.path 'app', 'assets', 'scripts'
5
- environment.append_path Eucalypt.path 'app', 'assets', 'images'
6
- environment.append_path Eucalypt.path 'app', 'assets', 'fonts'
2
+ set :assets, Sprockets::Environment.new
3
+ assets.append_path Eucalypt.path 'app', 'assets', 'stylesheets'
4
+ assets.append_path Eucalypt.path 'app', 'assets', 'scripts'
5
+ assets.append_path Eucalypt.path 'app', 'assets', 'images'
6
+ assets.append_path Eucalypt.path 'app', 'assets', 'fonts'
7
7
 
8
- environment.css_compressor = :scss
9
- environment.js_compressor = :uglify
8
+ assets.css_compressor = :scss
9
+ assets.js_compressor = :uglify
10
10
 
11
11
  get '/assets/*' do
12
12
  env["PATH_INFO"].sub! '/assets', ''
13
- settings.environment.call env
13
+ settings.assets.call env
14
14
  end
15
15
  end
@@ -2,21 +2,19 @@ class ApplicationController < Sinatra::Base
2
2
  set :logger, Lumberjack::Logger.new
3
3
 
4
4
  require 'fileutils'
5
- %i[production test].each do |environment|
6
- configure environment do
5
+ %i[production test].each do |e|
6
+ configure e do
7
7
  use Rack::CommonLogger, $stdout
8
8
 
9
9
  log_path = Eucalypt.path 'log', Time.now.strftime("%Y-%m-%dT%H-%M-%S_%z").sub(/_\+/, ?p).sub(/_\-/, ?m)
10
10
  FileUtils.mkdir_p log_path
11
11
 
12
12
  # STDERR logger
13
- stderr_log = File.new File.join(log_path, "#{settings.environment}.stderr.log"), 'a+'
14
- $stderr.reopen stderr_log
13
+ $stderr.reopen File.new(File.join(log_path, "#{e}.stderr.log"), 'a+')
15
14
  $stderr.sync = true
16
15
 
17
16
  # STDOUT logger
18
- stdout_log = File.new File.join(log_path, "#{settings.environment}.stdout.log"), 'a+'
19
- $stdout.reopen stdout_log
17
+ $stdout.reopen File.new(File.join(log_path, "#{e}.stdout.log"), 'a+')
20
18
  $stdout.sync = true
21
19
  end
22
20
  end
@@ -8,7 +8,7 @@ module Eucalypt
8
8
  include Eucalypt::Helpers
9
9
  using Colorize
10
10
  option :name, aliases: '-n', type: :string, desc: "Index name"
11
- desc "index [TABLE] [*COLUMNS]", "Removes an index from a table".colorize(:grey)
11
+ desc "index [TABLE] *[COLUMNS]", "Removes an index from a table".colorize(:grey)
12
12
  def index(table, *columns)
13
13
  directory = File.expand_path('.')
14
14
  if Eucalypt.app? directory
@@ -0,0 +1,21 @@
1
+ module Eucalypt
2
+ def self.set_root(root)
3
+ const_set :ROOT, root.freeze
4
+
5
+ define_singleton_method :root do
6
+ const_get :ROOT
7
+ end
8
+
9
+ define_singleton_method :path do |*args|
10
+ File.join self.root, *args
11
+ end
12
+
13
+ define_singleton_method :glob do |*args, &block|
14
+ Dir.glob self.path(*args), &block
15
+ end
16
+
17
+ define_singleton_method :require do |*args|
18
+ self.glob *args, &Kernel.method(:require)
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module Eucalypt
2
- VERSION = '0.2.0'
3
- end
2
+ VERSION = '0.2.1'
3
+ end
data/lib/eucalypt.rb CHANGED
@@ -8,6 +8,7 @@ require 'eucalypt/eucalypt-migration/namespaces/migration/cli/migration'
8
8
  require 'eucalypt/static'
9
9
  require 'eucalypt/controller'
10
10
  require 'eucalypt/app'
11
+ require 'eucalypt/root'
11
12
 
12
13
  module Eucalypt
13
14
  class CLI < Thor
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eucalypt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edwin Onuonga
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-23 00:00:00.000000000 Z
11
+ date: 2018-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -342,6 +342,7 @@ files:
342
342
  - lib/eucalypt/helpers/migration.rb
343
343
  - lib/eucalypt/helpers/numeric.rb
344
344
  - lib/eucalypt/list.rb
345
+ - lib/eucalypt/root.rb
345
346
  - lib/eucalypt/static.rb
346
347
  - lib/eucalypt/version.rb
347
348
  homepage: https://eucalypt.gitbook.io/eucalypt