liquid-ext 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/bin/liquid +22 -0
- data/lib/liquid/generator.rb +59 -0
- data/lib/liquid/templates/Gemfile.tt +9 -0
- data/lib/liquid/templates/LICENSE.txt.tt +22 -0
- data/lib/liquid/templates/README.md.tt +29 -0
- data/lib/liquid/templates/Rakefile.tt +2 -0
- data/lib/liquid/templates/binwrapper.tt +10 -0
- data/lib/liquid/templates/config.yml.tt +1 -0
- data/lib/liquid/templates/gemspec.tt +19 -0
- data/lib/liquid/templates/gitignore.tt +18 -0
- data/lib/liquid/templates/server.rb.tt +28 -0
- data/liquid-ext.gemspec +2 -1
- metadata +29 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjdmMzQ5MDUxODJkYjkyZDhlYTdmYTNmMmIzZGE5ODI5MTJkYzEwYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZWUxZGNjNWRhMzczNjRiZjhiZGViY2U4ZjFlZWUyMzEzOWQ5ZjNjOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OWUyM2U0ZjdmNDRjYTkzZTkyMjMxMTJmZDlkOThlYzg0ZDFlYzRiNjE3MTk2
|
10
|
+
MzNlMmM0MGE3MTAzOWQ5MzFkNTlmZWUyMDIwMmRhMzVmNTU4YjQ1NmU1NjY1
|
11
|
+
M2RkYWI4ZjE5OWRkOTUwNGE4YjQ4YzBkNTE2NDE5MWM2Yjc4ZjA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDhiNDY2ODFmNmYyMDBhMjVkMWNlYjViMzI2NjZiZTMyNjQwMmMwMGZhNTg4
|
14
|
+
NmYzMTNiZTdkMjU0YzMxNTIxMDdlZTIwMmM4NzU0ZTZiMWIwNWVkMzJhZGZk
|
15
|
+
YmRkNGU3ODhhZTU1YWM0OGM1MmIxZjMzNGE5MDJjMTZiZDQxODE=
|
data/bin/liquid
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
ROOT = File.expand_path('../..', __FILE__)
|
4
|
+
|
5
|
+
require 'bundler/setup'
|
6
|
+
require 'liquid/boot'
|
7
|
+
|
8
|
+
require 'liquid/generator'
|
9
|
+
|
10
|
+
CLI.for(Liquid::Generator) do
|
11
|
+
option :author,
|
12
|
+
:short => '-a',
|
13
|
+
:long => '--author',
|
14
|
+
:description => 'Gem author',
|
15
|
+
:default => `git config user.name`.chomp
|
16
|
+
|
17
|
+
option :email,
|
18
|
+
:short => '-e',
|
19
|
+
:long => '--email',
|
20
|
+
:description => 'Author E-Mail',
|
21
|
+
:default => `git config user.email`.chomp
|
22
|
+
end.run
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'erubis'
|
2
|
+
require 'mixlib/cli'
|
3
|
+
|
4
|
+
module Liquid
|
5
|
+
class Generator
|
6
|
+
|
7
|
+
def run
|
8
|
+
self.__send__(ARGV.shift, *ARGV)
|
9
|
+
end
|
10
|
+
|
11
|
+
def project(name)
|
12
|
+
if File.exist?(name)
|
13
|
+
puts "!!! #{name} already exists"
|
14
|
+
exit(1)
|
15
|
+
end
|
16
|
+
|
17
|
+
puts ">>> Generating new project #{name}"
|
18
|
+
|
19
|
+
constant_name = name.split('_').map{|p| p[0..0].upcase + p[1..-1] }.join
|
20
|
+
constant_name = constant_name.split('-').map{|q| q[0..0].upcase + q[1..-1] }.join('::') if constant_name =~ /-/
|
21
|
+
constant_array = constant_name.split('::')
|
22
|
+
|
23
|
+
config = opts
|
24
|
+
config.merge!({
|
25
|
+
name: name,
|
26
|
+
constant_name: constant_name,
|
27
|
+
constant_array: constant_array,
|
28
|
+
})
|
29
|
+
|
30
|
+
{
|
31
|
+
"Gemfile" => "Gemfile",
|
32
|
+
"Rakefile" => "Rakefile",
|
33
|
+
"LICENSE.txt" => "LICENSE.txt",
|
34
|
+
"README.md" => "README.md",
|
35
|
+
".gitignore" => "gitignore",
|
36
|
+
"#{name}.gemspec" => "gemspec",
|
37
|
+
"bin/#{name}" => "binwrapper",
|
38
|
+
"config.yml" => "config.yml",
|
39
|
+
"#{name}/server.rb" => "server.rb",
|
40
|
+
}.each do |dest, source|
|
41
|
+
puts " * #{dest}"
|
42
|
+
source = File.join(ROOT, 'lib/liquid/templates', "#{source}.tt")
|
43
|
+
dest = File.join(name, dest)
|
44
|
+
FileUtils.mkdir_p(File.dirname(dest))
|
45
|
+
input = File.read(source)
|
46
|
+
eruby = Erubis::Eruby.new(input)
|
47
|
+
output = File.open(dest, "w")
|
48
|
+
output.write(eruby.result(binding()))
|
49
|
+
output.close
|
50
|
+
end
|
51
|
+
|
52
|
+
Dir.chdir(name) do
|
53
|
+
puts ">>> Installing dependencies"
|
54
|
+
system("bundle install")
|
55
|
+
system("chmod +x bin/*")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) <%=Time.now.year%> <%=config[:author]%>
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# <%=config[:constant_name]%>
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem '<%=config[:name]%>'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install <%=config[:name]%>
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( http://github.com/<my-github-username>/<%=config[:name]%>/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
@@ -0,0 +1 @@
|
|
1
|
+
log_level: INFO
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = <%=config[:name].inspect%>
|
5
|
+
spec.version = "0.1.0"
|
6
|
+
spec.authors = [<%=config[:author].inspect%>]
|
7
|
+
spec.email = [<%=config[:email].inspect%>]
|
8
|
+
spec.description = %q{TODO: Write a gem description}
|
9
|
+
spec.summary = %q{TODO: Write a gem summary}
|
10
|
+
spec.homepage = ""
|
11
|
+
spec.license = "MIT"
|
12
|
+
|
13
|
+
spec.files = `git ls-files`.split($/)
|
14
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
|
+
spec.require_paths = ["lib"]
|
17
|
+
|
18
|
+
spec.add_dependency "liquid-ext"
|
19
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module <%=config[:constant_name]%>
|
4
|
+
class Server
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
$log.info("<%=config[:name]%>:boot #{RUBY_DESCRIPTION}")
|
8
|
+
$log.info("<%=config[:name]%>:boot", {
|
9
|
+
env: Env.mode,
|
10
|
+
})
|
11
|
+
|
12
|
+
Signal.register_shutdown_handler { shutdown }
|
13
|
+
end
|
14
|
+
|
15
|
+
def shutdown
|
16
|
+
$log.info("<%=config[:name]%>:server", shutdown: :complete)
|
17
|
+
exit(0)
|
18
|
+
rescue => e
|
19
|
+
$log.exception(e, "shutdown failed")
|
20
|
+
exit(-1)
|
21
|
+
end
|
22
|
+
|
23
|
+
def run
|
24
|
+
sleep
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
data/liquid-ext.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "liquid-ext"
|
5
|
-
spec.version = "1.
|
5
|
+
spec.version = "1.2.0"
|
6
6
|
spec.authors = ["LiquidM, Inc."]
|
7
7
|
spec.email = ["opensource@liquidm.com"]
|
8
8
|
spec.description = %q{Ruby core extensions and helper libraries}
|
@@ -16,6 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.require_paths = ["lib"]
|
17
17
|
|
18
18
|
spec.add_dependency "activesupport"
|
19
|
+
spec.add_dependency "erubis"
|
19
20
|
spec.add_dependency "ffi"
|
20
21
|
spec.add_dependency "liquid-logging", ">= 2.0.0"
|
21
22
|
spec.add_dependency "metriks"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: liquid-ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LiquidM, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: erubis
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: ffi
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,7 +111,8 @@ dependencies:
|
|
97
111
|
description: Ruby core extensions and helper libraries
|
98
112
|
email:
|
99
113
|
- opensource@liquidm.com
|
100
|
-
executables:
|
114
|
+
executables:
|
115
|
+
- liquid
|
101
116
|
extensions: []
|
102
117
|
extra_rdoc_files: []
|
103
118
|
files:
|
@@ -108,6 +123,7 @@ files:
|
|
108
123
|
- LICENSE
|
109
124
|
- README.md
|
110
125
|
- Rakefile
|
126
|
+
- bin/liquid
|
111
127
|
- lib/liquid/benchmark.rb
|
112
128
|
- lib/liquid/boot.rb
|
113
129
|
- lib/liquid/cli.rb
|
@@ -124,6 +140,7 @@ files:
|
|
124
140
|
- lib/liquid/ext/thread.rb
|
125
141
|
- lib/liquid/from_file.rb
|
126
142
|
- lib/liquid/gc_stats.rb
|
143
|
+
- lib/liquid/generator.rb
|
127
144
|
- lib/liquid/hash_helper.rb
|
128
145
|
- lib/liquid/proc_stat.rb
|
129
146
|
- lib/liquid/router.rb
|
@@ -135,6 +152,15 @@ files:
|
|
135
152
|
- lib/liquid/tasks/router.rake
|
136
153
|
- lib/liquid/tasks/rspec.rake
|
137
154
|
- lib/liquid/tasks/yard.rake
|
155
|
+
- lib/liquid/templates/Gemfile.tt
|
156
|
+
- lib/liquid/templates/LICENSE.txt.tt
|
157
|
+
- lib/liquid/templates/README.md.tt
|
158
|
+
- lib/liquid/templates/Rakefile.tt
|
159
|
+
- lib/liquid/templates/binwrapper.tt
|
160
|
+
- lib/liquid/templates/config.yml.tt
|
161
|
+
- lib/liquid/templates/gemspec.tt
|
162
|
+
- lib/liquid/templates/gitignore.tt
|
163
|
+
- lib/liquid/templates/server.rb.tt
|
138
164
|
- lib/liquid/timing.rb
|
139
165
|
- lib/liquid/transaction_id.rb
|
140
166
|
- liquid-ext.gemspec
|