myrails 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/myrails/templates/engines/rakefile +21 -0
- data/lib/myrails/version.rb +1 -1
- data/lib/myrails.rb +53 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dde9aa23a4216392eaa454f9666f325243890a06
|
4
|
+
data.tar.gz: a2ebad86347303b613be67dbe8bd285a5f7a9bae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7ba1481d70d8ab8ddf69e39166bee322e2941bf101b77f8e56c6a6e0eb0629382c6a4e51a3c55302cdb740076a3386b4b0d573789028d0642d45f8c4db21850
|
7
|
+
data.tar.gz: 7ab2caaf2cb3f0e2e39efe166035c9586470aed229f8681ba95779564463e28ed6231d319d0200b94c40db6c6419c00ec392fe71d3eba57069679310755f2b13
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
|
8
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
9
|
+
load 'rails/tasks/engine.rake'
|
10
|
+
|
11
|
+
Bundler::GemHelper.install_tasks
|
12
|
+
|
13
|
+
Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }
|
14
|
+
|
15
|
+
require 'rspec/core'
|
16
|
+
require 'rspec/core/rake_task'
|
17
|
+
|
18
|
+
desc "Run all specs in spec directory (excluding plugin specs)"
|
19
|
+
RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
|
20
|
+
|
21
|
+
task :default => :spec
|
data/lib/myrails/version.rb
CHANGED
data/lib/myrails.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require_relative "../lib/myrails/version"
|
2
1
|
require 'thor'
|
3
2
|
require 'active_support/all'
|
3
|
+
require_relative "../lib/myrails/version"
|
4
4
|
|
5
5
|
module Myrails
|
6
6
|
class Myrails < Thor
|
@@ -407,6 +407,58 @@ gem 'rspec-rails', group: :test
|
|
407
407
|
run "touch app/views/ui/#{name}.html.haml"
|
408
408
|
say "DON'T FORGET: Restart Powify App"
|
409
409
|
end
|
410
|
+
|
411
|
+
desc 'engine(full | mountable)', 'Generate a full or mountable engine. default: mountable'
|
412
|
+
option :name, required: true
|
413
|
+
def engine(etype='mountable')
|
414
|
+
run "rails plugin new #{options[:name]} --dummy-path=spec/dummy --skip-test-unit --#{etype}"
|
415
|
+
end
|
416
|
+
|
417
|
+
desc 'engine_setup', 'Configure rails engine for development with RSpec, Capybara and FactoryGirl'
|
418
|
+
option :name, required: true
|
419
|
+
def engine_setup
|
420
|
+
gsub_file "#{options[:name]}.gemspec", 's.homepage = "TODO"', 's.homepage = "http://TBD.com"'
|
421
|
+
|
422
|
+
gsub_file "#{options[:name]}.gemspec", "s.summary = \"TODO: Summary of #{options[:name].camelize}.\"", "s.summary = \"Summary of #{options[:name].camelize}.\""
|
423
|
+
|
424
|
+
gsub_file "#{options[:name]}.gemspec", "s.description = \"TODO: Description of #{options[:name].camelize}.\"", "s.description = \"Description of #{options[:name].camelize}.\""
|
425
|
+
|
426
|
+
inject_into_file "#{options[:name]}.gemspec", after: "s.license = \"MIT\"\n" do <<-CODE
|
427
|
+
s.test_files = Dir["spec/**/*"]
|
428
|
+
CODE
|
429
|
+
end
|
430
|
+
|
431
|
+
inject_into_file "#{options[:name]}.gemspec", after: "s.add_development_dependency \"sqlite3\"\n" do <<-CODE
|
432
|
+
s.add_development_dependency 'rspec-rails'
|
433
|
+
s.add_development_dependency 'capybara'
|
434
|
+
s.add_development_dependency 'factory_girl_rails'
|
435
|
+
CODE
|
436
|
+
end
|
437
|
+
|
438
|
+
run 'bundle'
|
439
|
+
copy_file 'engines/rakefile', 'Rakefile'
|
440
|
+
|
441
|
+
run 'rails g rspec:install'
|
442
|
+
gsub_file 'spec/rails_helper.rb', "# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }", "Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }"
|
443
|
+
|
444
|
+
inject_into_file 'spec/rails_helper.rb', after: "RSpec.configure do |config|\n" do <<-CODE
|
445
|
+
config.mock_with :rspec
|
446
|
+
config.infer_base_class_for_anonymous_controllers = false
|
447
|
+
config.order = "random"
|
448
|
+
CODE
|
449
|
+
end
|
450
|
+
|
451
|
+
inject_into_file "lib/#{options[:name]}/engine.rb", after: "class Engine < ::Rails::Engine\n" do <<-CODE
|
452
|
+
config.generators do |g|
|
453
|
+
g.test_framework :rspec, :fixture => false
|
454
|
+
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
|
455
|
+
g.assets false
|
456
|
+
g.helper false
|
457
|
+
end
|
458
|
+
CODE
|
459
|
+
end
|
460
|
+
end
|
461
|
+
|
410
462
|
end
|
411
463
|
end
|
412
464
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myrails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- lib/myrails/templates/assets/will_paginate.scss
|
120
120
|
- lib/myrails/templates/db/mysql_database.yml
|
121
121
|
- lib/myrails/templates/db/sqlite3_database.yml
|
122
|
+
- lib/myrails/templates/engines/rakefile
|
122
123
|
- lib/myrails/templates/heroku/Procfile
|
123
124
|
- lib/myrails/templates/heroku/puma.rb
|
124
125
|
- lib/myrails/templates/layout/_error_messages.html.haml
|