launch_base 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0f884d46fd72417fcda19ba1790afbf3cbe0ea79e61f402fcc279ad086e9b4d0
4
+ data.tar.gz: a464b1631d7e8e0b79464d17613d90981378820a347d249ff4db912213d2408b
5
+ SHA512:
6
+ metadata.gz: 8b8e81ce0905a2e9ac5b5808b4c964855743a1c45631587da73ef2b02b756e737644544ddbff1c0a90a52670d88f584af6bb253b3728ac3f44156ee44d4e1743
7
+ data.tar.gz: d09a32627efba676541340c9beed8184162c2ab6fba83b97de4b34af2b10b8ac3a732daba645c6de34be5a610e5518763f22ae6e4a7b980f36fb50a27ee5822a
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,98 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ launch_base (0.1.0)
5
+ thor (~> 0.20)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.0)
11
+ axiom-types (0.1.1)
12
+ descendants_tracker (~> 0.0.4)
13
+ ice_nine (~> 0.11.0)
14
+ thread_safe (~> 0.3, >= 0.3.1)
15
+ codeclimate-engine-rb (0.4.1)
16
+ virtus (~> 1.0)
17
+ coderay (1.1.2)
18
+ coercible (1.0.0)
19
+ descendants_tracker (~> 0.0.1)
20
+ descendants_tracker (0.0.4)
21
+ thread_safe (~> 0.3, >= 0.3.1)
22
+ diff-lcs (1.3)
23
+ docile (1.3.0)
24
+ equalizer (0.0.11)
25
+ fuubar (2.3.1)
26
+ rspec-core (~> 3.0)
27
+ ruby-progressbar (~> 1.4)
28
+ gem-release (1.0.0)
29
+ ice_nine (0.11.2)
30
+ json (2.1.0)
31
+ method_source (0.9.0)
32
+ parallel (1.12.1)
33
+ parser (2.5.1.0)
34
+ ast (~> 2.4.0)
35
+ powerpack (0.1.1)
36
+ pry (0.11.3)
37
+ coderay (~> 1.1.0)
38
+ method_source (~> 0.9.0)
39
+ rainbow (3.0.0)
40
+ rake (10.5.0)
41
+ redcarpet (3.4.0)
42
+ reek (4.8.1)
43
+ codeclimate-engine-rb (~> 0.4.0)
44
+ parser (>= 2.5.0.0, < 2.6)
45
+ rainbow (>= 2.0, < 4.0)
46
+ rspec (3.7.0)
47
+ rspec-core (~> 3.7.0)
48
+ rspec-expectations (~> 3.7.0)
49
+ rspec-mocks (~> 3.7.0)
50
+ rspec-core (3.7.1)
51
+ rspec-support (~> 3.7.0)
52
+ rspec-expectations (3.7.0)
53
+ diff-lcs (>= 1.2.0, < 2.0)
54
+ rspec-support (~> 3.7.0)
55
+ rspec-mocks (3.7.0)
56
+ diff-lcs (>= 1.2.0, < 2.0)
57
+ rspec-support (~> 3.7.0)
58
+ rspec-support (3.7.1)
59
+ rubocop (0.55.0)
60
+ parallel (~> 1.10)
61
+ parser (>= 2.5)
62
+ powerpack (~> 0.1)
63
+ rainbow (>= 2.2.2, < 4.0)
64
+ ruby-progressbar (~> 1.7)
65
+ unicode-display_width (~> 1.0, >= 1.0.1)
66
+ ruby-progressbar (1.9.0)
67
+ simplecov (0.16.1)
68
+ docile (~> 1.1)
69
+ json (>= 1.8, < 3)
70
+ simplecov-html (~> 0.10.0)
71
+ simplecov-html (0.10.2)
72
+ thor (0.20.0)
73
+ thread_safe (0.3.6)
74
+ unicode-display_width (1.3.2)
75
+ virtus (1.0.5)
76
+ axiom-types (~> 0.1)
77
+ coercible (~> 1.0)
78
+ descendants_tracker (~> 0.0, >= 0.0.3)
79
+ equalizer (~> 0.0, >= 0.0.9)
80
+
81
+ PLATFORMS
82
+ ruby
83
+
84
+ DEPENDENCIES
85
+ bundler (~> 1.16)
86
+ fuubar (~> 2.3)
87
+ gem-release (~> 1.0)
88
+ launch_base!
89
+ pry (~> 0.11)
90
+ rake (~> 10.0)
91
+ redcarpet (~> 3.4)
92
+ reek (~> 4.8)
93
+ rspec (~> 3.0)
94
+ rubocop (~> 0.55)
95
+ simplecov (~> 0.16)
96
+
97
+ BUNDLED WITH
98
+ 1.16.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Martijn Versluis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # Kabisa LaunchBase :rocket:
2
+
3
+ [![Build Status](https://travis-ci.org/kabisa/launch-base.svg?branch=master)](https://travis-ci.org/kabisa/launch-base)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/f563fdb89d5509e4e8f3/maintainability)](https://codeclimate.com/github/kabisa/launch-base/maintainability)
5
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/f563fdb89d5509e4e8f3/test_coverage)](https://codeclimate.com/github/kabisa/launch-base/test_coverage)
6
+
7
+ ## Installation
8
+
9
+ ### In an existing Rails application
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'launch_base'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ gem install launch_base
24
+
25
+ ### Globally, to generate a new application:
26
+
27
+ sudo gem install launch_base
28
+
29
+ ## Usage
30
+
31
+ ```
32
+ launch_base help [COMMAND] # Describe available commands or one specific command
33
+ launch_base new # Create a new LaunchBase project (Rails 5.1 or higher is required)
34
+ launch_base update # update LaunchBase
35
+ launch_base lint install # install lint configuration files
36
+ launch_base lint update # update gem and reinstall lint configuration files
37
+ ```
38
+
39
+ ## Requirements
40
+
41
+ ### Database transactions
42
+
43
+ An app generated by Launch Base assumes database transactions work within Capybara tests, which requires Rails 5.1 or
44
+ higher. Alternatively, you should add `DatabaseCleaner`:
45
+
46
+ 1. Add `DatabaseCleaner` to your gem within the `test` group (be sure to also run `bundle install`):
47
+
48
+ ```ruby
49
+ group :test do
50
+ gem 'database_cleaner'
51
+ end
52
+ ```
53
+
54
+ 2. Add a `spec/support/database_cleaner.rb` file:
55
+
56
+ ```ruby
57
+ require 'database_cleaner'
58
+
59
+ RSpec.configure do |config|
60
+ config.before :suite do
61
+ DatabaseCleaner.clean_with :truncation
62
+ end
63
+
64
+ config.around :each do |example|
65
+ DatabaseCleaner.strategy = if example.metadata[:type].in? [:feature, :request]
66
+ :truncation
67
+ else
68
+ :transaction
69
+ end
70
+
71
+ DatabaseCleaner.start
72
+ example.run
73
+ DatabaseCleaner.clean
74
+ end
75
+ end
76
+ ```
77
+
78
+ ## Contents
79
+
80
+ For info about the contents of an app generated by LaunchBase, please refer to the
81
+ [`README.md` template](templates/README.md.erb)
82
+
83
+ ## Development
84
+
85
+ After checking out the repo, run `bin/setup` to install dependencies.
86
+ Then, run `rake test` to run the tests.
87
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
88
+
89
+ To install this gem onto your local machine, run `bundle exec rake install`.
90
+ To release a new version, update the version number in `version.rb`,
91
+ and then run `bundle exec rake release`, which will create a git tag for the version,
92
+ push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
93
+
94
+ ## Contributing
95
+
96
+ Bug reports and pull requests are welcome on GitHub at [Launch Base](https://github.com/kabisa/launch-base).
97
+
98
+ ## License
99
+
100
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/bin/launch_base ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ source_path = (Pathname.new(__FILE__).dirname + '../lib').expand_path
5
+ $LOAD_PATH << source_path
6
+
7
+ require 'launch_base'
8
+
9
+ LaunchBase::CLI.start
@@ -0,0 +1,45 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ require 'launch_base/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'launch_base'
8
+ spec.version = LaunchBase::VERSION
9
+ spec.authors = ['Martijn Versluis', 'Tjaco Oostdijk']
10
+ spec.email = ['martijn@kabisa.nl', 'tjaco@kabisa.nl']
11
+
12
+ spec.summary = 'A Rails template with Kabisa defaults'
13
+ spec.homepage = 'https://github.com/kabisa/launch-base'
14
+ spec.license = 'MIT'
15
+
16
+ if spec.respond_to?(:metadata)
17
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
18
+ else
19
+ raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
20
+ end
21
+
22
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
23
+ is_blacklisted_file = f.match(%r{^(\.|test/|spec/|bin/ci$|bin/setup$|package.json$|Rakefile$|yarn.lock$)})
24
+ is_symlink = File.symlink?(f)
25
+ is_blacklisted_file || is_symlink
26
+ end
27
+
28
+ spec.bindir = 'bin'
29
+ spec.executables = ['launch_base']
30
+ spec.require_paths = ['lib']
31
+
32
+ spec.add_development_dependency 'bundler', '~> 1.16'
33
+ spec.add_development_dependency 'rake', '~> 10.0'
34
+ spec.add_development_dependency 'rspec', '~> 3.0'
35
+ spec.add_development_dependency 'fuubar', '~> 2.3'
36
+ spec.add_development_dependency 'rubocop', '~> 0.55'
37
+ spec.add_development_dependency 'reek', '~> 4.8'
38
+ spec.add_development_dependency 'pry', '~> 0.11'
39
+ spec.add_development_dependency 'simplecov', '~> 0.16'
40
+ spec.add_development_dependency 'redcarpet', '~> 3.4'
41
+
42
+ spec.add_dependency 'thor', '~> 0.20'
43
+
44
+ spec.add_development_dependency 'gem-release', '~> 1.0'
45
+ end
@@ -0,0 +1,2 @@
1
+ require 'launch_base/cli'
2
+ require 'launch_base/version'
@@ -0,0 +1,54 @@
1
+ require 'thor'
2
+ require 'launch_base/lint_cli'
3
+ require 'launch_base/utilities'
4
+
5
+ module LaunchBase
6
+ class CLI < Thor
7
+ include Thor::Actions
8
+
9
+ package_name 'launch_base'
10
+ register(LintCLI, 'lint', 'lint', 'Lint commands')
11
+
12
+ desc 'update', "update #{LaunchBase}"
13
+ long_desc <<-LONGDESC
14
+ `#{@package_name} update` triggers Bundler to update the #{LaunchBase} gem
15
+ LONGDESC
16
+ def update
17
+ run 'bundle update launch_base --conservative'
18
+ end
19
+
20
+ desc 'new', "Create a new #{LaunchBase} project"
21
+ long_desc <<-LONGDESC
22
+ `#{@package_name} new [project-path]` creates a new rails project with Kabisa preferences.
23
+ LONGDESC
24
+ def new(project_path)
25
+ installed_rails_version = Utilities.get_rails_version
26
+
27
+ if installed_rails_version
28
+ if Utilities.rails_up_to_date?(installed_rails_version)
29
+ run "rails new #{project_path} -m #{gem_home}/templates/launch_base_default_template.rb"
30
+ else
31
+ say "Your current installation of Rails is outdated (#{installed_rails_version}). "\
32
+ "Please upgrade to Rails #{RAILS_VERSION}"
33
+ end
34
+ else
35
+ say "No installation of Rails found. Please install Rails #{RAILS_VERSION}"
36
+ end
37
+ end
38
+
39
+ def help
40
+ show_banner
41
+ super
42
+ end
43
+
44
+ private
45
+
46
+ def show_banner
47
+ say "\u{1f680} Kabisa #{LaunchBase}\n\n"
48
+ end
49
+
50
+ def gem_home
51
+ Pathname.new(__dir__).join('..', '..')
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,34 @@
1
+ require 'thor'
2
+
3
+ module LaunchBase
4
+ class LintCLI < Thor
5
+ include Thor::Actions
6
+
7
+ desc 'install', 'install lint configuration files'
8
+ long_desc <<-LONGDESC
9
+ `#{@package_name} lint install` installs the lint configuration files into the current directory
10
+ LONGDESC
11
+ def install
12
+ ['.codeclimate.yml', '.eslintrc.json', '.mdlrc', '.rubocop.yml', 'config.reek'].each do |config_file_name|
13
+ create_file(config_file_name) do
14
+ gem_home.join('templates', config_file_name).read
15
+ end
16
+ end
17
+ end
18
+
19
+ desc 'update', 'update gem and reinstall lint configuration files'
20
+ long_desc <<-LONGDESC
21
+ `#{@package_name} lint update` updates the gem and reinstalls the lint configuration files
22
+ LONGDESC
23
+ def update
24
+ invoke CLI, 'update'
25
+ invoke :install
26
+ end
27
+
28
+ private
29
+
30
+ def gem_home
31
+ Pathname.new(__dir__).join('..', '..')
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,14 @@
1
+ module LaunchBase
2
+ module Utilities
3
+ def self.rails_up_to_date?(installed_rails_version)
4
+ Gem::Dependency.new('rails', RAILS_VERSION) =~ Gem::Dependency.new('rails', installed_rails_version)
5
+ end
6
+
7
+ def self.get_rails_version
8
+ output = `rails -v 2>&1`
9
+ match_data = /Rails ([0-9.]+)/.match(output)
10
+
11
+ match_data[1] if match_data
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ module LaunchBase
2
+ VERSION = '0.1.0'.freeze
3
+ RAILS_VERSION = '~> 5.2.0'.freeze
4
+ RUBY_VERSION = '2.5.1'.freeze
5
+ end
@@ -0,0 +1,73 @@
1
+ # For info about .codeclimate.yml structure see:
2
+ # https://docs.codeclimate.com/docs/advanced-configuration
3
+
4
+ version: "2" # required to adjust maintainability checks
5
+
6
+ # See: https://docs.codeclimate.com/docs/maintainability#section-checks
7
+ checks:
8
+ argument-count:
9
+ config:
10
+ threshold: 4
11
+ complex-logic:
12
+ config:
13
+ threshold: 4
14
+ file-lines:
15
+ config:
16
+ threshold: 250
17
+ method-complexity:
18
+ config:
19
+ threshold: 5
20
+ method-count:
21
+ config:
22
+ threshold: 20
23
+ method-lines:
24
+ config:
25
+ threshold: 25
26
+ nested-control-flow:
27
+ config:
28
+ threshold: 4
29
+ return-statements:
30
+ config:
31
+ threshold: 4
32
+ similar-code:
33
+ config:
34
+ threshold: # language-specific defaults. an override will affect all languages.
35
+ identical-code:
36
+ config:
37
+ threshold: # language-specific defaults. an override will affect all languages.
38
+
39
+ # See: https://docs.codeclimate.com/docs/advanced-configuration#section-plugins
40
+ # and https://docs.codeclimate.com/docs/list-of-engines
41
+ plugins:
42
+ brakeman:
43
+ enabled: true
44
+ bundler-audit:
45
+ enabled: true
46
+ csslint:
47
+ enabled: true
48
+ duplication:
49
+ enabled: true
50
+ eslint:
51
+ enabled: true
52
+ config:
53
+ config: .eslintrc.json
54
+ extensions:
55
+ - .es6
56
+ - .js
57
+ - .jsx
58
+ fixme:
59
+ enabled: true
60
+ markdownlint:
61
+ enabled: true
62
+ nodesecurity:
63
+ enabled: true
64
+ rubocop:
65
+ enabled: true
66
+ reek:
67
+ enabled: true
68
+ config:
69
+ config: config.reek
70
+ scss-lint:
71
+ enabled: true
72
+ shellcheck:
73
+ enabled: true