tractor_beam 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75dd77823d41fe116f0fc1b2d8285e150f1e1f772d1d74c520241f288ef82ea4
4
- data.tar.gz: fd19dea1a3946b93220ab38e6eafba1f280fc73a5461ff3e419af08d334eae23
3
+ metadata.gz: 64584c275563a08caaa9c7cabea725568cb3bafb61a1b69dcf89d1b62e70bbb8
4
+ data.tar.gz: 5ad8f512443dda4f272d30378736995461f96f4b656ff5d6891e25d7ceff6330
5
5
  SHA512:
6
- metadata.gz: 59513cd6a6ffbe68e575a5418aa0a9ff605bc1a7ab2cdf259e8766b7b572a8fe1ba7c6af0a4d18514cfe7925a8caf0ca061bf4c57fa591a08f4926c04e38c6a0
7
- data.tar.gz: 88b2da410bad5e396f0faa3e0d347e78598edd48f1b4ac8dc8da1ab05c987a26758a95865ea635d854b8974902c255b49ddadc8e51b5d6c56683cebd6dcfaecc
6
+ metadata.gz: 0e0d9a7d94409c46461a81028536a2d82346458fa3d656a128ef3bed596a2a0aec0bfc64e87d296a7a06a96dd672e87a5b0537a03b3813f89b2f49eb69f8321b
7
+ data.tar.gz: fa307f3366c8b9777be41fcbc6108c07ddb02d5e2fda3ea07af237c824648caede26e91d3a80c85087560307b8ddf06a9e91456afa52345918547544a7c711c6
data/.travis.yml CHANGED
@@ -7,7 +7,7 @@ before_install:
7
7
  - git config --global user.name 'Travis CI'
8
8
  - git config --global user.email 'travis-ci@example.com'
9
9
  - gem update --system
10
- -
10
+
11
11
  install: bundle install
12
12
 
13
13
  env:
@@ -16,10 +16,14 @@ env:
16
16
 
17
17
  before_script:
18
18
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
19
- - chmod +x ./cc-test-reporter
19
+ - chmod +x ./cc-test-reportert
20
20
  - ./cc-test-reporter before-build
21
21
 
22
22
  script:
23
23
  - bundle exec rubocop
24
24
  - bundle exec rspec
25
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
25
+
26
+ after_script:
27
+ - ./cc-test-reporter format-coverage -t simplecov -o coverage/codeclimate.backend.json coverage/backend/.resultset.json
28
+ - ./cc-test-reporter sum-coverage coverage/codeclimate.*.json -p 2
29
+ - if [[ "$TRAVIS_TEST_RESULT" == 0 ]]; then ./cc-test-reporter upload-coverage; fi
data/CHANGELOG.md CHANGED
@@ -1,9 +1,22 @@
1
1
  # Change log
2
2
 
3
- ## 0.1.2 (2018-01-017)
3
+ ## 0.1.2 (2018-01-17)
4
4
 
5
5
  * Add rubocop development dependency
6
6
  * Setup project on Travis CI
7
7
  * Ensure jquery-ujs yarn package is installed
8
8
  * Ensure actioncable yarn package is install unless `skip_action_cable` option is true
9
9
  * Ensure turbolinks yarn package is install unless `skip_turbolinks` option is true
