warm-boot 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c29afe646717e04fe19ff954e8825faa597917ec86682ff6a6de8a9e779f043a
4
+ data.tar.gz: a16977dfc5e6b35f02db069523d8c1eb55d0815332c0b42de4e070cd8bea725c
5
+ SHA512:
6
+ metadata.gz: 5b2c5066e847d242717d56b4b2470f52fc0d71bba773ebe58a10594024948174df16c3cbab698fc8c598363e02b706dd159f26fe68e6b8c3687b2d75bf2a5c16
7
+ data.tar.gz: 5e2160bcc9fea0faffd6a6d1cc2d8919024f1bb55cbaf786b4ae1237b720e3d4821a9b566b4444367d70a414d453fad8a609af4d850a64fa17760009632fe31d
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,82 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5.3
3
+ Exclude:
4
+ - "bin/*"
5
+ - "./**/*.gemspec"
6
+ - "Gemfile"
7
+ - "Rakefile"
8
+ - "vendor/**/*"
9
+ - "exe/*"
10
+
11
+ Metrics/LineLength:
12
+ Max: 120
13
+
14
+ Metrics/MethodLength:
15
+ Max: 21
16
+ Exclude:
17
+ - "lib/release/notes/configuration.rb"
18
+
19
+ Metrics/BlockLength:
20
+ Max: 40
21
+ Exclude:
22
+ - "./**/spec/**/*"
23
+
24
+ Metrics/AbcSize:
25
+ Exclude:
26
+ - "lib/release/notes/configuration.rb"
27
+
28
+ Style/StringLiterals:
29
+ EnforcedStyle: double_quotes
30
+ Exclude:
31
+ - Gemfile
32
+
33
+ Layout/DotPosition:
34
+ # Multi-line method chaining should be done with trailing dots.
35
+ EnforcedStyle: trailing
36
+
37
+ Style/TrailingCommaInArguments:
38
+ # If `comma`, the cop requires a comma after the last argument, but only for
39
+ # parenthesized method calls where each argument is on its own line.
40
+ EnforcedStyleForMultiline: comma
41
+
42
+ Style/TrailingCommaInArrayLiteral:
43
+ # If `comma`, the cop requires a comma after the last item in an array,
44
+ # but only when each item is on its own line.
45
+ EnforcedStyleForMultiline: comma
46
+
47
+ Style/TrailingCommaInHashLiteral:
48
+ # If `comma`, the cop requires a comma after the last item in a hash,
49
+ # but only when each item is on its own line.
50
+ EnforcedStyleForMultiline: comma
51
+
52
+ Style/MutableConstant:
53
+ # Do not assign mutable objects to constants.
54
+ Enabled: false
55
+
56
+ Style/Documentation:
57
+ # Document classes and non-namespace modules
58
+ Enabled: false
59
+
60
+ Style/ClassAndModuleChildren:
61
+ # Checks style of children classes and modules.
62
+ Enabled: false
63
+
64
+ Style/FrozenStringLiteralComment:
65
+ # Checks existence of the frozen string literal comment
66
+ Enabled: true
67
+
68
+ Style/RescueStandardError:
69
+ # Checks that you are including the error class
70
+ # when you rescue
71
+ Enabled: false
72
+
73
+ Style/PercentLiteralDelimiters:
74
+ # Percent literal delimeters are always parentheses
75
+ PreferredDelimiters:
76
+ { default: (),
77
+ '%i': '()',
78
+ '%I': '()',
79
+ '%r': '()',
80
+ '%w': '()',
81
+ '%W': '()'
82
+ }
@@ -0,0 +1,13 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.0
7
+ before_install: gem install bundler -v 1.17.2
8
+ script:
9
+ - bundle exec rspec
10
+ - bundle exec rubocop
11
+
12
+ after_success:
13
+ - bundle exec codeclimate-test-reporter
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at andrew.mason@n2pub.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in warm-boot.gemspec
6
+ gemspec
7
+
8
+ group :test do
9
+ gem 'codeclimate-test-reporter', require: false
10
+ gem 'rspec', '~> 3.8'
11
+ gem 'simplecov', require: false
12
+ end
@@ -0,0 +1,165 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ warm-boot (0.1.1)
5
+ pastel (~> 0.7.2)
6
+ thor (~> 0.20.0)
7
+ tty-box (~> 0.3.0)
8
+ tty-color (~> 0.4)
9
+ tty-command (~> 0.8.0)
10
+ tty-config (~> 0.3.0)
11
+ tty-cursor (~> 0.6)
12
+ tty-editor (~> 0.5.0)
13
+ tty-file (~> 0.7.0)
14
+ tty-font (~> 0.2.0)
15
+ tty-markdown (~> 0.5.0)
16
+ tty-pager (~> 0.12.0)
17
+ tty-pie (~> 0.1.0)
18
+ tty-platform (~> 0.2.0)
19
+ tty-progressbar (~> 0.16.0)
20
+ tty-prompt (~> 0.18.0)
21
+ tty-screen (~> 0.6)
22
+ tty-spinner (~> 0.9.0)
23
+ tty-table (~> 0.10.0)
24
+ tty-tree (~> 0.2.0)
25
+ tty-which (~> 0.4)
26
+
27
+ GEM
28
+ remote: https://rubygems.org/
29
+ specs:
30
+ ast (2.4.0)
31
+ codeclimate-test-reporter (1.0.9)
32
+ simplecov (<= 0.13)
33
+ coderay (1.1.2)
34
+ diff-lcs (1.3)
35
+ docile (1.1.5)
36
+ equatable (0.5.0)
37
+ jaro_winkler (1.5.1)
38
+ json (2.1.0)
39
+ kramdown (1.16.2)
40
+ method_source (0.9.2)
41
+ necromancer (0.4.0)
42
+ parallel (1.12.1)
43
+ parser (2.5.3.0)
44
+ ast (~> 2.4.0)
45
+ pastel (0.7.2)
46
+ equatable (~> 0.5.0)
47
+ tty-color (~> 0.4.0)
48
+ powerpack (0.1.2)
49
+ pry (0.12.2)
50
+ coderay (~> 1.1.0)
51
+ method_source (~> 0.9.0)
52
+ rainbow (3.0.0)
53
+ rake (10.5.0)
54
+ rouge (3.3.0)
55
+ rspec (3.8.0)
56
+ rspec-core (~> 3.8.0)
57
+ rspec-expectations (~> 3.8.0)
58
+ rspec-mocks (~> 3.8.0)
59
+ rspec-core (3.8.0)
60
+ rspec-support (~> 3.8.0)
61
+ rspec-expectations (3.8.2)
62
+ diff-lcs (>= 1.2.0, < 2.0)
63
+ rspec-support (~> 3.8.0)
64
+ rspec-mocks (3.8.0)
65
+ diff-lcs (>= 1.2.0, < 2.0)
66
+ rspec-support (~> 3.8.0)
67
+ rspec-support (3.8.0)
68
+ rubocop (0.61.1)
69
+ jaro_winkler (~> 1.5.1)
70
+ parallel (~> 1.10)
71
+ parser (>= 2.5, != 2.5.1.1)
72
+ powerpack (~> 0.1)
73
+ rainbow (>= 2.2.2, < 4.0)
74
+ ruby-progressbar (~> 1.7)
75
+ unicode-display_width (~> 1.4.0)
76
+ ruby-progressbar (1.10.0)
77
+ simplecov (0.13.0)
78
+ docile (~> 1.1.0)
79
+ json (>= 1.8, < 3)
80
+ simplecov-html (~> 0.10.0)
81
+ simplecov-html (0.10.2)
82
+ strings (0.1.4)
83
+ strings-ansi (~> 0.1.0)
84
+ unicode-display_width (~> 1.4.0)
85
+ unicode_utils (~> 1.4.0)
86
+ strings-ansi (0.1.0)
87
+ thor (0.20.3)
88
+ timers (4.2.0)
89
+ tty-box (0.3.0)
90
+ pastel (~> 0.7.2)
91
+ strings (~> 0.1.4)
92
+ tty-cursor (~> 0.6.0)
93
+ tty-color (0.4.3)
94
+ tty-command (0.8.2)
95
+ pastel (~> 0.7.0)
96
+ tty-config (0.3.0)
97
+ tty-cursor (0.6.0)
98
+ tty-editor (0.5.0)
99
+ tty-prompt (~> 0.18)
100
+ tty-which (~> 0.4)
101
+ tty-file (0.7.0)
102
+ diff-lcs (~> 1.3)
103
+ pastel (~> 0.7.2)
104
+ tty-prompt (~> 0.18)
105
+ tty-font (0.2.0)
106
+ tty-markdown (0.5.0)
107
+ kramdown (~> 1.16.2)
108
+ pastel (~> 0.7.2)
109
+ rouge (~> 3.3)
110
+ strings (~> 0.1.4)
111
+ tty-color (~> 0.4)
112
+ tty-screen (~> 0.6)
113
+ tty-pager (0.12.0)
114
+ strings (~> 0.1.4)
115
+ tty-screen (~> 0.6)
116
+ tty-which (~> 0.4)
117
+ tty-pie (0.1.0)
118
+ pastel (~> 0.7.2)
119
+ tty-cursor (~> 0.6.0)
120
+ tty-platform (0.2.0)
121
+ tty-progressbar (0.16.0)
122
+ strings-ansi (~> 0.1.0)
123
+ tty-cursor (~> 0.6.0)
124
+ tty-screen (~> 0.6.4)
125
+ unicode-display_width (~> 1.3)
126
+ tty-prompt (0.18.0)
127
+ necromancer (~> 0.4.0)
128
+ pastel (~> 0.7.0)
129
+ timers (~> 4.0)
130
+ tty-cursor (~> 0.6.0)
131
+ tty-reader (~> 0.5.0)
132
+ tty-reader (0.5.0)
133
+ tty-cursor (~> 0.6.0)
134
+ tty-screen (~> 0.6.4)
135
+ wisper (~> 2.0.0)
136
+ tty-screen (0.6.5)
137
+ tty-spinner (0.9.0)
138
+ tty-cursor (~> 0.6.0)
139
+ tty-table (0.10.0)
140
+ equatable (~> 0.5.0)
141
+ necromancer (~> 0.4.0)
142
+ pastel (~> 0.7.2)
143
+ strings (~> 0.1.0)
144
+ tty-screen (~> 0.6.4)
145
+ tty-tree (0.2.0)
146
+ tty-which (0.4.0)
147
+ unicode-display_width (1.4.1)
148
+ unicode_utils (1.4.0)
149
+ wisper (2.0.0)
150
+
151
+ PLATFORMS
152
+ ruby
153
+
154
+ DEPENDENCIES
155
+ bundler (~> 1.17)
156
+ codeclimate-test-reporter
157
+ pry
158
+ rake (~> 10.0)
159
+ rspec (~> 3.8)
160
+ rubocop (~> 0.61.0)
161
+ simplecov
162
+ warm-boot!
163
+
164
+ BUNDLED WITH
165
+ 1.17.2
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Andrew Mason
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ 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, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,47 @@
1
+ # Warm::Boot
2
+
3
+ [![Build Status](https://travis-ci.org/andrewmcodes/warm-boot.svg?branch=master)](https://travis-ci.org/andrewmcodes/warm-boot)
4
+
5
+ Create a new rails app with some configurable presets.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'warm-boot'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ ```sh
18
+ bundle
19
+ ```
20
+
21
+ Or install it yourself as:
22
+
23
+ ```sh
24
+ gem install warm-boot
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ TODO: Write usage instructions here
30
+
31
+ ## Development
32
+
33
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
34
+
35
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
36
+
37
+ ## Contributing
38
+
39
+ Bug reports and pull requests are welcome on GitHub [here](https://github.com/andrewmcodes/warm-boot). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Warm::Boot project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/warm-boot/blob/master/CODE_OF_CONDUCT.md).
44
+
45
+ ## Copyright
46
+
47
+ Copyright (c) 2018 Andrew Mason. See [MIT License](LICENSE.txt) for further details.
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "warm/boot"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ require "pry"
10
+ Pry.start
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ lib_path = File.expand_path('../lib', __dir__)
5
+ $:.unshift(lib_path) if !$:.include?(lib_path)
6
+ require 'warm/boot/cli'
7
+
8
+ Signal.trap('INT') do
9
+ warn("\n#{caller.join("\n")}: interrupted")
10
+ exit(1)
11
+ end
12
+
13
+ begin
14
+ Warm::Boot::CLI.start
15
+ rescue Warm::Boot::CLI::Error => err
16
+ puts "ERROR: #{err.message}"
17
+ exit 1
18
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "warm/boot/version"
4
+
5
+ module Warm
6
+ module Boot
7
+ class Error < StandardError; end
8
+ # Your code goes here...
9
+ end
10
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "thor"
4
+ require "tty"
5
+ require "warm/boot"
6
+ module Warm
7
+ module Boot
8
+ # Handle the application command line parsing
9
+ # and the dispatch to various command objects
10
+ #
11
+ # @api public
12
+ class CLI < Thor
13
+ # Error raised by this runner
14
+ Error = Class.new(StandardError)
15
+
16
+ desc "version", "warm-boot version"
17
+ def version
18
+ require_relative "version"
19
+ p "v#{Warm::Boot::VERSION}"
20
+ end
21
+ map %w(--version -v) => :version
22
+
23
+ desc "new", "new rails app"
24
+ def new # rubocop:disable Metrics/AbcSize
25
+ require_relative "commands/rails_new"
26
+ require_relative "rails_opts"
27
+ prompt = TTY::Prompt.new
28
+ rails_opts = RailsOpts.new(
29
+ app_name: prompt.ask("What is the name of the app?", default: "myapp"),
30
+ api_only: prompt.yes?("Is this an API only app?"),
31
+ database: prompt.select("Choose your database:", %w(mysql postgresql sqlite3)),
32
+ coffeescript: prompt.yes?("Do you want to install coffeescript?"),
33
+ webpacker: prompt.yes?("Do you want to install webpack"),
34
+ framework: "none",
35
+ )
36
+
37
+ if rails_opts.options.webpacker
38
+ rails_opts.options.framework = prompt.select(
39
+ "Choose your front-end framework:", %w(react vue angular elm stimulus none)
40
+ )
41
+ end
42
+ Warm::Boot::Commands::RailsNew.new(rails_opts.options).execute
43
+ end
44
+ map %w(--new -n) => :new
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,123 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "forwardable"
4
+
5
+ module Warm
6
+ module Boot
7
+ class Command
8
+ extend Forwardable
9
+
10
+ def_delegators :command, :run
11
+
12
+ # Execute this command
13
+ #
14
+ # @api public
15
+ def execute(*)
16
+ raise(
17
+ NotImplementedError,
18
+ "#{self.class}##{__method__} must be implemented",
19
+ )
20
+ end
21
+
22
+ # The external commands runner
23
+ #
24
+ # @see http://www.rubydoc.info/gems/tty-command
25
+ #
26
+ # @api public
27
+ def command(**options)
28
+ require "tty-command"
29
+ TTY::Command.new(options)
30
+ end
31
+
32
+ # The cursor movement
33
+ #
34
+ # @see http://www.rubydoc.info/gems/tty-cursor
35
+ #
36
+ # @api public
37
+ def cursor
38
+ require "tty-cursor"
39
+ TTY::Cursor
40
+ end
41
+
42
+ # Open a file or text in the user's preferred editor
43
+ #
44
+ # @see http://www.rubydoc.info/gems/tty-editor
45
+ #
46
+ # @api public
47
+ def editor
48
+ require "tty-editor"
49
+ TTY::Editor
50
+ end
51
+
52
+ # File manipulation utility methods
53
+ #
54
+ # @see http://www.rubydoc.info/gems/tty-file
55
+ #
56
+ # @api public
57
+ def generator
58
+ require "tty-file"
59
+ TTY::File
60
+ end
61
+
62
+ # Terminal output paging
63
+ #
64
+ # @see http://www.rubydoc.info/gems/tty-pager
65
+ #
66
+ # @api public
67
+ def pager(**options)
68
+ require "tty-pager"
69
+ TTY::Pager.new(options)
70
+ end
71
+
72
+ # Terminal platform and OS properties
73
+ #
74
+ # @see http://www.rubydoc.info/gems/tty-pager
75
+ #
76
+ # @api public
77
+ def platform
78
+ require "tty-platform"
79
+ TTY::Platform.new
80
+ end
81
+
82
+ # The interactive prompt
83
+ #
84
+ # @see http://www.rubydoc.info/gems/tty-prompt
85
+ #
86
+ # @api public
87
+ def prompt(**options)
88
+ require "tty-prompt"
89
+ TTY::Prompt.new(options)
90
+ end
91
+
92
+ # Get terminal screen properties
93
+ #
94
+ # @see http://www.rubydoc.info/gems/tty-screen
95
+ #
96
+ # @api public
97
+ def screen
98
+ require "tty-screen"
99
+ TTY::Screen
100
+ end
101
+
102
+ # The unix which utility
103
+ #
104
+ # @see http://www.rubydoc.info/gems/tty-which
105
+ #
106
+ # @api public
107
+ def which(*args)
108
+ require "tty-which"
109
+ TTY::Which.which(*args)
110
+ end
111
+
112
+ # Check if executable exists
113
+ #
114
+ # @see http://www.rubydoc.info/gems/tty-which
115
+ #
116
+ # @api public
117
+ def exec_exist?(*args)
118
+ require "tty-which"
119
+ TTY::Which.exist?(*args)
120
+ end
121
+ end
122
+ end
123
+ end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Warm
4
+ module Boot
5
+ module Commands
6
+ class RailsNew
7
+ attr_accessor :cmd, :sh, :opts
8
+ def initialize(opts)
9
+ @opts = opts
10
+ @cmd = ["rails new #{opts.app_name} --quiet"]
11
+ @sh = TTY::Command.new
12
+ end
13
+
14
+ def string_builder
15
+ api
16
+ database
17
+ coffeescript
18
+ webpacker
19
+ end
20
+
21
+ def execute
22
+ string_builder
23
+ spinner = TTY::Spinner.new("[:spinner] warm-boot ...", format: :dots_4)
24
+ spinner.auto_spin
25
+ check_rails
26
+ sh.run(cmd.join)
27
+ spinner.stop("Done!")
28
+ end
29
+
30
+ private
31
+
32
+ def check_rails
33
+ return unless rails_gem_installed? == false
34
+
35
+ sh.run("gem install rails")
36
+ end
37
+
38
+ def rails_gem_installed?
39
+ `gem list -i "^rails$"`.strip
40
+ end
41
+
42
+ def database
43
+ cmd << " --database=#{opts.database}"
44
+ end
45
+
46
+ def api
47
+ cmd << " --api" if opts.api_only
48
+ end
49
+
50
+ def coffeescript
51
+ cmd << " --skip-coffee" unless opts.coffeescript
52
+ end
53
+
54
+ def webpacker
55
+ cmd << " --webpack#{framework}" if opts.webpacker
56
+ end
57
+
58
+ def framework
59
+ opts.framework == "none" ? "" : "=#{opts.framework}"
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RailsOpts
4
+ Options = Struct.new(:app_name, :api_only, :database, :coffeescript, :webpacker, :framework)
5
+
6
+ attr_accessor :options
7
+
8
+ def initialize(opts)
9
+ @options = Options.new(
10
+ opts[:app_name], opts[:api_only], opts[:database], opts[:coffeescript], opts[:webpacker], opts[:framework]
11
+ )
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Warm
4
+ module Boot
5
+ VERSION = "0.1.1"
6
+ end
7
+ end
@@ -0,0 +1,54 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "warm/boot/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "warm-boot"
8
+ spec.license = "MIT"
9
+ spec.version = Warm::Boot::VERSION
10
+ spec.authors = ["Andrew Mason"]
11
+ spec.email = ["masonam96@outlook.com"]
12
+
13
+ spec.summary = "Bootstrap a new rails app"
14
+ spec.description = "Rich cli experience to generate a new rails app"
15
+ spec.homepage = "https://github.com/andrewmcodes/warm-boot"
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ # TODO: Remove unneeded dependencies
27
+ spec.add_dependency "tty-box", "~> 0.3.0"
28
+ spec.add_dependency "tty-color", "~> 0.4"
29
+ spec.add_dependency "tty-command", "~> 0.8.0"
30
+ spec.add_dependency "tty-config", "~> 0.3.0"
31
+ spec.add_dependency "tty-cursor", "~> 0.6"
32
+ spec.add_dependency "tty-editor", "~> 0.5.0"
33
+ spec.add_dependency "tty-file", "~> 0.7.0"
34
+ spec.add_dependency "tty-font", "~> 0.2.0"
35
+ spec.add_dependency "tty-markdown", "~> 0.5.0"
36
+ spec.add_dependency "tty-pager", "~> 0.12.0"
37
+ spec.add_dependency "tty-pie", "~> 0.1.0"
38
+ spec.add_dependency "tty-platform", "~> 0.2.0"
39
+ spec.add_dependency "tty-progressbar", "~> 0.16.0"
40
+ spec.add_dependency "tty-prompt", "~> 0.18.0"
41
+ spec.add_dependency "tty-screen", "~> 0.6"
42
+ spec.add_dependency "tty-spinner", "~> 0.9.0"
43
+ spec.add_dependency "tty-table", "~> 0.10.0"
44
+ spec.add_dependency "tty-tree", "~> 0.2.0"
45
+ spec.add_dependency "tty-which", "~> 0.4"
46
+ spec.add_dependency "pastel", "~> 0.7.2"
47
+ spec.add_dependency "thor", "~> 0.20.0"
48
+
49
+ spec.add_development_dependency "pry"
50
+ spec.add_development_dependency "bundler", "~> 1.17"
51
+ spec.add_development_dependency "rake", "~> 10.0"
52
+ spec.add_development_dependency "rubocop", "~> 0.61.0"
53
+ spec.add_development_dependency "rspec", "~> 3.0"
54
+ end
metadata ADDED
@@ -0,0 +1,430 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: warm-boot
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Mason
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-12-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: tty-box
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.3.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.3.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: tty-color
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.4'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: tty-command
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.8.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.8.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: tty-config
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.3.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.3.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: tty-cursor
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.6'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.6'
83
+ - !ruby/object:Gem::Dependency
84
+ name: tty-editor
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.5.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.5.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: tty-file
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.7.0
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.7.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: tty-font
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.2.0
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.2.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: tty-markdown
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.5.0
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 0.5.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: tty-pager
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 0.12.0
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.12.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: tty-pie
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 0.1.0
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 0.1.0
167
+ - !ruby/object:Gem::Dependency
168
+ name: tty-platform
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 0.2.0
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 0.2.0
181
+ - !ruby/object:Gem::Dependency
182
+ name: tty-progressbar
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: 0.16.0
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: 0.16.0
195
+ - !ruby/object:Gem::Dependency
196
+ name: tty-prompt
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: 0.18.0
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: 0.18.0
209
+ - !ruby/object:Gem::Dependency
210
+ name: tty-screen
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: '0.6'
216
+ type: :runtime
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: '0.6'
223
+ - !ruby/object:Gem::Dependency
224
+ name: tty-spinner
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - "~>"
228
+ - !ruby/object:Gem::Version
229
+ version: 0.9.0
230
+ type: :runtime
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - "~>"
235
+ - !ruby/object:Gem::Version
236
+ version: 0.9.0
237
+ - !ruby/object:Gem::Dependency
238
+ name: tty-table
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - "~>"
242
+ - !ruby/object:Gem::Version
243
+ version: 0.10.0
244
+ type: :runtime
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - "~>"
249
+ - !ruby/object:Gem::Version
250
+ version: 0.10.0
251
+ - !ruby/object:Gem::Dependency
252
+ name: tty-tree
253
+ requirement: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - "~>"
256
+ - !ruby/object:Gem::Version
257
+ version: 0.2.0
258
+ type: :runtime
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - "~>"
263
+ - !ruby/object:Gem::Version
264
+ version: 0.2.0
265
+ - !ruby/object:Gem::Dependency
266
+ name: tty-which
267
+ requirement: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - "~>"
270
+ - !ruby/object:Gem::Version
271
+ version: '0.4'
272
+ type: :runtime
273
+ prerelease: false
274
+ version_requirements: !ruby/object:Gem::Requirement
275
+ requirements:
276
+ - - "~>"
277
+ - !ruby/object:Gem::Version
278
+ version: '0.4'
279
+ - !ruby/object:Gem::Dependency
280
+ name: pastel
281
+ requirement: !ruby/object:Gem::Requirement
282
+ requirements:
283
+ - - "~>"
284
+ - !ruby/object:Gem::Version
285
+ version: 0.7.2
286
+ type: :runtime
287
+ prerelease: false
288
+ version_requirements: !ruby/object:Gem::Requirement
289
+ requirements:
290
+ - - "~>"
291
+ - !ruby/object:Gem::Version
292
+ version: 0.7.2
293
+ - !ruby/object:Gem::Dependency
294
+ name: thor
295
+ requirement: !ruby/object:Gem::Requirement
296
+ requirements:
297
+ - - "~>"
298
+ - !ruby/object:Gem::Version
299
+ version: 0.20.0
300
+ type: :runtime
301
+ prerelease: false
302
+ version_requirements: !ruby/object:Gem::Requirement
303
+ requirements:
304
+ - - "~>"
305
+ - !ruby/object:Gem::Version
306
+ version: 0.20.0
307
+ - !ruby/object:Gem::Dependency
308
+ name: pry
309
+ requirement: !ruby/object:Gem::Requirement
310
+ requirements:
311
+ - - ">="
312
+ - !ruby/object:Gem::Version
313
+ version: '0'
314
+ type: :development
315
+ prerelease: false
316
+ version_requirements: !ruby/object:Gem::Requirement
317
+ requirements:
318
+ - - ">="
319
+ - !ruby/object:Gem::Version
320
+ version: '0'
321
+ - !ruby/object:Gem::Dependency
322
+ name: bundler
323
+ requirement: !ruby/object:Gem::Requirement
324
+ requirements:
325
+ - - "~>"
326
+ - !ruby/object:Gem::Version
327
+ version: '1.17'
328
+ type: :development
329
+ prerelease: false
330
+ version_requirements: !ruby/object:Gem::Requirement
331
+ requirements:
332
+ - - "~>"
333
+ - !ruby/object:Gem::Version
334
+ version: '1.17'
335
+ - !ruby/object:Gem::Dependency
336
+ name: rake
337
+ requirement: !ruby/object:Gem::Requirement
338
+ requirements:
339
+ - - "~>"
340
+ - !ruby/object:Gem::Version
341
+ version: '10.0'
342
+ type: :development
343
+ prerelease: false
344
+ version_requirements: !ruby/object:Gem::Requirement
345
+ requirements:
346
+ - - "~>"
347
+ - !ruby/object:Gem::Version
348
+ version: '10.0'
349
+ - !ruby/object:Gem::Dependency
350
+ name: rubocop
351
+ requirement: !ruby/object:Gem::Requirement
352
+ requirements:
353
+ - - "~>"
354
+ - !ruby/object:Gem::Version
355
+ version: 0.61.0
356
+ type: :development
357
+ prerelease: false
358
+ version_requirements: !ruby/object:Gem::Requirement
359
+ requirements:
360
+ - - "~>"
361
+ - !ruby/object:Gem::Version
362
+ version: 0.61.0
363
+ - !ruby/object:Gem::Dependency
364
+ name: rspec
365
+ requirement: !ruby/object:Gem::Requirement
366
+ requirements:
367
+ - - "~>"
368
+ - !ruby/object:Gem::Version
369
+ version: '3.0'
370
+ type: :development
371
+ prerelease: false
372
+ version_requirements: !ruby/object:Gem::Requirement
373
+ requirements:
374
+ - - "~>"
375
+ - !ruby/object:Gem::Version
376
+ version: '3.0'
377
+ description: Rich cli experience to generate a new rails app
378
+ email:
379
+ - masonam96@outlook.com
380
+ executables:
381
+ - warm-boot
382
+ extensions: []
383
+ extra_rdoc_files: []
384
+ files:
385
+ - ".gitignore"
386
+ - ".rspec"
387
+ - ".rubocop.yml"
388
+ - ".travis.yml"
389
+ - CODE_OF_CONDUCT.md
390
+ - Gemfile
391
+ - Gemfile.lock
392
+ - LICENSE.txt
393
+ - README.md
394
+ - Rakefile
395
+ - bin/console
396
+ - bin/rspec
397
+ - bin/setup
398
+ - exe/warm-boot
399
+ - lib/warm/boot.rb
400
+ - lib/warm/boot/cli.rb
401
+ - lib/warm/boot/command.rb
402
+ - lib/warm/boot/commands/rails_new.rb
403
+ - lib/warm/boot/rails_opts.rb
404
+ - lib/warm/boot/templates/.gitkeep
405
+ - lib/warm/boot/version.rb
406
+ - warm-boot.gemspec
407
+ homepage: https://github.com/andrewmcodes/warm-boot
408
+ licenses:
409
+ - MIT
410
+ metadata: {}
411
+ post_install_message:
412
+ rdoc_options: []
413
+ require_paths:
414
+ - lib
415
+ required_ruby_version: !ruby/object:Gem::Requirement
416
+ requirements:
417
+ - - ">="
418
+ - !ruby/object:Gem::Version
419
+ version: '0'
420
+ required_rubygems_version: !ruby/object:Gem::Requirement
421
+ requirements:
422
+ - - ">="
423
+ - !ruby/object:Gem::Version
424
+ version: '0'
425
+ requirements: []
426
+ rubygems_version: 3.0.1
427
+ signing_key:
428
+ specification_version: 4
429
+ summary: Bootstrap a new rails app
430
+ test_files: []