bluesky 0.1.3 → 0.1.4
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 +4 -4
- data/bin/bluesky +23 -15
- data/lib/bluesky/dsl.rb +38 -0
- data/lib/bluesky/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac20f305ac22494f22afa2779e8404c9a5de1fd4
|
4
|
+
data.tar.gz: f969ec619c97679ce9b7a5a6707d653dcfc7b12c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e133aa3627754a432edd77ea11ac38162797739e0122271c356267b659b54206c34f97acde9e907992f3923077cbbda84e92559350804e85aa433bd9b44e319
|
7
|
+
data.tar.gz: 664a0fd7146bfb14d72b0fdf95bf5512a5e44ec7cd535426dc549fd2c5d4ab9a9b3d4f2c38073cb520d8acbc7e1e822ac96a4300946488f89b09c03855fbfcd0
|
data/bin/bluesky
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'fileutils'
|
4
4
|
require 'optparse'
|
5
5
|
|
6
|
+
require 'bluesky'
|
7
|
+
|
6
8
|
class String
|
7
9
|
def unindent
|
8
10
|
gsub /^#{self[/\A[ \t]*/]}/, ''
|
@@ -11,10 +13,15 @@ end
|
|
11
13
|
|
12
14
|
options = {}
|
13
15
|
opt_parser = OptionParser.new do |opts|
|
14
|
-
opts.banner = "Usage: bluesky
|
16
|
+
opts.banner = "Usage: \n bluesky new APP_PATH [options]\n\nOptions:\n"
|
17
|
+
|
18
|
+
opts.on("-v", "--version", "Show bluesky version and quit") do |value|
|
19
|
+
puts "Bluesky #{Bluesky::VERSION}"
|
20
|
+
exit
|
21
|
+
end
|
15
22
|
|
16
|
-
opts.on("-
|
17
|
-
options[:
|
23
|
+
opts.on("-q", "--[no-]quiet", "Suppress status output") do |value|
|
24
|
+
options[:quiet] = value
|
18
25
|
end
|
19
26
|
end
|
20
27
|
|
@@ -22,18 +29,19 @@ opt_parser.parse!
|
|
22
29
|
|
23
30
|
case ARGV[0]
|
24
31
|
when "new"
|
25
|
-
|
26
|
-
|
32
|
+
abort "No value provided for required arguments 'app_path'" unless ARGV.length > 1
|
33
|
+
app_path = File.absolute_path(ARGV[1])
|
34
|
+
abort "#{app_path} already exist! Aborting!" if File.exist?(app_path)
|
27
35
|
|
28
36
|
title = ARGV[1].capitalize
|
29
37
|
|
30
38
|
FileUtils.mkdir_p([
|
31
|
-
File.join(
|
32
|
-
File.join(
|
33
|
-
File.join(
|
39
|
+
File.join(app_path, 'app/models'),
|
40
|
+
File.join(app_path, 'app/views'),
|
41
|
+
File.join(app_path, 'app/controllers'),
|
34
42
|
])
|
35
43
|
|
36
|
-
IO.write File.join(
|
44
|
+
IO.write File.join(app_path, 'Gemfile'), <<-RUBY.unindent
|
37
45
|
source 'https://rubygems.org'
|
38
46
|
|
39
47
|
gem 'opal', '~> 0.10'
|
@@ -41,7 +49,7 @@ when "new"
|
|
41
49
|
gem 'bluesky', path: '../'
|
42
50
|
RUBY
|
43
51
|
|
44
|
-
IO.write File.join(
|
52
|
+
IO.write File.join(app_path, 'app/application.rb'), <<-RUBY.unindent
|
45
53
|
require 'bluesky'
|
46
54
|
include Bluesky
|
47
55
|
|
@@ -60,7 +68,7 @@ when "new"
|
|
60
68
|
$app.run
|
61
69
|
RUBY
|
62
70
|
|
63
|
-
IO.write File.join(
|
71
|
+
IO.write File.join(app_path, 'app/controllers/root_controller.rb'), <<-RUBY.unindent
|
64
72
|
class RootController < ViewController
|
65
73
|
|
66
74
|
attribute :name, 'World'
|
@@ -77,7 +85,7 @@ when "new"
|
|
77
85
|
end
|
78
86
|
RUBY
|
79
87
|
|
80
|
-
IO.write File.join(
|
88
|
+
IO.write File.join(app_path, 'app/views/hello_view.rb'), <<-RUBY.unindent
|
81
89
|
class HelloView < PureComponent
|
82
90
|
|
83
91
|
attribute :name
|
@@ -100,7 +108,7 @@ when "new"
|
|
100
108
|
RUBY
|
101
109
|
|
102
110
|
|
103
|
-
IO.write File.join(
|
111
|
+
IO.write File.join(app_path, 'config.ru'), <<-RUBY.unindent
|
104
112
|
require 'bundler'
|
105
113
|
Bundler.require
|
106
114
|
|
@@ -111,7 +119,7 @@ when "new"
|
|
111
119
|
}
|
112
120
|
RUBY
|
113
121
|
|
114
|
-
IO.write File.join(
|
122
|
+
IO.write File.join(app_path, 'index.html.erb'), <<-ERB.unindent
|
115
123
|
<!DOCTYPE html>
|
116
124
|
<html>
|
117
125
|
<head>
|
@@ -124,7 +132,7 @@ when "new"
|
|
124
132
|
</html>
|
125
133
|
ERB
|
126
134
|
|
127
|
-
Dir.chdir(
|
135
|
+
Dir.chdir(app_path) do
|
128
136
|
system("bundle install")
|
129
137
|
end
|
130
138
|
|
data/lib/bluesky/dsl.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'clearwater'
|
2
|
+
|
3
|
+
module Bluesky
|
4
|
+
|
5
|
+
module DSL
|
6
|
+
|
7
|
+
module_function
|
8
|
+
|
9
|
+
Clearwater::Component::HTML_TAGS.each do |tag_name|
|
10
|
+
define_method(tag_name) do |attributes, content|
|
11
|
+
%x{
|
12
|
+
if(!(attributes === nil || attributes.$$is_hash)) {
|
13
|
+
content = attributes;
|
14
|
+
attributes = nil;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
tag(tag_name, attributes, content)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def tag(tag_name, attributes=nil, content=nil, &block)
|
23
|
+
|
24
|
+
if block
|
25
|
+
attributes ||= {}
|
26
|
+
content ||= []
|
27
|
+
block.call(NodeBuilder.new(tag_name, attributes, content))
|
28
|
+
end
|
29
|
+
|
30
|
+
Clearwater::VirtualDOM.node(
|
31
|
+
tag_name,
|
32
|
+
Clearwater::Component.sanitize_attributes(attributes),
|
33
|
+
Clearwater::Component.sanitize_content(content)
|
34
|
+
)
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/bluesky/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bluesky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Susi
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- bin/bluesky
|
63
63
|
- lib/bluesky.rb
|
64
64
|
- lib/bluesky/application.rb
|
65
|
+
- lib/bluesky/dsl.rb
|
65
66
|
- lib/bluesky/helpers.rb
|
66
67
|
- lib/bluesky/navigation_controller.rb
|
67
68
|
- lib/bluesky/pure_component.rb
|