10
+
11
+ ## 0.1.3 (2018-02-17)
12
+
13
+ ### Project Changes
14
+ * rename SusperdersTestHelpers to TractoBeamTestHepers
15
+
16
+ ### Generator features
17
+ * use rails 5.2
18
+ * setup rspec, simplecov, bundler-audit, shoulda-matchers, and factory-bot
19
+ * customize rakefile for assets precompilations with yarn on heroku
20
+
21
+ ## 0.1.4 (2018-02-17)
22
+ * revert to rails 5.1.5
data/README.md CHANGED
@@ -96,11 +96,10 @@ frontend/components
96
96
  * [stylelint-config-standard](https://github.com/stylelint/stylelint-config-standard) the standard shareable config for stylelint.
97
97
 
98
98
  ## Todo List
99
- - [ ] Write Specs
100
99
  - [ ] Normalize css
101
100
  - [ ] Simple Form
102
- - [ ] Testing configuration
103
- - [ ] Coverage
101
+ - [x] Testing configuration
102
+ - [x] Coverage
104
103
  - [ ] shoulda-matchers
105
104
  - [ ] Factory Bot
106
105
  - [ ] CI configuration
@@ -15,7 +15,7 @@ module TractorBeam
15
15
  end
16
16
 
17
17
  def set_ruby_version
18
- create_file ".ruby-version", "#{TractorBeam::RUBY_VERSION}\n"
18
+ create_file ".ruby-version", "#{TractorBeam::RUBY_VERSION}\n", force: true
19
19
  end
20
20
 
21
21
  def procfile_dev
@@ -26,6 +26,10 @@ module TractorBeam
26
26
  template "Procfile", "Procfile"
27
27
  end
28
28
 
29
+ def boot_file
30
+ template "boot_rb", "config/boot.rb", force: true
31
+ end
32
+
29
33
  def provide_setup_script
30
34
  template "bin_setup", "bin/setup", force: true
31
35
  run "chmod a+x bin/setup"
@@ -71,6 +75,12 @@ module TractorBeam
71
75
  after: "protect_from_forgery with: :exception\n"
72
76
  end
73
77
 
78
+ def customize_rakefile
79
+ insert_into_file "Rakefile",
80
+ %{\nRake::Task.define_task("assets:precompile" => ["yarn:install", "webpacker:compile"])\n},
81
+ after: "require_relative 'config/application'\n"
82
+ end
83
+
74
84
  # Linting
75
85
 
76
86
  def setup_js_linter
@@ -168,5 +178,13 @@ module TractorBeam
168
178
 
169
179
  run "yarn add turbolinks"
170
180
  end
181
+
182
+ # Test environment
183
+
184
+ def setup_rspec
185
+ run "bin/rails g rspec:install"
186
+
187
+ template "rails_helper", "spec/rails_helper.rb", force: true
188
+ end
171
189
  end
172
190
  end
@@ -37,20 +37,21 @@ module TractorBeam
37
37
  class_option :webpack, type: :string, default: "webpack",
38
38
  desc: "Preconfigure for app-like JavaScript with Webpack (options: #{WEBPACKS.join('/')})"
39
39
 
40
- # def finish_template
41
- # invoke :beam_customizations
42
- #
43
- # super
44
- # end
40
+ def finish_template
41
+ invoke :beam_customizations
42
+
43
+ super
44
+ end
45
45
 
46
46
  def beam_customizations
47
47
  build :set_ruby_version
48
48
 
49
49
  invoke :setup_development_environment
50
- invoke :setup_production_environment
51
50
  invoke :run_bundle
52
51
  invoke :run_webpack
53
- invoke :setup_defaul_rails_features_on_webpack
52
+ invoke :setup_test_environment
53
+ invoke :setup_production_environment
54
+ invoke :setup_default_rails_features_on_webpack
54
55
  invoke :setup_component_based_frontend
55
56
  invoke :setup_linters
56
57
  invoke :generate_spring_binstubs
@@ -86,13 +87,21 @@ module TractorBeam
86
87
  build :provide_setup_script
87
88
  end
88
89
 
90
+ def setup_test_environment
91
+ say "Setting up test environment"
92
+
93
+ build :setup_rspec
94
+ end
95
+
89
96
  def setup_production_environment
90
97
  say "Setting up production environment"
91
98
 
99
+ build :customize_rakefile
100
+ # build :boot_file
92
101
  build :procfile
93
102
  end
94
103
 
95
- def setup_defaul_rails_features_on_webpack
104
+ def setup_default_rails_features_on_webpack
96
105
  build :setup_rails_ujs
97
106
  build :setup_actioncable
98
107
  build :setup_turbolinks
@@ -3,5 +3,5 @@
3
3
  module TractorBeam
4
4
  RAILS_VERSION = "~> 5.1.4"
5
5
  RUBY_VERSION = "2.5.0"
6
- VERSION = "0.1.2"
6
+ VERSION = "0.1.4"
7
7
  end
@@ -19,21 +19,32 @@ RSpec.describe "Bootstraps new project with default configuration" do
19
19
  )
20
20
  end
21
21
 
