rgentpl 1.0.9 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.yardopts +1 -1
  4. data/Capfile +27 -0
  5. data/ChangeLog.md +21 -0
  6. data/Gemfile +3 -1
  7. data/Guardfile +0 -12
  8. data/ShortLog +16 -1
  9. data/bin/rgentpl +3 -0
  10. data/config/deploy.rb +47 -0
  11. data/config/deploy/production.rb +9 -0
  12. data/config/deploy/staging.rb +9 -0
  13. data/lib/capistrano/tasks/copy_git.rake +13 -0
  14. data/lib/rgentpl.rb +6 -4
  15. data/lib/rgentpl/command/base.rb +1 -0
  16. data/lib/rgentpl/command/generate.rb +2 -0
  17. data/lib/rgentpl/core/configuration.rb +20 -10
  18. data/lib/rgentpl/core_ext/string.rb +2 -2
  19. data/lib/rgentpl/version.rb +1 -1
  20. data/rgentpl.gemspec +8 -7
  21. data/spec/lib/rgentpl/boot/application_spec.rb +4 -4
  22. data/spec/lib/rgentpl/command/base_spec.rb +4 -14
  23. data/spec/lib/rgentpl/command/generate_spec.rb +3 -3
  24. data/spec/lib/rgentpl/core/configuration_spec.rb +1 -1
  25. data/spec/spec_helper.rb +16 -34
  26. data/spec/support/.gitkeep +0 -0
  27. data/src/%app_name%.gemspec.tt +1 -2
  28. data/src/.yardopts +1 -1
  29. data/src/Gemfile +2 -0
  30. data/src/Guardfile +0 -12
  31. data/src/lib/%app_name%.rb.tt +4 -4
  32. data/src/lib/%app_name%/command/base.rb.tt +1 -0
  33. data/src/lib/%app_name%/core/configuration.rb.tt +19 -9
  34. data/src/lib/%app_name%/core_ext/string.rb.tt +15 -2
  35. data/src/spec/lib/%app_name%/boot/application_spec.rb.tt +5 -4
  36. data/src/spec/lib/%app_name%/command/base_spec.rb.tt +6 -14
  37. data/src/spec/lib/%app_name%/core/configuration_spec.rb.tt +1 -1
  38. data/src/spec/lib/%app_name%/core_ext/string_spec.rb.tt +14 -0
  39. data/src/spec/spec_helper.rb.tt +16 -34
  40. data/src/spec/support/.gitkeep +0 -0
  41. data/src/tasks/rspec.rake +1 -5
  42. data/src/tasks/rubycritic.rake +2 -0
  43. data/tasks/rspec.rake +1 -5
  44. data/tasks/rubycritic.rake +2 -0
  45. metadata +54 -35
  46. data/spec/support/helper/assertions.rb +0 -18
  47. data/src/spec/support/helper/assertions.rb.tt +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2fb0593b5bfa06f9f0ade85e838f4b9c40a4044
4
- data.tar.gz: 1f549e85aca1e69a71adfbd1dca5c93f06644197
3
+ metadata.gz: 6d9ddf9fe9c6655878347c7d84e20de11b8a1b9d
4
+ data.tar.gz: a47c97ec7cecaa6bd035fba7920265a527c6e498
5
5
  SHA512:
6
- metadata.gz: 4d4c645c1c615e739ed6e6b8c9de581d85cbfb146c77a9e1bce1d3689921108dc374fd21aa5475dde0f86d5a4575016664f48e0b65893aa326509f0e4d319e0e
7
- data.tar.gz: 2ed3c886d630e36cdf4d023acae40b2ea21cd37f5cfb87886de4eda3b7d61ec60bfae1262c6520fa8e2b011b14b2ffd6cca32f92c46005eafe896c763fbb4459
6
+ metadata.gz: 44db75a8dde382082175400d7bd386160f5e99df0c6db780077703ed4f26e55825f2033ff2fdb34b24a3faa857aca5217241f9f4c5a1b15c75ce9801ff27f5af
7
+ data.tar.gz: 293c2a5488135d77a60b99377ee5f15d5122250b2c506f40d828203da756fdb268013580dbb8a5dba783163dc6c3b0adf4ef72c26b865049cd89eca542abb139
data/.gitignore CHANGED
@@ -59,6 +59,8 @@ vendor/cache
59
59
  # Testing
60
60
  capybara*
61
61
  specifications
62
+ !spec/support/.gitkeep
63
+ !src/%app_name%.gemspec.tt/spec/support/.gitkeep
62
64
 
63
65
  # Bundle state
64
66
  .bundle
data/.yardopts CHANGED
@@ -1 +1 @@
1
- --protected --private --output-dir doc/api
1
+ --quiet --protected --private --output-dir doc/api
data/Capfile ADDED
@@ -0,0 +1,27 @@
1
+ # Load DSL and set up stages
2
+ require 'capistrano/setup'
3
+
4
+ # Include default deployment tasks
5
+ require 'capistrano/deploy'
6
+
7
+ # Include tasks from other gems included in your Gemfile
8
+ #
9
+ # For documentation on these, see for example:
10
+ #
11
+ # https://github.com/capistrano/rvm
12
+ # https://github.com/capistrano/rbenv
13
+ # https://github.com/capistrano/chruby
14
+ # https://github.com/capistrano/bundler
15
+ # https://github.com/capistrano/rails
16
+ # https://github.com/capistrano/passenger
17
+ #
18
+ require 'capistrano/rvm'
19
+ # require 'capistrano/rbenv'
20
+ # require 'capistrano/chruby'
21
+ require 'capistrano/bundler'
22
+ # require 'capistrano/rails/assets'
23
+ # require 'capistrano/rails/migrations'
24
+ # require 'capistrano/passenger'
25
+
26
+ # Load custom tasks from `lib/capistrano/tasks` if you have any defined
27
+ Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
@@ -1,4 +1,25 @@
1
1
 
