inesita 0.3.5 β 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile +1 -2
- data/README.md +4 -4
- data/Rakefile +0 -1
- data/bin/inesita +1 -1
- data/inesita.gemspec +2 -4
- data/lib/inesita.rb +0 -5
- data/lib/inesita/cli/build.rb +58 -56
- data/lib/inesita/cli/new.rb +18 -16
- data/lib/inesita/cli/server.rb +16 -14
- data/lib/inesita/cli/template/Gemfile.tt +1 -0
- data/lib/inesita/cli/template/app/application.js.rb.tt +2 -2
- data/lib/inesita/cli/watch.rb +57 -44
- data/opal/inesita.rb +1 -4
- data/opal/inesita/application.rb +7 -6
- data/opal/inesita/browser.rb +63 -0
- data/opal/inesita/component.rb +15 -17
- data/opal/inesita/component_virtual_dom_extension.rb +5 -3
- data/opal/inesita/router.rb +28 -23
- data/opal/inesita/routes.rb +12 -7
- data/opal/inesita/store.rb +9 -3
- data/spec/opal/component_spec.rb +3 -3
- data/spec/opal/spec_helper.rb +0 -1
- metadata +5 -36
- data/lib/inesita/app_files_listener.rb +0 -42
- data/lib/inesita/live_reload.rb +0 -47
- data/lib/rubame.rb +0 -156
- data/opal/inesita/live_reload.rb +0 -79
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 907698ee4cdd30ecb71863c19293871ec5aa8570
|
4
|
+
data.tar.gz: 1c75da793084fd787162548f0bbc64a9feb28bcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51f60911f8d1bf274582fd05a8a3fff9370c1a1a9655f28fa3eba8fdab7f4631eb79a2e72f57337cc2dcc14eeb81d4a259d8cde16b7eb81c40227ff81bacc46b
|
7
|
+
data.tar.gz: 4c05625318392fe448779a30026e585f7f3e9bd70de3df3a69b7260c4399694224edca312b2cb1e1a02d60dda1f9d98619b5554401efb6689c4db6fb2b01c794
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## 0.4.0 (02.05.2016)
|
2
|
+
* add `router` to `store`
|
3
|
+
* change `handle_link` to `go_to`
|
4
|
+
* add `init` callback to `store` and `component`
|
5
|
+
* `router` support `*param` to catch rest of url
|
6
|
+
* make `opal-browser` optional
|
7
|
+
* add `Inesita::Browser` minimal browser support
|
8
|
+
* extract livereload to `inesita-livereload`
|
9
|
+
* removed `after_render`
|
10
|
+
* add `virtual-dom` hooks (instead of `after_render`)
|
11
|
+
|
1
12
|
## 0.3.5 (10.03.2016)
|
2
13
|
* add `inesita watch`
|
3
14
|
* add `inesita build` dir parameters
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,7 @@ More detailed description [here](https://inesita-rb.github.io).
|
|
8
8
|
|
9
9
|
## Examples
|
10
10
|
|
11
|
-
- [
|
12
|
-
- [
|
13
|
-
- [
|
14
|
-
- [
|
11
|
+
- Example application: [Live demo π](http://inesita-playground.netlify.com/) Β· [source code π](https://github.com/inesita-rb/playground)
|
12
|
+
- TodoMVC: [Live demo π](http://inesita-todomvc.netlify.com/) Β· [source code π](https://github.com/inesita-rb/todomvc)
|
13
|
+
- DBMonster: [Live demo π](http://inesita-dbmonster.netlify.com/) Β· [source code π](https://github.com/inesita-rb/dbmonster)
|
14
|
+
- Asciify Me: [Live demo π](https://inesita-asciify-me.netlify.com/) Β· [source code π](https://github.com/inesita-rb/asciify-me)
|
data/Rakefile
CHANGED
data/bin/inesita
CHANGED
data/inesita.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'inesita'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '0.4.0'
|
4
4
|
s.authors = ['MichaΕ Kalbarczyk']
|
5
5
|
s.email = 'fazibear@gmail.com'
|
6
6
|
s.homepage = 'http://github.com/inesita-rb/inesita'
|
@@ -14,12 +14,10 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.require_paths = ['lib']
|
15
15
|
|
16
16
|
s.add_dependency 'opal', '~> 0.9'
|
17
|
-
s.add_dependency 'opal-
|
18
|
-
s.add_dependency 'opal-virtual-dom', '~> 0.3.0'
|
17
|
+
s.add_dependency 'opal-virtual-dom', '~> 0.4.0'
|
19
18
|
s.add_dependency 'slim', '~> 3.0'
|
20
19
|
s.add_dependency 'sass', '~> 3.4'
|
21
20
|
s.add_dependency 'thor', '~> 0.19'
|
22
21
|
s.add_dependency 'rack-rewrite', '~> 1.5'
|
23
22
|
s.add_dependency 'listen', '~> 3.0'
|
24
|
-
s.add_dependency 'websocket', '~> 1.0'
|
25
23
|
end
|
data/lib/inesita.rb
CHANGED
@@ -2,17 +2,12 @@ require 'opal'
|
|
2
2
|
Opal.append_path File.expand_path('../../opal', __FILE__)
|
3
3
|
|
4
4
|
require 'opal-virtual-dom'
|
5
|
-
require 'opal-browser'
|
6
5
|
require 'slim'
|
7
6
|
require 'sass'
|
8
7
|
|
9
|
-
require 'singleton'
|
10
8
|
require 'listen'
|
11
|
-
require 'rubame'
|
12
9
|
|
13
10
|
require 'inesita/config'
|
14
|
-
require 'inesita/app_files_listener'
|
15
|
-
require 'inesita/live_reload'
|
16
11
|
require 'inesita/server'
|
17
12
|
|
18
13
|
module Inesita
|
data/lib/inesita/cli/build.rb
CHANGED
@@ -1,75 +1,77 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module Inesita
|
2
|
+
class CLI < Thor
|
3
|
+
include Thor::Actions
|
3
4
|
|
4
|
-
|
5
|
+
check_unknown_options!
|
5
6
|
|
6
|
-
|
7
|
+
namespace :build
|
7
8
|
|
8
|
-
|
9
|
+
desc 'build [OPTIONS]', 'Build Inesita app'
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
method_option :force,
|
12
|
+
aliases: :f,
|
13
|
+
default: false,
|
14
|
+
desc: 'force overwrite'
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
method_option :destination_dir,
|
17
|
+
aliases: :d,
|
18
|
+
default: Inesita::Config::BUILD_DIR,
|
19
|
+
desc: 'destination directory'
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
method_option :source_dir,
|
22
|
+
aliases: :s,
|
23
|
+
default: Inesita::Config::APP_DIR,
|
24
|
+
desc: 'source (app) dir'
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
method_option :static_dir,
|
27
|
+
aliases: :t,
|
28
|
+
default: Inesita::Config::STATIC_DIR,
|
29
|
+
desc: 'static dir'
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
method_option :dist_source_dir,
|
32
|
+
aliases: :b,
|
33
|
+
default: Inesita::Config::APP_DIST_DIR,
|
34
|
+
desc: 'source (app) dir for dist build'
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
def build
|
37
|
+
assets = assets_server
|
38
|
+
empty_directory options[:destination_dir], force: options[:force]
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
no_commands do
|
46
|
-
def assets_server
|
47
|
-
Inesita::Server.new({
|
48
|
-
dist: true,
|
49
|
-
static_dir: options[:static_dir],
|
50
|
-
app_dir: options[:source_dir],
|
51
|
-
app_dist_dir: options[:app_dist_dir]
|
52
|
-
}).assets_app
|
40
|
+
copy_static
|
41
|
+
create_asset(assets, 'index.html', ->(s) { Inesita::Minify.html(s) })
|
42
|
+
create_asset(assets, 'application.js', ->(s) { Inesita::Minify.js(s) })
|
43
|
+
create_asset(assets, 'stylesheet.css', ->(s) { Inesita::Minify.css(s) })
|
53
44
|
end
|
54
45
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
46
|
+
no_commands do
|
47
|
+
def assets_server
|
48
|
+
Inesita::Server.new({
|
49
|
+
dist: true,
|
50
|
+
static_dir: options[:static_dir],
|
51
|
+
app_dir: options[:source_dir],
|
52
|
+
app_dist_dir: options[:app_dist_dir]
|
53
|
+
}).assets_app
|
54
|
+
end
|
55
|
+
|
56
|
+
def copy_static
|
57
|
+
destination_dir = options[:destination_dir]
|
58
|
+
force = options[:force]
|
59
|
+
static_dir = options[:static_dir]
|
59
60
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
61
|
+
Dir.glob("./#{static_dir}/**/*").each do |file|
|
62
|
+
if File.directory?(file)
|
63
|
+
empty_directory File.join(destination_dir, file), force: force
|
64
|
+
else
|
65
|
+
copy_file File.absolute_path(file), File.join(destination_dir, file.gsub(static_dir, 'static')), force: force
|
66
|
+
end
|
65
67
|
end
|
66
68
|
end
|
67
|
-
end
|
68
69
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
70
|
+
def create_asset(assets, name, minify_proc)
|
71
|
+
create_file File.join(options[:destination_dir], name),
|
72
|
+
minify_proc.call(assets[name].source),
|
73
|
+
force: options[:force]
|
74
|
+
end
|
73
75
|
end
|
74
76
|
end
|
75
77
|
end
|
data/lib/inesita/cli/new.rb
CHANGED
@@ -1,26 +1,28 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module Inesita
|
2
|
+
class CLI < Thor
|
3
|
+
include Thor::Actions
|
3
4
|
|
4
|
-
|
5
|
+
check_unknown_options!
|
5
6
|
|
6
|
-
|
7
|
+
namespace :new
|
7
8
|
|
8
|
-
|
9
|
+
desc 'new PROJECT_NAME', 'Create Inesita app'
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
method_option :force,
|
12
|
+
aliases: :f,
|
13
|
+
default: false,
|
14
|
+
desc: 'force overwrite'
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
def new(project_dir)
|
17
|
+
directory('template', project_dir, project_name: project_dir, build_dir: Inesita::Config::BUILD_DIR)
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
inside project_dir do
|
20
|
+
run 'bundle install'
|
21
|
+
end
|
20
22
|
end
|
21
|
-
end
|
22
23
|
|
23
|
-
|
24
|
-
|
24
|
+
def self.source_root
|
25
|
+
File.dirname(__FILE__)
|
26
|
+
end
|
25
27
|
end
|
26
28
|
end
|
data/lib/inesita/cli/server.rb
CHANGED
@@ -1,20 +1,22 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module Inesita
|
2
|
+
class CLI < Thor
|
3
|
+
check_unknown_options!
|
3
4
|
|
4
|
-
|
5
|
+
namespace :server
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
desc 'server [OPTIONS]', 'Starts Inesita server'
|
8
|
+
method_option :port,
|
9
|
+
aliases: :p,
|
10
|
+
default: 9292,
|
11
|
+
desc: 'The port Inesita will listen on'
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
method_option :host,
|
14
|
+
aliases: :h,
|
15
|
+
default: '127.0.0.1',
|
16
|
+
desc: 'The host address Inesita will bind to'
|
16
17
|
|
17
|
-
|
18
|
-
|
18
|
+
def server
|
19
|
+
Rack::Server.start config: 'config.ru', Port: options['port'], Host: options['host']
|
20
|
+
end
|
19
21
|
end
|
20
22
|
end
|
@@ -10,11 +10,11 @@ require 'layout'
|
|
10
10
|
require_tree './components'
|
11
11
|
|
12
12
|
# when document is ready render application to <body>
|
13
|
-
|
13
|
+
Inesita::Browser.ready? do
|
14
14
|
# setup Inesita application
|
15
15
|
Inesita::Application.new(
|
16
16
|
router: Router,
|
17
17
|
store: Store,
|
18
18
|
layout: Layout
|
19
|
-
).mount_to(
|
19
|
+
).mount_to(Inesita::Browser.body)
|
20
20
|
end
|
data/lib/inesita/cli/watch.rb
CHANGED
@@ -1,46 +1,59 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
1
|
+
module Inesita
|
2
|
+
class CLI < Thor
|
3
|
+
include Thor::Actions
|
4
|
+
|
5
|
+
check_unknown_options!
|
6
|
+
|
7
|
+
namespace :watch
|
8
|
+
|
9
|
+
desc 'watch [OPTIONS]', 'Watch files and build Inesita app'
|
10
|
+
|
11
|
+
method_option :force,
|
12
|
+
aliases: :f,
|
13
|
+
default: true,
|
14
|
+
desc: 'force overwrite'
|
15
|
+
|
16
|
+
method_option :destination_dir,
|
17
|
+
aliases: :d,
|
18
|
+
default: Inesita::Config::BUILD_DIR,
|
19
|
+
desc: 'destination directory'
|
20
|
+
|
21
|
+
method_option :source_dir,
|
22
|
+
aliases: :s,
|
23
|
+
default: Inesita::Config::APP_DIR,
|
24
|
+
desc: 'source (app) dir'
|
25
|
+
|
26
|
+
method_option :static_dir,
|
27
|
+
aliases: :t,
|
28
|
+
default: Inesita::Config::STATIC_DIR,
|
29
|
+
desc: 'static dir'
|
30
|
+
|
31
|
+
method_option :dist_source_dir,
|
32
|
+
aliases: :b,
|
33
|
+
default: Inesita::Config::APP_DIST_DIR,
|
34
|
+
desc: 'source (app) dir for dist build'
|
35
|
+
|
36
|
+
def watch
|
37
|
+
puts 'building...'
|
38
|
+
safe_build
|
39
|
+
puts 'done.'
|
40
|
+
Listen.to(options[:source_dir]) do |_modified, _added, _removed|
|
41
|
+
puts "rebuilding..."
|
42
|
+
safe_build
|
43
|
+
puts "done."
|
44
|
+
end.start
|
45
|
+
loop { sleep 1000 }
|
46
|
+
end
|
47
|
+
|
48
|
+
no_commands do
|
49
|
+
def safe_build
|
50
|
+
begin
|
51
|
+
build
|
52
|
+
rescue => e
|
53
|
+
puts 'build error:'
|
54
|
+
puts e
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
45
58
|
end
|
46
59
|
end
|