eucalypt 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 419ec8d7308501fc42963e6cd81b193bdf527246286a85c0611b2a1bcd7bc6a3
4
- data.tar.gz: f1a6de0bbd6d6df1083a686ac9c641d37723fd1f59620ae40b0e327c89742849
3
+ metadata.gz: 54fd8995c7242de470b93565d009d8cb1d060c803f028a4ee31002189bd09dbe
4
+ data.tar.gz: 20caf73b8bef6a241689ccc6b17a4a575cebe8d98d3f29f03d33d441d03c5bf1
5
5
  SHA512:
6
- metadata.gz: f25b0fba832f8f1afc6c19ad21ba140acb08ba419f0e78c238b89dab606885184a9f26ff486d35fa8009eeedadaf87f34ec681fbadcb2964228d2d1d754dc3ae
7
- data.tar.gz: 3e0ba7c329b06870f210520d389d878b86c8d34f82554cc2ee73a32719638af3a2ad58e93da09642ee91dce96c80664cd26197852c120c6c565548935185a305
6
+ metadata.gz: a84f7047d5a21dab87c48f69d32bb9b162b732b84006b35ad4ccb25f7a63587d2a96ebd4c03186641890985dee9dc067f16e72b1d9b469f992599bd6ba8e9f74
7
+ data.tar.gz: 36ce133a9c5535c3ff90352de8167846c731d79c5e4c03afd03c9b1629f5ed3cdf4d3e67904a0cf24fb3850ce061dcaee28524bca5f4c9bf4cc9bbe667f4d5b2
data/eucalypt.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_runtime_dependency "activerecord", "~> 5.2"
30
30
  spec.add_runtime_dependency "front_matter_parser", "0.2.0"
31
31
  spec.add_runtime_dependency "thor", "~> 0.20"
32
- spec.add_runtime_dependency "sinatra", "~> 2.0"
32
+ spec.add_runtime_dependency "sinatra", "~> 2.0", ">= 2.0.4"
33
33
  spec.add_runtime_dependency "rerun", "~> 0.13"
34
34
 
