lucie-bin 0.0.21 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -3
- data/Gemfile.lock +29 -0
- data/app/boot.rb +3 -0
- data/app/controllers/generate_controller.rb +16 -0
- data/app/templates/generate/controller.tt +2 -0
- data/app/templates/new/app/boot.rb.tt +1 -1
- data/bin/lucie +1 -2
- data/lucie-bin.gemspec +1 -0
- data/spec/functionals/generate_spec.rb +56 -0
- data/spec/spec_helper.rb +2 -0
- metadata +24 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e71b3ede92046471333d88d1ecfa90518ac60914
|
4
|
+
data.tar.gz: da40cc8789f4e9b9c34675eb0346854dc6b6a04c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd18be2efb6814223215042f893bd00a2840e6c0baf1723161a0f88af22a4ad838e8b0fa0a857b3c63593f4400042821389a63c2038c60e0e6a00e7e8adcf05f
|
7
|
+
data.tar.gz: bd37b0782c124d8608cb4c31d30d52c94cede4875bf235a7781f73afa4ad333472802ea377017427e2682a8b519e5c85004f6e51fb2ab94020d14f8b6c343418
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
lucie-bin (0.0.21)
|
5
|
+
lucie-cmd (= 0.0.21)
|
6
|
+
lucie-lib (= 0.0.21)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
json (1.8.1)
|
12
|
+
lucie-cmd (0.0.21)
|
13
|
+
lucie-lib (0.0.21)
|
14
|
+
minitest (4.6.0)
|
15
|
+
rake (10.0.3)
|
16
|
+
rdoc (4.1.1)
|
17
|
+
json (~> 1.4)
|
18
|
+
sdoc (0.4.0)
|
19
|
+
json (~> 1.8)
|
20
|
+
rdoc (~> 4.0, < 5.0)
|
21
|
+
|
22
|
+
PLATFORMS
|
23
|
+
ruby
|
24
|
+
|
25
|
+
DEPENDENCIES
|
26
|
+
lucie-bin!
|
27
|
+
minitest (= 4.6)
|
28
|
+
rake (= 10.0.3)
|
29
|
+
sdoc
|
data/app/boot.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
class GenerateController < Controller::Base
|
2
|
+
|
3
|
+
include Snippets::Template
|
4
|
+
include Lucie::Commands
|
5
|
+
|
6
|
+
def controller
|
7
|
+
@controller = Lucie::Helpers::ControllerName.new(params[:args].shift)
|
8
|
+
target = File.join(app.pwd, "app", "controllers", "#{@controller.name}_controller.rb")
|
9
|
+
if File.exist?(target)
|
10
|
+
stderr "File #{target} already exists"
|
11
|
+
else
|
12
|
+
template("generate/controller.tt", target)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
data/bin/lucie
CHANGED
data/lucie-bin.gemspec
CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
20
20
|
|
21
21
|
s.add_dependency "lucie-lib", version
|
22
|
+
s.add_dependency "lucie-cmd", version
|
22
23
|
s.add_development_dependency "rake", "10.0.3"
|
23
24
|
s.add_development_dependency "sdoc"
|
24
25
|
s.add_development_dependency "minitest", "4.6"
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'generate_controller'
|
3
|
+
require 'shellwords'
|
4
|
+
|
5
|
+
describe GenerateController do
|
6
|
+
|
7
|
+
@before_all ||= begin
|
8
|
+
@tmp = File.expand_path("../../../tmp", __FILE__)
|
9
|
+
system "cd #{Shellwords.escape(@tmp)} && rm -rf generator_new"
|
10
|
+
@bin = File.expand_path("../../../bin/lucie", __FILE__)
|
11
|
+
system "cd #{Shellwords.escape(@tmp)} && #{Shellwords.escape(@bin)} new generator_new"
|
12
|
+
end
|
13
|
+
|
14
|
+
before do
|
15
|
+
@app_path = File.expand_path("../../../tmp/generator_new", __FILE__)
|
16
|
+
@lucie_path = File.expand_path("../../../bin/lucie", __FILE__)
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "controller" do
|
20
|
+
|
21
|
+
it "should create a new controller file" do
|
22
|
+
generate("controller_name1")
|
23
|
+
assert File.exist?(controller_path("controller_name1"))
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should create a new controller file with controller class in it" do
|
27
|
+
generate("controller_name2")
|
28
|
+
content = ""
|
29
|
+
File.open(controller_path("controller_name2")) do |file|
|
30
|
+
content = file.read
|
31
|
+
end
|
32
|
+
expected = "class ControllerName2 < ApplicationController\nend"
|
33
|
+
|
34
|
+
assert_equal expected, content
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should throw error when the file exists" do
|
38
|
+
generate("controller3")
|
39
|
+
assert_output nil, "File #{controller_path('controller3')} already exists\n" do
|
40
|
+
generate "controller3"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def generate(name)
|
45
|
+
cmd = ["cd #{Shellwords.escape(@app_path)} && #{Shellwords.escape(@lucie_path)} generate controller #{name}"]
|
46
|
+
stdout, stderr, status = Open3.capture3(*cmd)
|
47
|
+
$stderr.print stderr
|
48
|
+
$stdout.print stdout
|
49
|
+
end
|
50
|
+
|
51
|
+
def controller_path(name)
|
52
|
+
File.join(@app_path, "app", "controllers", "#{name}_controller.rb")
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lucie-bin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nucc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lucie-lib
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.0
|
19
|
+
version: 0.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.0
|
26
|
+
version: 0.1.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: lucie-cmd
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.1.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.1.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,8 +89,12 @@ extensions: []
|
|
75
89
|
extra_rdoc_files: []
|
76
90
|
files:
|
77
91
|
- Gemfile
|
92
|
+
- Gemfile.lock
|
78
93
|
- Rakefile
|
94
|
+
- app/boot.rb
|
95
|
+
- app/controllers/generate_controller.rb
|
79
96
|
- app/controllers/new_controller.rb
|
97
|
+
- app/templates/generate/controller.tt
|
80
98
|
- app/templates/new/Gemfile.tt
|
81
99
|
- app/templates/new/Rakefile.tt
|
82
100
|
- app/templates/new/app/application_controller.rb.tt
|
@@ -85,6 +103,7 @@ files:
|
|
85
103
|
- bin/lucie
|
86
104
|
- lucie-bin.gemspec
|
87
105
|
- project/bin/project
|
106
|
+
- spec/functionals/generate_spec.rb
|
88
107
|
- spec/functionals/new_spec.rb
|
89
108
|
- spec/spec_helper.rb
|
90
109
|
- tmp/.gitignore
|
@@ -112,6 +131,7 @@ signing_key:
|
|
112
131
|
specification_version: 4
|
113
132
|
summary: ''
|
114
133
|
test_files:
|
134
|
+
- spec/functionals/generate_spec.rb
|
115
135
|
- spec/functionals/new_spec.rb
|
116
136
|
- spec/spec_helper.rb
|
117
137
|
has_rdoc:
|