2
+ 1.2.0 / 2015-05-17
3
+ ==================
4
+
5
+ * Add deploy (raw).
6
+
7
+ 1.1.0 / 2015-05-07
8
+ ==================
9
+
10
+ * Delete Spork references.
11
+ * Fix code metrics.
12
+ * Fix yard recommendations.
13
+ * Update gitignore file to exclude empty spec support directory.
14
+ * Fix typo in base spec file.
15
+ * Delete old spec assertions file.
16
+ * Add rubycritic as a default task instead of rspec.
17
+ * Fix typo in configuration spec.
18
+ * Refactoring capture stdout specs (new RSpec 3.0 feature).
19
+ * Add package name to base thor class.
20
+ * Add executables in gemspec file.
21
+ * Specify ruby version on Gemfile.
22
+
2
23
  1.0.9 / 2015-04-06
3
24
  ==================
4
25
 
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gemspec
3
+ ruby '2.1.5'
4
+
5
+ gemspec
data/Guardfile CHANGED
@@ -1,17 +1,5 @@
1
1
  notification :growl
2
2
 
3
- # Spork
4
- guard 'spork',
5
- rspec_env: { 'RAILS_ENV' => 'test' } do
6
- watch('config/environment.rb')
7
- watch('config/boot.rb')
8
- watch(%r{^config/environments/.+\.rb$})
9
- watch(%r{^config/initializers/.+\.rb$})
10
- watch(%r{^lib/.+\.rb$})
11
- watch('Gemfile.lock')
12
- watch('spec/spec_helper.rb') { :rspec }
13
- end
14
-
15
3
  # Bundler
16
4
  guard :bundler do
17
5
  watch('Gemfile')
data/ShortLog CHANGED
@@ -1,4 +1,4 @@
1
- Julio Antúnez Tarín (38):
1
+ Julio Antúnez Tarín (53):
2
2
  First sending.
3
3
  Update README and LICENSE files.
4
4
  Bumped to version 1.0.0.
@@ -37,4 +37,19 @@ Julio Antúnez Tarín (38):
37
37
  Bumped to version 1.0.8.
38
38
  Merge branch 'release-1.0.8' into develop
39
39
  Update README.md with travis build info.
40
+ Bumped to version 1.0.9.
41
+ Merge branch 'release-1.0.9' into develop
42
+ Specify ruby version on Gemfile.
43
+ Add executables in gemspec file.
44
+ Add package name to base thor class.
45
+ Refactoring capture stdout specs (new RSpec 3.0 feature).
46
+ Fix typo in configuration spec.
47
+ Add rubycritic as a default task instead of rspec.
48
+ Delete old spec assertions file.
49
+ Fix typo in base spec file.
50
+ Update gitignore file to exclude empty spec support directory.
51
+ Fix yard recommendations.
52
+ Fix code metrics.
53
+ Delete Spork references.
54
+ Add deploy (raw).
40
55
 
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'rubygems'
4
+ require 'bundler/setup'
5
+
3
6
  require File.expand_path('../../config/environment', __FILE__)
4
7
 
5
8
  # Runner
@@ -0,0 +1,47 @@
1
+ # Application name
2
+ set :application, 'rgentpl'
3
+
4
+ # Git repo URL
5
+ set :repo_url, 'git@github.com:jatap/rgentpl.git'
6
+
7
+ # Stages
8
+ set :stages, %w(staging production)
9
+ set :default_stage, 'production'
10
+
11
+ # Default deploy_to directory is /var/www/my_app_name
12
+ set :deploy_to, -> { "/usr/local/share/console/#{fetch(:application)}" }
13
+
14
+ # Default value for :format is :pretty
15
+ set :format, :pretty
16
+
17
+ # Default value for :log_level is :debug
18
+ set :log_level, :debug
19
+
20
+ # Default value for :pty is false
21
+ # set :pty, true
22
+
23
+ # Default value for :linked_files is [] (persists across deploys)
24
+ set :linked_files, fetch(:linked_files, [])
25
+
26
+ # Default value for linked_dirs is []
27
+ set :linked_dirs, fetch(:linked_dirs, [])
28
+
29
+ # Default value for default_env is {}
30
+ set :default_env, { }
31
+
32
+ # Default value for keep_releases is 5
33
+ set :keep_releases, 5
34
+
35
+ # Rvm
36
+ set :rvm_ruby_version, '2.1.5'
37
+ set :rvm_custom_path, '/usr/local/rvm'
38
+
39
+ # Bundle
40
+ set :bundle_env_variables, { }
41
+ set :bundle_gemfile, -> { release_path.join('Gemfile') }
42
+ set :bundle_dir, -> { shared_path.join('bundle') }
43
+ set :bundle_flags, '--quiet'
44
+ set :bundle_without, %w{development test}.join(' ')
45
+ # set :bundle_binstubs, -> { shared_path.join('bin') }
46
+ set :bundle_jobs, 4
47
+ set :bundle_roles, :all
@@ -0,0 +1,9 @@
1
+ # Define stage
2
+ set :stage, :production
3
+
4
+ # Server info
5
+ server 'www.rgentpl.com', user: 'deploy', group: 'console', roles: %w{web app db}
6
+ set :server_name, 'www.rgentpl.com rgentpl.com'
7
+
8
+ # Deploy branch
9
+ set :branch, :master
@@ -0,0 +1,9 @@
1
+ # Define stage
2
+ set :stage, :staging
3
+
4
+ # Server info
5
+ server 'www.rgentpl.com', user: 'deploy', group: 'console', roles: %w{web app db}
6
+ set :server_name, 'www.rgentpl.com rgentpl.com'
7
+
8
+ # Deploy branch
9
+ set :branch, :develop
@@ -0,0 +1,13 @@
1
+ namespace :deploy do
2
+ desc 'Copies .git folder'
3
+ task :copy_git do
4
+ on roles(:app) do
5
+ puts release_path
6
+ within release_path do
7
+ execute :cp, '-r', repo_path, '.git'
8
+ end
9
+ end
10
+ end
11
+
12
+ before 'bundler:install', 'deploy:copy_git'
13
+ end
@@ -1,3 +1,5 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
1
3
  require 'virtus'