35
35
  spec.metadata = {
@@ -4,7 +4,7 @@ module Eucalypt
4
4
  module Generators
5
5
  class Blog < Thor::Group
6
6
  def views
7
- config = {erb: ["<%= application :css, :js %>","<%= yield %>"]}
7
+ config = {erb: ["<%= manifest :stylesheet, :script %>","<%= yield %>"]}
8
8
  template File.join('views','article_layout.erb'), File.join('app','views','layouts','blog','article.erb'), config
9
9
  template File.join('views','articles_layout.erb'), File.join('app','views','layouts','blog','articles.erb'), config
10
10
 
@@ -3,4 +3,5 @@ require_relative 'launch'
3
3
  require_relative 'console'
4
4
  require_relative 'test'
5
5
  require_relative 'version'
6
- require_relative 'help'
6
+ require_relative 'help'
7
+ require_relative 'rake'
@@ -0,0 +1,15 @@
1
+ require_relative '__base__'
2
+ module Eucalypt
3
+ class CLI < Thor
4
+ using Colorize
5
+ desc "rake", "Run all database migrations".colorize(:grey)
6
+ def rake
7
+ directory = File.expand_path('.')
8
+ if Eucalypt.app? directory
9
+ exec "bundle exec rake db:migrate"
10
+ else
11
+ Eucalypt::Error.wrong_directory
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ require 'sinatra'
2
+ class ApplicationController < Sinatra::Base
3
+ # Application manifest file accessor method
4
+ helpers do
5
+ def manifest(*args)
6
+ html = String.new
7
+ args.map(&:to_sym).each do |arg|
8
+ html << %{<link href="/assets/application.css" type="text/css" rel="stylesheet">} if arg == :stylesheet
9
+ html << %{<script src="/assets/application.js" type="text/javascript"></script>} if arg == :script
10
+ end
11
+ html
12
+ rescue
13
+ raise ArgumentError.new "Expected arguments to be any of: [stylesheet, script]"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,8 @@
1
+ require 'sinatra'
2
+ class ApplicationController < Sinatra::Base
3
+ helpers do
4
+ def partial(template, **locals)
5
+ erb template.to_sym, layout: false, locals: locals
6
+ end
7
+ end
8
+ end
@@ -1,14 +1,9 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Bundler
4
3
  gem 'bundler', '~> 1.16'
5
- # Sinatra DSL
6
- gem 'sinatra', '~> 2.0', require: 'sinatra/base'
7
- # Eucalypt CLI
4
+ gem 'sinatra', '~> 2.0', '>= 2.0.4', require: 'sinatra/base'
8
5
  gem 'eucalypt', '<%= config[:version] %>'
9
- # Rake
10
6
  gem 'rake', '~> 12.3'
11
- # Server
12
7
  gem 'thin', '~> 1.7'
13
8
 
14
9
  # Test environment
@@ -3,8 +3,8 @@
3
3
  * All of these Javascript files will be compiled into a single Javascript file. *
4
4
  * To use this combined file, include the following in the head section of your views: *
5
5
  * *
6
- * <%= application :js %> If including only application.js *
7
- * <%= application :css, :js %> If including application.css as well *
6
+ * <%= manifest :script %> If including only application.js *
7
+ * <%= manifest :stylesheet, :script %> If including application.css as well *
8
8
  * *
9
9
  * By default, every file in the /assets/scripts directory is required by `require_tree .` *
10
10
  * However, you may remove the `require_tree .` directive and instead specify individual files. *
@@ -3,8 +3,8 @@
3
3
  * All of these stylesheet files will be compiled into a single stylesheet. *
4
4
  * To use this combined stylesheet, include the following in the head section of your views: *
5
5
  * *
6
- * <%= application :css %> If including only application.css *
7
- * <%= application :css, :js %> If including application.js as well *
6
+ * <%= manifest :stylesheet %> If including only application.css *
7
+ * <%= manifest :stylesheet, :script %> If including application.js as well *
8
8
  * *
9
9
  * By default, every file in the /assets/stylesheets directory is required by `require_tree .` *
10
10
  * However, you may remove the `require_tree .` directive and instead specify individual files. *
@@ -1,7 +1,7 @@
1
1
  <html>
2
2
  <head>
3
3
  <title></title>
4
- <%= application :css, :js %>
4
+ <%= manifest :stylesheet, :script %>
5
5
  </head>
6
6
  <body>
7
7
  <%= yield %>
@@ -1,5 +1,7 @@
1
1
  require 'bundler'
2
- Bundler.require :default
2
+ require 'active_support/core_ext/hash'
3
+ require 'sinatra'
4
+ Bundler.require :default, settings.environment
3
5
  Eucalypt.set_root __dir__
4
6
 
5
7
  Static = Eucalypt::Static.new(Eucalypt.path('app', 'static'), symbolize: true).freeze
@@ -1,7 +1,9 @@
1
+ require 'fileutils'
1
2
  class ApplicationController < Sinatra::Base
2
3
  set :logger, Lumberjack::Logger.new
4
+ helpers { def logger() settings.logger end }
3
5
 
4
- require 'fileutils'
6
+ #= General logging =#
5
7
  %i[production test].each do |e|
6
8
  configure e do
7
9
  use Rack::CommonLogger, $stdout
@@ -9,19 +11,14 @@ class ApplicationController < Sinatra::Base
9
11
  log_path = Eucalypt.path 'log', Time.now.strftime("%Y-%m-%dT%H-%M-%S_%z").sub(/_\+/, ?p).sub(/_\-/, ?m)
10
12
  FileUtils.mkdir_p log_path
11
13
 
12
- # STDERR logger
13
14
  $stderr.reopen File.new(File.join(log_path, "#{e}.stderr.log"), 'a+')
14
15
  $stderr.sync = true
15
-
16
- # STDOUT logger
17
16
  $stdout.reopen File.new(File.join(log_path, "#{e}.stdout.log"), 'a+')
18
17
  $stdout.sync = true
19
18
  end
20
19
  end
21
20
 
22
- helpers do
23
- def logger
24
- settings.logger
25
- end
26
- end
21
+ #= ActiveRecord logging =#
22
+ ActiveRecord::Base.logger = Logger.new STDOUT
23
+ ActiveRecord::Migration.verbose = true # Set to false for quieter logging
27
24
  end
@@ -64,7 +64,7 @@ module Eucalypt
64
64
  inject_into_file(user_model_file, insert, before: /^end/) unless contents.include? insert
65
65
  end
66
66
 
67
- Out.info "Ensure you run `#{'rake db:migrate'.colorize(:bold)}` to create the necessary tables for Pundit."
67
+ Out.info "Ensure you run `#{'eucalypt rake'.colorize(:bold)}` to create the necessary tables for Pundit."
68
68
  else
69
69
  Eucalypt::Error.wrong_directory
70
70
  end
@@ -64,7 +64,7 @@ module Eucalypt
64
64
  auth_controller.generate
65
65
  end
66
66
 
67
- Out.info "Ensure you run `#{'rake db:migrate'.colorize(:bold)}` to create the necessary tables for Warden."
67
+ Out.info "Ensure you run `#{'eucalypt rake'.colorize(:bold)}` to create the necessary tables for Warden."
68
68
  else
69
69
  Eucalypt::Error.wrong_directory
70
70
  end
@@ -1,3 +1,3 @@
1
1
  module Eucalypt
2
- VERSION = '0.3.2'
2
+ VERSION = '0.3.3'
3
3
  end
data/lib/eucalypt.rb CHANGED
@@ -10,5 +10,7 @@ require 'eucalypt/controller'
10
10
  require 'eucalypt/app'
11
11
  require 'eucalypt/root'
12
12
  require 'eucalypt/list'
13
+ require 'eucalypt/core/helpers/manifest'
14
+ require 'eucalypt/core/helpers/partial'
13
15
 
14
16
  Eucalypt::CLI.extend Eucalypt::List
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.3.2
4
+ version: 0.3.3
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-09-05 00:00:00.000000000 Z
11
+ date: 2018-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -157,6 +157,9 @@ dependencies:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
159
  version: '2.0'
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: 2.0.4
160
163
  type: :runtime
161
164
  prerelease: false
162
165
  version_requirements: !ruby/object:Gem::Requirement
@@ -164,6 +167,9 @@ dependencies:
164
167
  - - "~>"
165
168
  - !ruby/object:Gem::Version
166
169
  version: '2.0'
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: 2.0.4
167
173
  - !ruby/object:Gem::Dependency
168
174
  name: rerun
169
175
  requirement: !ruby/object:Gem::Requirement
@@ -224,8 +230,11 @@ files:
224
230
  - lib/eucalypt/core/cli/help.rb
225
231
  - lib/eucalypt/core/cli/init.rb
226
232
  - lib/eucalypt/core/cli/launch.rb
233
+ - lib/eucalypt/core/cli/rake.rb
227
234
  - lib/eucalypt/core/cli/test.rb
228
235
  - lib/eucalypt/core/cli/version.rb
236
+ - lib/eucalypt/core/helpers/manifest.rb
237
+ - lib/eucalypt/core/helpers/partial.rb
229
238
  - lib/eucalypt/core/templates/Gemfile.tt
230
239
  - lib/eucalypt/core/templates/eucalypt/.gitignore
231
240
  - lib/eucalypt/core/templates/eucalypt/.travis.yml
@@ -246,12 +255,10 @@ files:
246
255
  - lib/eucalypt/core/templates/eucalypt/app/views/layouts/main.erb
247
256
  - lib/eucalypt/core/templates/eucalypt/app/views/partials/.empty_directory
248
257
  - lib/eucalypt/core/templates/eucalypt/config.ru
249
- - lib/eucalypt/core/templates/eucalypt/config/active_record.rb
250
258
  - lib/eucalypt/core/templates/eucalypt/config/asset_pipeline.rb
251
259
  - lib/eucalypt/core/templates/eucalypt/config/database.yml
252
260
  - lib/eucalypt/core/templates/eucalypt/config/initializers/.empty_directory
253
261
  - lib/eucalypt/core/templates/eucalypt/config/logging.rb
254
- - lib/eucalypt/core/templates/eucalypt/config/manifest.rb
255
262
  - lib/eucalypt/core/templates/eucalypt/log/.empty_directory
256
263
  - lib/eucalypt/core/templates/eucalypt/spec/controllers/application_controller_spec.rb
257
264
  - lib/eucalypt/core/templates/eucalypt/spec/helpers/application_helper_spec.rb
@@ -367,7 +374,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
367
374
  version: '0'
368
375
  requirements: []
369
376
  rubyforge_project:
370
- rubygems_version: 2.7.7
377
+ rubygems_version: 2.7.6
371
378
  signing_key:
372
379
  specification_version: 4
373
380
  summary: Micro-framework and CLI wrapped around the Sinatra DSL.
@@ -1,5 +0,0 @@
1
- class ApplicationController < Sinatra::Base
2
- # Comment or remove the below lines for no logging
3
- ActiveRecord::Base.logger = Logger.new STDOUT
4
- ActiveRecord::Migration.verbose = true
5
- end
@@ -1,15 +0,0 @@
1
- class ApplicationController < Sinatra::Base
2
- # Application manifest file accessor method
3
- helpers do
4
- def application(*args)
5
- html = String.new
6
- args.map(&:to_sym).each do |arg|
7
- html << stylesheet('application') if %i[css stylesheet].include? arg
8
- html << javascript('application') if %i[js javascript].include? arg
9
- end
10
- html
11
- rescue
12
- raise ArgumentError.new "Expected arguments to be any of: #{css+js}"
13
- end
14
- end
15
- end