22
- # it "ensures project specs pass" do
23
- # Dir.chdir(project_path) do
24
- # Bundler.with_clean_env do
25
- # expect(`rake`).to include('0 failures')
26
- # end
27
- # end
28
- # end
22
+ it "Rakefile includes assets customization" do
23
+ rakefile = IO.read("#{project_path}/Rakefile")
24
+ expect(rakefile).to include(
25
+ 'Rake::Task.define_task("assets:precompile" => ["yarn:install", "webpacker:compile"])',
26
+ )
27
+ end
29
28
 
30
- # it "includes the bundle:audit task" do
31
- # Dir.chdir(project_path) do
32
- # Bundler.with_clean_env do
33
- # expect(`rails -T`).to include("rails bundle:audit")
34
- # end
35
- # end
36
- # end
29
+ it "rspec files are included in the project" do
30
+ expect(File).to exist("#{project_path}/spec/spec_helper.rb")
31
+ expect(File).to exist("#{project_path}/spec/rails_helper.rb")
32
+ end
33
+
34
+ it "includes simplecov configuration" do
35
+ rails_helper = IO.read("#{project_path}/spec/rails_helper.rb")
36
+ expect(rails_helper).to include("require 'simplecov'")
37
+ end
38
+
39
+ it "includes FactoryBot configuration" do
40
+ rails_helper = IO.read("#{project_path}/spec/rails_helper.rb")
41
+ expect(rails_helper).to include("config.include FactoryBot::Syntax::Methods")
42
+ end
43
+
44
+ it "includes ShouldaMatchers configuration" do
45
+ rails_helper = IO.read("#{project_path}/spec/rails_helper.rb")
46
+ expect(rails_helper).to include("Shoulda::Matchers.configure")
47
+ end
37
48
 
38
49
  it "creates .ruby-version from TractorBeam .ruby-version" do
39
50
  ruby_version_file = IO.read("#{project_path}/.ruby-version")
data/spec/spec_helper.rb CHANGED
@@ -1,10 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "simplecov"
4
- if ENV["CIRCLE_ARTIFACTS"]
5
- dir = File.join(ENV["CIRCLE_ARTIFACTS"], "coverage")
6
- SimpleCov.coverage_dir(dir)
7
- end
8
4
  SimpleCov.start do
9
5
  add_filter "/spec/"
10
6
  end
@@ -15,7 +11,7 @@ Bundler.require(:default, :test)
15
11
  Dir["./spec/support/**/*.rb"].each { |file| require file }
16
12
 
17
13
  RSpec.configure do |config|
18
- config.include SuspendersTestHelpers
14
+ config.include TractorBeamTestHelpers
19
15
 
20
16
  config.before(:all) do
21
17
  create_tmp_directory
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module SuspendersTestHelpers
3
+ module TractorBeamTestHelpers
4
4
  APP_NAME = "dummy_app"
5
5
 
6
6
  def remove_project_directory
@@ -27,16 +27,6 @@ module SuspendersTestHelpers
27
27
  end
28
28
  end
29
29
 
30
- def setup_app_dependencies
31
- return unless File.exist?(project_path)
32
-
33
- Dir.chdir(project_path) do
34
- Bundler.with_clean_env do
35
- `bundle check || bundle install`
36
- end
37
- end
38
- end
39
-
40
30
  def drop_dummy_database
41
31
  return unless File.exist?(project_path)
42
32
 
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  git_source(:github) do |repo_name|
4
4
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
@@ -7,29 +7,30 @@ end
7
7
 
8
8
  ruby "<%= TractorBeam::RUBY_VERSION %>"
9
9
 
10
- gem 'pg', "~> 0.21"
11
- gem 'puma'
10
+ # gem "bootsnap", require: false
11
+ gem "pg", "~> 0.21"
12
+ gem "puma"
12
13
  gem "rails", "<%= TractorBeam::RAILS_VERSION %>"
13
- gem 'webpacker'
14
+ gem "webpacker"
14
15
 
15
16
  group :development, :test do
16
- # gem "bundler-audit", ">= 0.5.0", require: false
17
+ gem "bundler-audit", ">= 0.5.0", require: false
17
18
  # gem "dotenv-rails"
18
- # gem "factory_bot_rails"
19
+ gem "factory_bot_rails"
19
20
  gem "pry-byebug"
20
21
  gem "pry-rails"
21
- # gem "rspec-rails", "~> 3.6"
22
+ gem "rspec-rails", "~> 3.6"
22
23
  end
23
24
 
24
25
  group :development do