2
4
  require 'thor'
3
5
  require 'logger'
@@ -6,14 +8,14 @@ require 'logger'
6
8
  module Rgentpl
7
9
  # Loading core extensions
8
10
  Dir["#{File.dirname(__FILE__)}/../lib/rgentpl/core_ext/*.rb"]
9
- .each do |f|
10
- require f
11
+ .each do |file|
12
+ require file
11
13
  end
12
14
 
13
15
  # Loading exception
14
16
  Dir["#{File.dirname(__FILE__)}/../lib/rgentpl/exception/*.rb"]
15
- .each do |f|
16
- require f
17
+ .each do |file|
18
+ require file
17
19
  end
18
20
 
19
21
  require_relative 'rgentpl/version'
@@ -8,6 +8,7 @@ module Rgentpl
8
8
  #
9
9
  # General command
10
10
  class Base < Thor
11
+ package_name 'Rgentpl'
11
12
  map '-v' => :version
12
13
 
13
14
  desc 'version, -v', 'Show Ruby Generator Template version.'
@@ -10,7 +10,9 @@ module Rgentpl
10
10
  class Generate < Thor::Group
11
11
  include Thor::Actions
12
12
 
13
+ # Application path description
13
14
  APP_PATH_DESC = 'Application path with current path as a default value'
15
+ # CTags description
14
16
  CTAGS_DESC = 'Full CTags path command (default: /usr/local/bin/ctags)'
15
17
 
16
18
  # @return [String] the final install application path
@@ -3,13 +3,13 @@ module Rgentpl
3
3
  class << self
4
4
  # Configure
5
5
  #
6
- # @param block [Proc] the configuration options
6
+ # @param _block [Proc] the configuration options
7
7
  # @raise [NoMethodError] when new options are inside configuration block
8
8
  # @return [Rgentpl::Configuration] the configuration
9
- def configure(&block)
9
+ def configure(&_block)
10
10
  yield @config ||= Rgentpl::Configuration.new
11
- rescue NoMethodError => e
12
- add_new_attribute_from_exception e
11
+ rescue NoMethodError => exc
12
+ add_new_attribute_from_exception exc
13
13
  end
14
14
 
15
15
  # Configuration object
@@ -19,16 +19,26 @@ module Rgentpl
19
19
  @config ||= Rgentpl::Configuration.new
20
20
  end
21
21
 
22
- # Add new attribute in configuration block
22
+ # Interface for adding new attribute in configuration block
23
23
  #
24
- # @param e [NoMethodError] the exception
24
+ # @param exc [NoMethodError] the exception
25
25
  # @return [void]
26
- def add_new_attribute_from_exception(e)
27
- method = e.name.to_s.gsub(/=$/, '')
26
+ def add_new_attribute_from_exception(exc)
27
+ add_new_attribute(exc, exc.name.to_s.gsub(/=$/, ''))
28
+ end
29
+
30
+ # Implementation for adding new attribute in configuration block
31
+ #
32
+ # @param exc [NoMethodError] the exception
33
+ # @param method [String] the writter method name
34
+ # @return [void]
35
+ def add_new_attribute(exc, method)
28
36
  @config.extend Virtus.model
29
- @config.attribute method.to_sym, String, default: e.args.first
30
- @config.send(e.name, e.args.first)
37
+ @config.attribute method.to_sym, String, default: exc.args.first,
38
+ lazy: true
39
+ @config.send(exc.name, exc.args.first)
31
40
  end
41
+ private :add_new_attribute
32
42
  end
33
43
 
34
44
  # Configuration
@@ -7,14 +7,14 @@ module Rgentpl
7
7
  #
8
8
  # @return [String] the camelized string
9
9
  def camelize
10
- split(/\s|-|_/).each { |s| s.capitalize! }.join('')
10
+ split(/\s|-|_/).each(&:capitalize!).join('')
11
11
  end
12
12
 
13
13
  # Camelize!
14
14
  #
15
15
  # @return [String] the camelized string
16
16
  def camelize!
17
- replace(split(/\s|-|_/).each { |s| s.capitalize! }.join(''))
17
+ replace(split(/\s|-|_/).each(&:capitalize!).join(''))
18
18
  end
