rory 0.8.1 → 0.9.0
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/lib/rory/application.rb +1 -1
- data/lib/rory/cli.rb +10 -0
- data/lib/rory/cli/generate.rb +10 -0
- data/lib/rory/cli/generators/application.rb +42 -0
- data/lib/rory/cli/generators/templates/app/Gemfile.tt +12 -0
- data/lib/rory/cli/generators/templates/app/Rakefile.tt +11 -0
- data/lib/rory/cli/generators/templates/app/config.ru.tt +5 -0
- data/lib/rory/cli/generators/templates/app/config/application.rb.tt +11 -0
- data/lib/rory/cli/generators/templates/app/config/routes.rb.tt +3 -0
- data/lib/rory/cli/generators/templates/app/controllers/application_controller.rb +2 -0
- data/lib/rory/cli/generators/templates/app/spec/spec_helper.rb +6 -0
- data/lib/rory/cli/root.rb +17 -0
- data/lib/rory/version.rb +1 -1
- data/rory.gemspec +2 -0
- data/spec/lib/rory/application_spec.rb +3 -3
- data/spec/lib/rory/cli/generate_spec.rb +16 -0
- data/spec/lib/rory/cli/generators/application_spec.rb +35 -0
- data/spec/lib/rory/cli/root_spec.rb +30 -0
- data/spec/lib/rory/cli_spec.rb +10 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/generation_helpers.rb +19 -0
- metadata +33 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08a956b5ad20d37deb355ac86022eccc32d34b4c
|
4
|
+
data.tar.gz: fdce7d3b965c84e124a062c1c316db4863808e01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2be8cabd2076c605e897bb75488cb58ced01d7d873bf29a7c5179267d68ba5b695e1625cc87e3a8704191aef700f9ccb4a5ae2a257eceba277ecdb85b4a3ed95
|
7
|
+
data.tar.gz: a3cb5d88bb4bc5b31aa19c861089452f308e5d4306c0aed99337d3411eff248e371150cbf1af120ac1560780d1e9876b6acf42cb06820f09b9715d0b741685ff
|
data/lib/rory/application.rb
CHANGED
data/lib/rory/cli.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require "rory/support"
|
2
|
+
|
3
|
+
module Rory
|
4
|
+
module CLI
|
5
|
+
module Generators
|
6
|
+
class Application < Thor::Group
|
7
|
+
include Thor::Actions
|
8
|
+
|
9
|
+
argument :name
|
10
|
+
class_option :rspec, type: :boolean
|
11
|
+
|
12
|
+
def self.source_root
|
13
|
+
File.join(File.dirname(__FILE__), "templates")
|
14
|
+
end
|
15
|
+
|
16
|
+
def apply_app_template
|
17
|
+
directory "app", tokenized_app_name, exclude_pattern: exclude_pattern
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def exclude_pattern
|
23
|
+
patterns = [].tap { |patterns|
|
24
|
+
unless options[:rspec]
|
25
|
+
patterns << "spec\/spec_helper\.rb"
|
26
|
+
patterns << ".rspec"
|
27
|
+
end
|
28
|
+
}
|
29
|
+
patterns.empty? ? nil : /#{patterns.join("|")}/
|
30
|
+
end
|
31
|
+
|
32
|
+
def camelized_app_name
|
33
|
+
@camelized_app_name ||= Rory::Support.camelize(name)
|
34
|
+
end
|
35
|
+
|
36
|
+
def tokenized_app_name
|
37
|
+
@tokenized_app_name ||= Rory::Support.tokenize(name)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
ENV["RORY_ENV"] ||= ENV["RACK_ENV"] || "development"
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "rory/tasks"
|
5
|
+
|
6
|
+
Rake::TaskManager.record_task_metadata = true
|
7
|
+
|
8
|
+
task :environment do
|
9
|
+
require_relative "config/application"
|
10
|
+
RORY_APP = <%= camelized_app_name %>::Application
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "bundler"
|
2
|
+
|
3
|
+
Bundler.require
|
4
|
+
|
5
|
+
module <%= camelized_app_name %>
|
6
|
+
class Application < Rory::Application
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
<%= camelized_app_name %>::Application.root = File.expand_path(File.join("..", ".."), __FILE__)
|
11
|
+
<%= camelized_app_name %>::Application.require_all_files
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "thor"
|
2
|
+
require_relative "generate"
|
3
|
+
|
4
|
+
module Rory
|
5
|
+
module CLI
|
6
|
+
class Root < Thor
|
7
|
+
desc "version", "Display version of installed Rory"
|
8
|
+
map %w[-v --version] => :version
|
9
|
+
def version
|
10
|
+
say "rory #{Rory::VERSION}"
|
11
|
+
end
|
12
|
+
|
13
|
+
register Generators::Application, "new", "new [APP_NAME]", "Create a new Rory application"
|
14
|
+
register Generate, "generate", "generate [COMMAND]", "Delegate to generate command"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/rory/version.rb
CHANGED
data/rory.gemspec
CHANGED
@@ -27,12 +27,14 @@ EOF
|
|
27
27
|
%w(LICENSE.txt Rakefile README.md rory.gemspec)
|
28
28
|
s.licenses = ["MIT"]
|
29
29
|
s.require_paths = ["lib"]
|
30
|
+
s.bindir = "bin"
|
30
31
|
|
31
32
|
s.add_runtime_dependency 'rack', '~> 1.0'
|
32
33
|
s.add_runtime_dependency 'rack-contrib', '~> 1.2'
|
33
34
|
s.add_runtime_dependency 'sequel', '~> 4.0'
|
34
35
|
s.add_runtime_dependency 'thin', '~> 1.0'
|
35
36
|
s.add_runtime_dependency 'thread-inheritable_attributes', '~> 0.1'
|
37
|
+
s.add_runtime_dependency 'thor', '~> 0.19'
|
36
38
|
|
37
39
|
s.add_development_dependency 'rake', '~> 10.4'
|
38
40
|
s.add_development_dependency 'rspec', '~> 3'
|
@@ -238,13 +238,13 @@ RSpec.describe Rory::Application do
|
|
238
238
|
subject.instance.instance_variable_set(:@auto_require_paths, nil)
|
239
239
|
end
|
240
240
|
|
241
|
-
it 'includes models, controllers, and helpers by default' do
|
242
|
-
expect(subject.auto_require_paths).to eq(['models', 'controllers', 'helpers'])
|
241
|
+
it 'includes initializers, models, controllers, and helpers by default' do
|
242
|
+
expect(subject.auto_require_paths).to eq(['config/initializers', 'models', 'controllers', 'helpers'])
|
243
243
|
end
|
244
244
|
|
245
245
|
it 'accepts new paths' do
|
246
246
|
subject.auto_require_paths << 'chocolates'
|
247
|
-
expect(subject.auto_require_paths).to eq(['models', 'controllers', 'helpers', 'chocolates'])
|
247
|
+
expect(subject.auto_require_paths).to eq(['config/initializers', 'models', 'controllers', 'helpers', 'chocolates'])
|
248
248
|
end
|
249
249
|
end
|
250
250
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "rory/cli"
|
2
|
+
|
3
|
+
RSpec.describe Rory::CLI::Generate do
|
4
|
+
describe "#app" do
|
5
|
+
it "starts Generators::Application" do
|
6
|
+
proxy = instance_double(Rory::CLI::Generators::Application)
|
7
|
+
allow(proxy).to receive(:parent_options=).with({})
|
8
|
+
allow(Rory::CLI::Generators::Application).to receive(:new).
|
9
|
+
with(["frog"], any_args).
|
10
|
+
and_return(proxy)
|
11
|
+
|
12
|
+
expect(proxy).to receive(:invoke_all)
|
13
|
+
subject.app("frog")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "rory/cli"
|
2
|
+
|
3
|
+
describe Rory::CLI::Generators::Application do
|
4
|
+
let(:options) { {} }
|
5
|
+
let(:args) { ["an app"] }
|
6
|
+
subject { described_class.new(args, options, :destination_root => sandbox_directory) }
|
7
|
+
|
8
|
+
after(:each) do
|
9
|
+
FileUtils.rm_rf sandbox_directory
|
10
|
+
end
|
11
|
+
|
12
|
+
context "with default options" do
|
13
|
+
it "generates a new application directory with no optional files" do
|
14
|
+
capture_output { subject.invoke_all }
|
15
|
+
expect(sandbox_directory.join("an_app")).to be_a_directory
|
16
|
+
expect(sandbox_directory.join("an_app", "config.ru")).to be_a_file
|
17
|
+
expect(sandbox_directory.join("an_app", ".rspec")).not_to be_a_file
|
18
|
+
end
|
19
|
+
|
20
|
+
it "logs the output" do
|
21
|
+
result = capture_output { subject.invoke_all }
|
22
|
+
expect(result).to include("create an_app")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "with default options" do
|
27
|
+
let(:options) { { rspec: true } }
|
28
|
+
|
29
|
+
it "adds rspec files" do
|
30
|
+
capture_output { subject.invoke_all }
|
31
|
+
expect(sandbox_directory.join("an_app", ".rspec")).to be_a_file
|
32
|
+
expect(sandbox_directory.join("an_app", "spec", "spec_helper.rb")).to be_a_file
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "rory/cli"
|
2
|
+
|
3
|
+
RSpec.describe Rory::CLI::Root do
|
4
|
+
describe "#version" do
|
5
|
+
it "says the current Rory VERSION constant" do
|
6
|
+
expect(subject).to receive(:say).with("rory #{Rory::VERSION}")
|
7
|
+
subject.version
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "#generate" do
|
12
|
+
it "delegates to generate" do
|
13
|
+
expect(Rory::CLI::Root.subcommand_classes["generate"]).
|
14
|
+
to eq(Rory::CLI::Generate)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#new" do
|
19
|
+
it "starts Generators::Application" do
|
20
|
+
proxy = instance_double(Rory::CLI::Generators::Application)
|
21
|
+
allow(proxy).to receive(:parent_options=).with({})
|
22
|
+
allow(Rory::CLI::Generators::Application).to receive(:new).
|
23
|
+
with(["frog"], any_args).
|
24
|
+
and_return(proxy)
|
25
|
+
|
26
|
+
expect(proxy).to receive(:invoke_all)
|
27
|
+
subject.new("frog")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
module GenerationHelpers
|
2
|
+
def sandbox_directory
|
3
|
+
Pathname.new(
|
4
|
+
File.join(File.dirname(__FILE__), "..", "sandbox")
|
5
|
+
)
|
6
|
+
end
|
7
|
+
|
8
|
+
def capture_output
|
9
|
+
begin
|
10
|
+
$stdout = StringIO.new
|
11
|
+
yield
|
12
|
+
result = $stdout.string
|
13
|
+
ensure
|
14
|
+
$stdout = STDOUT
|
15
|
+
end
|
16
|
+
|
17
|
+
result
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ravi Gadad
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-
|
14
|
+
date: 2016-09-26 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rack
|
@@ -83,6 +83,20 @@ dependencies:
|
|
83
83
|
- - "~>"
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0.1'
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: thor
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - "~>"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0.19'
|
93
|
+
type: :runtime
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0.19'
|
86
100
|
- !ruby/object:Gem::Dependency
|
87
101
|
name: rake
|
88
102
|
requirement: !ruby/object:Gem::Requirement
|
@@ -228,6 +242,17 @@ files:
|
|
228
242
|
- Rakefile
|
229
243
|
- lib/rory.rb
|
230
244
|
- lib/rory/application.rb
|
245
|
+
- lib/rory/cli.rb
|
246
|
+
- lib/rory/cli/generate.rb
|
247
|
+
- lib/rory/cli/generators/application.rb
|
248
|
+
- lib/rory/cli/generators/templates/app/Gemfile.tt
|
249
|
+
- lib/rory/cli/generators/templates/app/Rakefile.tt
|
250
|
+
- lib/rory/cli/generators/templates/app/config.ru.tt
|
251
|
+
- lib/rory/cli/generators/templates/app/config/application.rb.tt
|
252
|
+
- lib/rory/cli/generators/templates/app/config/routes.rb.tt
|
253
|
+
- lib/rory/cli/generators/templates/app/controllers/application_controller.rb
|
254
|
+
- lib/rory/cli/generators/templates/app/spec/spec_helper.rb
|
255
|
+
- lib/rory/cli/root.rb
|
231
256
|
- lib/rory/controller.rb
|
232
257
|
- lib/rory/dispatcher.rb
|
233
258
|
- lib/rory/initializers.rb
|
@@ -269,6 +294,10 @@ files:
|
|
269
294
|
- spec/fixture_app/views/test/nested.html.erb
|
270
295
|
- spec/fixture_app/views/test/static.html.erb
|
271
296
|
- spec/lib/rory/application_spec.rb
|
297
|
+
- spec/lib/rory/cli/generate_spec.rb
|
298
|
+
- spec/lib/rory/cli/generators/application_spec.rb
|
299
|
+
- spec/lib/rory/cli/root_spec.rb
|
300
|
+
- spec/lib/rory/cli_spec.rb
|
272
301
|
- spec/lib/rory/controller_spec.rb
|
273
302
|
- spec/lib/rory/dispatcher_spec.rb
|
274
303
|
- spec/lib/rory/initializers_spec.rb
|
@@ -285,6 +314,7 @@ files:
|
|
285
314
|
- spec/lib/rory_spec.rb
|
286
315
|
- spec/requests/controller_spec.rb
|
287
316
|
- spec/spec_helper.rb
|
317
|
+
- spec/support/generation_helpers.rb
|
288
318
|
- spec/support/shared_examples/path_generation.rb
|
289
319
|
homepage: http://github.com/screamingmuse/rory
|
290
320
|
licenses:
|
@@ -306,9 +336,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
306
336
|
version: 1.3.6
|
307
337
|
requirements: []
|
308
338
|
rubyforge_project:
|
309
|
-
rubygems_version: 2.
|
339
|
+
rubygems_version: 2.5.1
|
310
340
|
signing_key:
|
311
341
|
specification_version: 4
|
312
342
|
summary: Another Ruby web framework. Just what the world needs.
|
313
343
|
test_files: []
|
314
|
-
has_rdoc:
|