inesita 1.0.pre.3 → 1.0.pre.4

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: 98638990e361feeb9db74c66704f3c9da702399193db805ea4a8b66000479d1a
4
- data.tar.gz: c06335212c1197c51e8602b9afd8e229747c2300b37d194787f95b1dd8a5b387
3
+ metadata.gz: a2f188386e1e6e6434dab38c355238b2a5a170bd79d60455c5062c217fd0fb28
4
+ data.tar.gz: 1bf771f5d80d1d6ce11b10d60bf7583a887bb9a0c8f4fd224b74d4349bedd74d
5
5
  SHA512:
6
- metadata.gz: '096ff65d519f71caaf316676fd595dbccacbf93684d7f151f00141688331f0e0be1f015e0f14c9a4759db2a1a1c89e27268adec310b36daad99a0b27948c5d09'
7
- data.tar.gz: e905748b8418f7d999a0a7553e4a448746b33bdd8d33cd964d344714cf1020e5288edec8a632d5ec5eeee9a33b8937f3e0e2bd01c832cd87c4df7f34b2fcd820
6
+ metadata.gz: 4925d863797a030bb3f67482192b83f406906f989a326dc1afc8d3123f697f9d3c4ed58cfedb9dbb88b677e3625458855d333fb22b168a2bfbd1975c4a0ebc97
7
+ data.tar.gz: b950726eb8e27b371585b32f12f7dfa3c666a7cf607dfdab497d2960aaafeafdc3f845429b0bb3f5a7c816fbe4431f8c418ebd396164a8c40c2d953bc52a1d1a
data/inesita.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'inesita'
3
- s.version = '1.0.pre.3'
3
+ s.version = '1.0.pre.4'
4
4
  s.authors = ['Michał Kalbarczyk']
5
5
  s.email = 'fazibear@gmail.com'
6
6
  s.homepage = 'http://github.com/inesita-rb/inesita'
@@ -18,8 +18,6 @@ Gem::Specification.new do |s|
18
18
  s.add_dependency 'opal-virtual-dom', '~> 0.6.1'
19
19
  s.add_dependency 'thor', '~> 1.2'
20
20
  s.add_dependency 'rack', '~> 2.0'
21
-
22
- s.add_dependency 'rack-rewrite', '~> 1.5'
23
21
  s.add_dependency 'listen', '~> 3.0'
24
22
 
25
23
  s.add_development_dependency 'bundler', '~> 2.0'
@@ -32,30 +32,25 @@ module Inesita
32
32
  default: Inesita::Config::STATIC_DIR,
33
33
  desc: 'static dir'
34
34
 
35
- method_option :dist_source_dir,
36
- aliases: :b,
37
- type: :string,
38
- default: Inesita::Config::APP_DIST_DIR,
39
- desc: 'source (app) dir for dist build'
40
-
41
35
  def build
42
- assets = assets_server
43
36
  empty_directory options[:destination_dir], force: options[:force]
44
-
37
+ generate_files
45
38
  copy_static
46
- create_asset(assets, 'index.html', ->(s) { Inesita::Minify.html(s) })
47
- create_asset(assets, 'application.js', ->(s) { Inesita::Minify.js(s) })
48
- create_asset(assets, 'stylesheet.css', ->(s) { Inesita::Minify.css(s) })
49
39
  end
50
40
 
51
- no_commands do
52
- def assets_server
53
- Inesita::Server.new({
54
- dist: true,
55
- static_dir: options[:static_dir],
56
- app_dir: options[:source_dir],
57
- app_dist_dir: options[:app_dist_dir]
58
- }).assets_app
41
+ no_commands do
42
+ def generate_files
43
+ rack = Rack::Server.new(config: 'config.ru', Port: options['port'], Host: options['host'])
44
+ builder = Inesita::Builder.new(app: rack.app, destination_dir: options[:destination_dir])
45
+
46
+ [
47
+ '/index.html',
48
+ Inesita.assets_code.match(/src="([^\"]*?)[?"]/)[1]
49
+ ].each do |url|
50
+ create_file File.join(options[:destination_dir], url),
51
+ builder.fetch(url),
52
+ force: options[:force]
53
+ end
59
54
  end
60
55
 
61
56
  def copy_static
@@ -71,12 +66,6 @@ module Inesita
71
66
  end
72
67
  end
73
68
  end
74
-
75
- def create_asset(assets, name, minify_proc)
76
- create_file File.join(options[:destination_dir], name),
77
- minify_proc.call(assets[name].source),
78
- force: options[:force]
79
- end
80
69
  end
81
70
  end
82
71
  end
@@ -32,12 +32,6 @@ module Inesita
32
32
  default: Inesita::Config::STATIC_DIR,
33
33
  desc: 'static dir'
34
34
 
35
- method_option :dist_source_dir,
36
- aliases: :b,
37
- type: :string,
38
- default: Inesita::Config::APP_DIST_DIR,
39
- desc: 'source (app) dir for dist build'
40
-
41
35
  def watch
42
36
  puts 'building...'
43
37
  safe_build
@@ -1,8 +1,8 @@
1
1
  module Inesita
2
2
  class Server
3
3
  def initialize(*args, &block)
4
- require 'rack/rewrite'
5
4
  server = server(*args, &block)
5
+
6
6
  @rack = Rack::Builder.new do
7
7
  use Rack::Static, urls: [Inesita::Config::STATIC_DIR]
8
8
  run server
data/lib/inesita.rb CHANGED
@@ -6,6 +6,7 @@ require 'listen'
6
6
 
7
7
  require 'inesita/config'
8
8
  require 'inesita/server'
9
+ require 'inesita/builder'
9
10
 
10
11
  module Inesita
11
12
  module_function
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inesita
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.pre.3
4
+ version: 1.0.pre.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michał Kalbarczyk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-12 00:00:00.000000000 Z
11
+ date: 2023-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.0'
69
- - !ruby/object:Gem::Dependency
70
- name: rack-rewrite
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.5'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.5'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: listen
85
71
  requirement: !ruby/object:Gem::Requirement