19
19
  end
20
20
  end
@@ -4,5 +4,5 @@
4
4
  #
5
5
  module Rgentpl
6
6
  # Version
7
- VERSION = '1.0.9'
7
+ VERSION = '1.2.0'
8
8
  end
@@ -11,24 +11,24 @@ Gem::Specification.new do |gem|
11
11
  gem.authors = ["Julio Antúnez Tarín"]
12
12
  gem.email = "julio.antunez.tarin@gmail.com"
13
13
  gem.homepage = "https://github.com/jatap/rgentpl#readme"
14
+ gem.executables = ["rgentpl"]
14
15
 
15
16
  gem.files = `git ls-files`.split($/)
16
17
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
19
  gem.require_paths = ['lib']
19
20
 
20
- gem.add_dependency 'rake'
21
- gem.add_dependency 'virtus'
22
- gem.add_dependency 'thor'
21
+ gem.add_runtime_dependency 'rake'
22
+ gem.add_runtime_dependency 'virtus'
23
+ gem.add_runtime_dependency 'thor'
23
24
 
24
- gem.add_development_dependency 'bundler', '>= 1.0'
25
+ gem.add_development_dependency 'bundler', '>= 1.7'
25
26
  gem.add_development_dependency 'ruby_gntp'
26
27
  gem.add_development_dependency 'growl'
27
28
  gem.add_development_dependency 'listen'
28
29
  gem.add_development_dependency 'guard'
29
30
  gem.add_development_dependency 'guard-bundler'
30
31
  gem.add_development_dependency 'guard-rspec'
31
- gem.add_development_dependency 'guard-spork'
32
32
  gem.add_development_dependency 'guard-rubocop'
33
33
  gem.add_development_dependency 'guard-yard'
34
34
  gem.add_development_dependency 'guard-cane'
@@ -49,7 +49,6 @@ Gem::Specification.new do |gem|
49
49
  gem.add_development_dependency 'sdoc-templates-42floors'
50
50
  gem.add_development_dependency 'redcarpet'
51
51
  gem.add_development_dependency 'rspec', '>= 3.2'
52
- gem.add_development_dependency 'spork'
53
52
  gem.add_development_dependency 'simplecov'
54
53
  gem.add_development_dependency 'simplecov-gem-adapter'
55
54
  gem.add_development_dependency 'selenium-webdriver'
@@ -68,6 +67,8 @@ Gem::Specification.new do |gem|
68
67
  gem.add_development_dependency 'awesome_print'
69
68
  gem.add_development_dependency 'colorize'
70
69
  gem.add_development_dependency 'bcrypt-ruby'
71
-
70
+ gem.add_development_dependency 'capistrano', '>= 3.4.0'
71
+ gem.add_development_dependency 'capistrano-rvm'
72
+ gem.add_development_dependency 'capistrano-bundler', '>= 1.1.2'
72
73
  end
73
74
 
@@ -3,10 +3,10 @@ require 'spec_helper'
3
3
  describe Rgentpl::Application do
4
4
  describe '#exec' do
5
5
  it 'executes application' do
6
- stdout = capture_stdout do
7
- Rgentpl::Application.exec
8
- end
9
- expect(stdout).to match /Commands:/
6
+ # Fix rake_taks bug
7
+ ARGV = []
8
+
9
+ expect { Rgentpl::Application.exec }.to output(/commands:/).to_stdout
10
10
  end
11
11
  end
12
12
  end
@@ -12,26 +12,16 @@ describe Rgentpl::Command::Base do
12
12
  end
13
13
 
14
14
  describe 'given a help option' do
15
- before do
16
- @help = capture_stdout do
17
- Rgentpl::Command::Base.help(Thor::Base.shell.new)
18
- end
19
- end
20
-
21
15
  it 'shows help info' do
22
- expect(@help).to match(/help/)
16
+ expect { Rgentpl::Command::Base.help(Thor::Base.shell.new) }.to \
17
+ output(/help/).to_stdout
23
18
  end
24
19
  end
25
20
 
26
21
  describe 'given a version option' do
27
- before do
28
- @version = capture_stdout do
29
- Rgentpl::Command::Base.start %W[ version ]
30
- end
31
- end
32
-
33
22
  it 'shows version info' do
34
- expect(@version).to match(/version/)
23
+ expect { Rgentpl::Command::Base.start %w( version ) }.to \
24
+ output(/version/).to_stdout
35
25
  end
36
26
  end
37
27
  end
@@ -5,7 +5,7 @@ describe Rgentpl::Command::Generate do
5
5
  let(:app) { 'test_app' }
6
6
 
7
7
  before do