25
- gem 'web-console', '>= 3.3.0'
26
- gem 'listen', '>= 3.0.5', '< 3.2'
27
- gem 'spring'
28
- gem 'spring-watcher-listen', '~> 2.0.0'
26
+ gem "web-console", ">= 3.3.0"
27
+ gem "listen", ">= 3.0.5", "< 3.2"
28
+ gem "spring"
29
+ gem "spring-watcher-listen", "~> 2.0.0"
29
30
  gem "spring-commands-rspec"
30
31
  end
31
32
 
32
33
  group :test do
33
- # gem "shoulda-matchers"
34
- # gem "simplecov", require: false
34
+ gem "shoulda-matchers"
35
+ gem "simplecov", require: false
35
36
  end
data/templates/boot_rb ADDED
@@ -0,0 +1,15 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
+ env = ENV['RAILS_ENV'] || "development"
3
+
4
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
5
+ require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
6
+
7
+ Bootsnap.setup(
8
+ cache_dir: 'tmp/cache',
9
+ development_mode: env == 'development',
10
+ load_path_cache: true,
11
+ autoload_paths_cache: true,
12
+ disable_trace: true,
13
+ compile_cache_iseq: env != "test" || !ENV["CIRCLE_ARTIFACTS"],
14
+ compile_cache_yaml: true,
15
+ )
@@ -0,0 +1,32 @@
1
+ require 'simplecov'
2
+
3
+ if ENV['CIRCLE_ARTIFACTS']
4
+ dir = File.join(ENV['CIRCLE_ARTIFACTS'], "coverage")
5
+ SimpleCov.coverage_dir(dir)
6
+ end
7
+ SimpleCov.start("rails")
8
+
9
+ require 'spec_helper'
10
+ ENV['RAILS_ENV'] ||= 'test'
11
+ require File.expand_path('../../config/environment', __FILE__)
12
+
13
+ abort("The Rails environment is running in production mode!") if Rails.env.production?
14
+ require 'rspec/rails'
15
+
16
+ ActiveRecord::Migration.maintain_test_schema!
17
+
18
+ RSpec.configure do |config|
19
+ config.include FactoryBot::Syntax::Methods
20
+
21
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
22
+ config.use_transactional_fixtures = true
23
+ config.infer_spec_type_from_file_location!
24
+ config.filter_rails_from_backtrace!
25
+ end
26
+
27
+ Shoulda::Matchers.configure do |config|
28
+ config.integrate do |with|
29
+ with.test_framework :rspec
30
+ with.library :rails
31
+ end
32
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tractor_beam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Gizotti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-17 00:00:00.000000000 Z
11
+ date: 2018-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -113,12 +113,13 @@ files:
113
113
  - spec/features/cli_help_spec.rb
114
114
  - spec/features/new_project_spec.rb
115
115
  - spec/spec_helper.rb
116
- - spec/support/tractor_beam.rb
116
+ - spec/support/tractor_beam_helpers.rb
117
117
  - templates/Gemfile.erb
118
118
  - templates/Procfile
119
119
  - templates/Procfile.dev
120
120
  - templates/Readme.md.erb
121
121
  - templates/bin_setup
122
+ - templates/boot_rb
122
123
  - templates/browserlistrc
123
124
  - templates/cable_js
124
125
  - templates/component_generator
@@ -126,6 +127,7 @@ files:
126
127
  - templates/frontend/init/index.css
127
128
  - templates/frontend/init/index.js.erb
128
129
  - templates/frontend/packs/application.js
130
+ - templates/rails_helper
129
131
  - templates/stylelintrc
130
132
  - templates/tractor_beam_gitignore
131
133
  - templates/tractor_beam_layout.html.erb.erb
@@ -150,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
152
  version: 2.7.3
151
153
  requirements: []
152
154
  rubyforge_project:
153
- rubygems_version: 2.7.4
155
+ rubygems_version: 2.7.6
154
156
  signing_key:
155
157
  specification_version: 4
156
158
  summary: Generate a Rails app using modern javascript tooling.
@@ -158,4 +160,4 @@ test_files:
158
160
  - spec/features/cli_help_spec.rb
159
161
  - spec/features/new_project_spec.rb
160
162
  - spec/spec_helper.rb
161
- - spec/support/tractor_beam.rb
163
+ - spec/support/tractor_beam_helpers.rb