8
- Rgentpl::Command::Base.start %W[generate #{app}]
8
+ Rgentpl::Command::Base.start %W( generate #{app} )
9
9
  end
10
10
 
11
11
  let(:path) do
@@ -14,7 +14,7 @@ describe Rgentpl::Command::Generate do
14
14
  let(:file) { "#{path}/#{app}" }
15
15
 
16
16
  after do
17
- FileUtils.rm_rf(file) if File.exists?(file)
17
+ FileUtils.rm_rf(file) if File.exist?(file)
18
18
  end
19
19
 
20
20
  describe '#source_root' do
@@ -26,7 +26,7 @@ describe Rgentpl::Command::Generate do
26
26
 
27
27
  describe '.create_app' do
28
28
  it 'adds a new directory with defined structure' do
29
- expect(File.exists?(file)).to be
29
+ expect(File.exist?(file)).to be
30
30
  end
31
31
  end
32
32
 
@@ -34,7 +34,7 @@ describe Rgentpl::Configuration do
34
34
  expect(Rgentpl.config.new_amazing_key).to eq 'some value'
35
35
  end
36
36
 
37
- it 'updating and existing one' do
37
+ it 'updating an existing one' do
38
38
  expect(Rgentpl.config.active).to be_falsey
39
39
  end
40
40
  end
@@ -1,47 +1,29 @@
1
1
  TEMPLATE_ENV = 'test' unless defined?(TEMPLATE_ENV)
2
2
 
3
3
  require 'rubygems'
4
- require 'spork'
5
4
  require 'pry'
6
5
 
7
- Spork.prefork do
8
- # Loading more in this block will cause your tests to run faster. However,
9
- # if you change any configuration or code from libraries loaded here, you'll
10
- # need to restart spork for it take effect.
6
+ ENV['RUBY_ENV'] ||= 'test'
11
7
 
12
- ENV['RUBY_ENV'] ||= 'test'
13
-
14
- unless ENV['DRB']
15
- require 'simplecov'
16
- require 'simplecov-gem-adapter'
17
- SimpleCov.start 'gem'
18
- end
19
-
20
- require 'rspec'
21
- require 'capybara'
22
-
23
- require File.dirname(__FILE__) + '/../config/environment'
8
+ unless ENV['DRB']
9
+ require 'simplecov'
10
+ require 'simplecov-gem-adapter'
11
+ SimpleCov.start 'gem'
12
+ end
24
13
 
25
- # Load support files
26
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
14
+ require 'rspec'
15
+ require 'capybara'
27
16
 
28
- # Include main application module
29
- include Rgentpl
17
+ require File.dirname(__FILE__) + '/../config/environment'
30
18
 
31
- RSpec.configure do |config|
32
- config.include Rgentpl::Helper::Assertions
19
+ # Load support files
20
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
33
21
 
34
- config.mock_with :rspec
22
+ # Include main application module
23
+ include Rgentpl
35
24
 
36
- config.order = 'random'
37
- end
38
- end
25
+ RSpec.configure do |config|
26
+ config.mock_with :rspec
39
27
 
40
- Spork.each_run do
41
- # This code will be run each time you run your specs.
42
- unless ENV['DRB']
43
- require 'simplecov'
44
- require 'simplecov-gem-adapter'
45
- SimpleCov.start 'gem'
46
- end
28
+ config.order = 'random'
47
29
  end
File without changes
@@ -11,6 +11,7 @@ Gem::Specification.new do |gem|
11
11
  gem.authors = ["Julio Antúnez Tarín"]
12
12
  gem.email = "julio.antunez.tarin@gmail.com"
13
13
  gem.homepage = "https://github.com/jatap/<%= app_name %>#readme"
14
+ gem.executables = ["<%= app_name %>"]
14
15
 
15
16
  gem.files = `git ls-files`.split($/)
16
17
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -28,7 +29,6 @@ Gem::Specification.new do |gem|
28
29
  gem.add_development_dependency 'guard'
29
30
  gem.add_development_dependency 'guard-bundler'
30
31
  gem.add_development_dependency 'guard-rspec'
31
- gem.add_development_dependency 'guard-spork'
32
32
  gem.add_development_dependency 'guard-rubocop'
33
33
  gem.add_development_dependency 'guard-yard'
34
34
  gem.add_development_dependency 'guard-cane'
@@ -49,7 +49,6 @@ Gem::Specification.new do |gem|
49
49
  gem.add_development_dependency 'sdoc-templates-42floors'
50
50
  gem.add_development_dependency 'redcarpet'
51
51
  gem.add_development_dependency 'rspec', '>= 3.2'
52
- gem.add_development_dependency 'spork'
53
52
  gem.add_development_dependency 'simplecov'
54
53
  gem.add_development_dependency 'simplecov-gem-adapter'
55
54
  gem.add_development_dependency 'selenium-webdriver'
@@ -1 +1 @@
1
- --protected --private --output-dir doc/api
1
+ --quiet --protected --private --output-dir doc/api
@@ -1,3 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ ruby '2.1.5'
4
+
3
5
  gemspec
@@ -1,17 +1,5 @@
1
1
  notification :growl
2
2
 
3
- # Spork
4
- guard 'spork',
5
- rspec_env: { 'RAILS_ENV' => 'test' } do
6
- watch('config/environment.rb')
7
- watch('config/boot.rb')
8
- watch(%r{^config/environments/.+\.rb$})
9
- watch(%r{^config/initializers/.+\.rb$})
10
- watch(%r{^lib/.+\.rb$})
11
- watch('Gemfile.lock')
12
- watch('spec/spec_helper.rb') { :rspec }
13
- end
14
-
15
3
  # Bundler
16
4
  guard :bundler do
17
5
  watch('Gemfile')
@@ -6,14 +6,14 @@ require 'logger'
6
6
  module <%= app_name.camelize %>
7
7
  # Loading core extensions
8
8
  Dir["#{File.dirname(__FILE__)}/../lib/<%= app_name %>/core_ext/*.rb"]
9
- .each do |f|
10
- require f
9
+ .each do |file|
10
+ require file
11
11
  end
12
12
 
13
13
  # Loading exception
14
14
  Dir["#{File.dirname(__FILE__)}/../lib/<%= app_name %>/exception/*.rb"]
15
- .each do |f|
16
- require f
15
+ .each do |file|
16
+ require file
17
17
  end
18
18
 
19
19
  require_relative '<%= app_name %>/version'
@@ -8,6 +8,7 @@ module <%= app_name.camelize %>
8
8
  #
9
9
  # General command
10
10
  class Base < Thor
11
+ package_name '<%= app_name.camelize %>'
11
12
  map '-v' => :version
12
13
 
13
14
  desc 'version, -v', 'Show <%= app_name.camelize %> version.'
@@ -3,13 +3,13 @@ module <%= app_name.camelize %>
3
3
  class << self
4
4
  # Configure
5
5
  #
6
- # @param block [Proc] the configuration options
6
+ # @param _block [Proc] the configuration options
7
7
  # @raise [NoMethodError] when new options are inside configuration block
8
8
  # @return [<%= app_name.camelize %>::Configuration] the configuration
9
- def configure(&block)
9
+ def configure(&_block)
10
10
  yield @config ||= <%= app_name.camelize %>::Configuration.new
11
- rescue NoMethodError => e
12
- add_new_attribute_from_exception e
11
+ rescue NoMethodError => exc
12
+ add_new_attribute_from_exception exc
13
13
  end
14
14
 
15
15
  # Configuration object
@@ -21,14 +21,24 @@ module <%= app_name.camelize %>
21
21
 
22
22
  # Add new attribute in configuration block
23
23
  #
24
- # @param e [NoMethodError] the exception
24
+ # @param exc [NoMethodError] the exception
25
25
  # @return [void]
26
- def add_new_attribute_from_exception(e)
27
- method = e.name.to_s.gsub(/=$/, '')
26
+ def add_new_attribute_from_exception(exc)
27
+ add_new_attribute(exc, exc.name.to_s.gsub(/=$/, ''))
28
+ end
29
+
30
+ # Implementation for adding new attribute in configuration block
31
+ #
32
+ # @param exc [NoMethodError] the exception
33
+ # @param method [String] the writter method name
34
+ # @return [void]
35
+ def add_new_attribute(exc, method)
28
36
  @config.extend Virtus.model
29
- @config.attribute method.to_sym, String, default: e.args.first
30
- @config.send(e.name, e.args.first)
37
+ @config.attribute method.to_sym, String, default: exc.args.first,
38
+ lazy: true
39
+ @config.send(exc.name, exc.args.first)
31
40
  end
41
+ private :add_new_attribute
32
42
  end
33
43
 
34
44
  # Configuration
@@ -2,7 +2,20 @@
2
2
  module <%= app_name.camelize %>
3
3
  # Core Extensions
4
4
  module CoreExt
5
- # String.class_eval do
6
- # end
5
+ String.class_eval do
6
+ # Camelize
7
+ #
8
+ # @return [String] the camelized string
9
+ def camelize
10
+ split(/\s|-|_/).each(&:capitalize!).join('')
11
+ end
12
+
13
+ # Camelize!
14
+ #
15
+ # @return [String] the camelized string
16
+ def camelize!
17
+ replace(split(/\s|-|_/).each(&:capitalize!).join(''))
18
+ end
19
+ end
7
20
  end
8
21
  end
@@ -3,10 +3,11 @@ require 'spec_helper'
3
3
  describe <%= app_name.camelize %>::Application do
4
4
  describe '#exec' do
5
5
  it 'executes application' do
6
- stdout = capture_stdout do
7
- <%= app_name.camelize %>::Application.exec
8
- end
9
- expect(stdout).to match /Commands:/
6
+ # Fix rake_taks bug
7
+ ARGV = []
8
+
9
+ expect { <% app_name.camelize %>::Application.exec }.to \
10
+ output(/commands:/).to_stdout
10
11
  end
11
12
  end
12
13
  end
@@ -12,26 +12,18 @@ describe <%= app_name.camelize %>::Command::Base do
12
12
  end
13
13
 
14
14
  describe 'given a help option' do
15
- before do
16
- @help = capture_stdout do
17
- <%= app_name.camelize %>::Command::Base.help(Thor::Base.shell.new)
18
- end
19
- end
20
-
21
15
  it 'shows help info' do
22
- expect(@help).to match(/help/)
16
+ camelize = <% app_name.camelize %>
17
+ expect { camelize::Command::Base.help(Thor::Base.shell.new) }.to \
18
+ output(/help/).to_stdout
23
19
  end
24
20
  end
25
21
 
26
22
  describe 'given a version option' do
27
- before do
28
- @version = capture_stdout do
29
- <%= app_name.camelize %>::Command::Base.start %W[ version ]
30
- end
31
- end
32
-
33
23
  it 'shows version info' do
34
- expect(@version).to match(/version/)
24
+ camelize = <% app_name.camelize %>
25
+ expect { camelize::Command::Base.start %w( version ) }.to \
26
+ output(/version/).to_stdout
35
27
  end
36
28
  end
37
29
  end
@@ -34,7 +34,7 @@ describe <%= app_name.camelize %>::Configuration do
34
34
  expect(<%= app_name.camelize %>.config.new_amazing_key).to eq 'some value'
35
35
  end
36
36
 
37
- it 'updating and existing one' do
37
+ it 'updating an existing one' do
38
38
  expect(<%= app_name.camelize %>.config.active).to be_falsey
39
39
  end
40
40
  end
@@ -1,4 +1,18 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe <%= app_name.camelize %>::CoreExt do
4
+ let(:str) { String.new('My custom string') }
5
+ let(:result) { 'MyCustomString' }
6
+
7
+ describe '.camelize' do
8
+ it 'format according to camelize rules' do
9
+ expect(str.camelize).to eq result
10
+ end
11
+ end
12
+
13
+ describe '.camelize!' do
14
+ it 'persists result into variable' do
15
+ expect { str.camelize! }.to change { str }
16
+ end
17
+ end
4
18
  end
@@ -1,47 +1,29 @@
1
1
  TEMPLATE_ENV = 'test' unless defined?(TEMPLATE_ENV)
2
2
 
3
3
  require 'rubygems'
4
- require 'spork'
5
4
  require 'pry'
6
5
 
7
- Spork.prefork do
8
- # Loading more in this block will cause your tests to run faster. However,
9
- # if you change any configuration or code from libraries loaded here, you'll
10
- # need to restart spork for it take effect.
6
+ ENV['RUBY_ENV'] ||= 'test'
11
7
 
12
- ENV['RUBY_ENV'] ||= 'test'
13
-
14
- unless ENV['DRB']
15
- require 'simplecov'
16
- require 'simplecov-gem-adapter'
17
- SimpleCov.start 'gem'
18
- end
19
-
20
- require 'rspec'
21
- require 'capybara'
22
-
23
- require File.dirname(__FILE__) + '/../config/environment.rb'
8
+ unless ENV['DRB']
9
+ require 'simplecov'
10
+ require 'simplecov-gem-adapter'
11
+ SimpleCov.start 'gem'
12
+ end
24
13
 
25
- # Load support files
26
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
14
+ require 'rspec'
15
+ require 'capybara'
27
16
 
28
- # Include main application module
29
- include <%= app_name.camelize %>
17
+ require File.dirname(__FILE__) + '/../config/environment.rb'
30
18
 
31
- RSpec.configure do |config|
32
- config.include <%= app_name.camelize %>::Helper::Assertions
19
+ # Load support files
20
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
33
21
 
34
- config.mock_with :rspec
22
+ # Include main application module
23
+ include <%= app_name.camelize %>
35
24
 
36
- config.order = 'random'
37
- end
38
- end
25
+ RSpec.configure do |config|
26
+ config.mock_with :rspec
39
27
 
40
- Spork.each_run do
41
- # This code will be run each time you run your specs.
42
- unless ENV['DRB']
43
- require 'simplecov'
44
- require 'simplecov-gem-adapter'
45
- SimpleCov.start 'gem'
46
- end
28
+ config.order = 'random'
47
29
  end
File without changes
@@ -3,11 +3,7 @@ if ['test', 'development'].include?(TEMPLATE_ENV)
3
3
  require 'rspec/core/rake_task'
4
4
 
5
5
  desc 'Run the specs under spec/'
6
- RSpec::Core::RakeTask.new do |t|
6
+ RSpec::Core::RakeTask.new(:spec) do |t|
7
7
  t.rspec_opts = ['--options', '.rspec']
8
8
  end
9
-
10
- # Want other tests/tasks run by default?
11
- # Add them to the list
12
- task :default => [:spec]
13
9
  end
@@ -8,4 +8,6 @@ namespace :rubycritic do
8
8
  sh('rubycritic lib')
9
9
  puts '- Process has finished.'.green
10
10
  end
11
+
12
+ task :default => [:check]
11
13
  end
@@ -3,11 +3,7 @@ if ['test', 'development'].include?(TEMPLATE_ENV)
3
3
  require 'rspec/core/rake_task'
4
4
 
5
5
  desc 'Run the specs under spec/'
6
- RSpec::Core::RakeTask.new do |t|
6
+ RSpec::Core::RakeTask.new(:spec) do |t|
7
7
  t.rspec_opts = ['--options', '.rspec']
8
8
  end
9
-
10
- # Want other tests/tasks run by default?
11
- # Add them to the list
12
- task :default => [:spec]
13
9
  end
@@ -8,4 +8,6 @@ namespace :rubycritic do
8
8
  sh('rubycritic lib')
9
9
  puts '- Process has finished.'.green
10
10
  end
11
+
12
+ task :default => [:check]
11
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgentpl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julio Antúnez Tarín
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '1.0'
61
+ version: '1.7'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '1.0'
68
+ version: '1.7'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: ruby_gntp
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -150,20 +150,6 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: guard-spork
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
153
  - !ruby/object:Gem::Dependency
168
154
  name: guard-rubocop
169
155
  requirement: !ruby/object:Gem::Requirement
@@ -444,20 +430,6 @@ dependencies:
444
430
  - - ">="
445
431
  - !ruby/object:Gem::Version
446
432
  version: '3.2'
447
- - !ruby/object:Gem::Dependency
448
- name: spork
449
- requirement: !ruby/object:Gem::Requirement
450
- requirements:
451
- - - ">="
452
- - !ruby/object:Gem::Version
453
- version: '0'
454
- type: :development
455
- prerelease: false
456
- version_requirements: !ruby/object:Gem::Requirement
457
- requirements:
458
- - - ">="
459
- - !ruby/object:Gem::Version
460
- version: '0'
461
433
  - !ruby/object:Gem::Dependency
462
434
  name: simplecov
463
435
  requirement: !ruby/object:Gem::Requirement
@@ -710,6 +682,48 @@ dependencies:
710
682
  - - ">="
711
683
  - !ruby/object:Gem::Version
712
684
  version: '0'
685
+ - !ruby/object:Gem::Dependency
686
+ name: capistrano
687
+ requirement: !ruby/object:Gem::Requirement
688
+ requirements:
689
+ - - ">="
690
+ - !ruby/object:Gem::Version
691
+ version: 3.4.0
692
+ type: :development
693
+ prerelease: false
694
+ version_requirements: !ruby/object:Gem::Requirement
695
+ requirements:
696
+ - - ">="
697
+ - !ruby/object:Gem::Version
698
+ version: 3.4.0
699
+ - !ruby/object:Gem::Dependency
700
+ name: capistrano-rvm
701
+ requirement: !ruby/object:Gem::Requirement
702
+ requirements:
703
+ - - ">="
704
+ - !ruby/object:Gem::Version
705
+ version: '0'
706
+ type: :development
707
+ prerelease: false
708
+ version_requirements: !ruby/object:Gem::Requirement
709
+ requirements:
710
+ - - ">="
711
+ - !ruby/object:Gem::Version
712
+ version: '0'
713
+ - !ruby/object:Gem::Dependency
714
+ name: capistrano-bundler
715
+ requirement: !ruby/object:Gem::Requirement
716
+ requirements:
717
+ - - ">="
718
+ - !ruby/object:Gem::Version
719
+ version: 1.1.2
720
+ type: :development
721
+ prerelease: false
722
+ version_requirements: !ruby/object:Gem::Requirement
723
+ requirements:
724
+ - - ">="
725
+ - !ruby/object:Gem::Version
726
+ version: 1.1.2
713
727
  description: Ruby Skeleton Generator based in templates
714
728
  email: julio.antunez.tarin@gmail.com
715
729
  executables:
@@ -727,6 +741,7 @@ files:
727
741
  - ".ruby-version"
728
742
  - ".travis.yml"
729
743
  - ".yardopts"
744
+ - Capfile
730
745
  - ChangeLog.md
731
746
  - Gemfile
732
747
  - Guardfile
@@ -737,10 +752,14 @@ files:
737
752
  - ShortLog
738
753
  - bin/rgentpl
739
754
  - config/boot.rb
755
+ - config/deploy.rb
756
+ - config/deploy/production.rb
757
+ - config/deploy/staging.rb
740
758
  - config/environment.rb
741
759
  - config/environments/development.rb
742
760
  - config/environments/production.rb
743
761
  - config/environments/test.rb
762
+ - lib/capistrano/tasks/copy_git.rake
744
763
  - lib/rgentpl.rb
745
764
  - lib/rgentpl/boot/application.rb
746
765
  - lib/rgentpl/boot/initializer.rb
@@ -760,7 +779,7 @@ files:
760
779
  - spec/lib/rgentpl/core_ext/string_spec.rb
761
780
  - spec/lib/rgentpl_spec.rb
762
781
  - spec/spec_helper.rb
763
- - spec/support/helper/assertions.rb
782
+ - spec/support/.gitkeep
764
783
  - src/%app_name%.gemspec.tt
765
784
  - src/.cane
766
785
  - src/.document
@@ -806,7 +825,7 @@ files:
806
825
  - src/spec/lib/%app_name%/exception/.gitignore
807
826
  - src/spec/lib/%app_name%_spec.rb.tt
808
827
  - src/spec/spec_helper.rb.tt
809
- - src/spec/support/helper/assertions.rb.tt
828
+ - src/spec/support/.gitkeep
810
829
  - src/tasks/excellent.rake
811
830
  - src/tasks/quality.rake
812
831
  - src/tasks/rspec.rake
@@ -841,7 +860,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
841
860
  version: '0'
842
861
  requirements: []
843
862
  rubyforge_project:
844
- rubygems_version: 2.4.3
863
+ rubygems_version: 2.4.7
845
864
  signing_key:
846
865
  specification_version: 4
847
866
  summary: Ruby Skeleton Generator
@@ -854,5 +873,5 @@ test_files:
854
873
  - spec/lib/rgentpl/core_ext/string_spec.rb
855
874
  - spec/lib/rgentpl_spec.rb
856
875
  - spec/spec_helper.rb
857
- - spec/support/helper/assertions.rb
876
+ - spec/support/.gitkeep
858
877
  has_rdoc:
@@ -1,18 +0,0 @@
1
- require 'stringio'
2
-
3
- module Rgentpl
4
- module Helper
5
- module Assertions
6
- def capture_stdout(&block)
7
- old_stdout = $stdout
8
- fake = StringIO.new
9
- $stdout = fake
10
-
11
- block.call
12
- fake.string
13
- ensure
14
- $stdout = old_stdout
15
- end
16
- end
17
- end
18
- end
@@ -1,18 +0,0 @@
1
- require 'stringio'
2
-
3
- module <%= app_name.camelize %>
4
- module Helper
5
- module Assertions
6
- def capture_stdout(&block)
7
- old_stdout = $stdout
8
- fake = StringIO.new
9
- $stdout = fake
10
-
11
- block.call
12
- fake.string
13
- ensure
14
- $stdout = old_stdout
15
- end
16
- end
17
- end
18
- end