rails-interactive 0.1.0 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a3eefcd62749530970bcfff3078ba4b9e4010b0c208257300c46769c1a04a4b
4
- data.tar.gz: 960fca5ebaa337545cb4dbdb87d3b7b412c8fabe61a62c63678dff008e17e72d
3
+ metadata.gz: 311ecd51603ff6353bf81e6ddf9b466e316e42ddd7f30439f4e85283b3d95d9b
4
+ data.tar.gz: 146d9ca05439b52554e80996919a8354a56bf8c7109fcacfc2edb724d64d82cc
5
5
  SHA512:
6
- metadata.gz: 8dbac906ae3e1caffd7a94d4fc4719a1e6d9a82b829bfc2225f5cfb8a318e81d17624fc83f86332715136f2318d5a37064f5639701a80b4e7800d4535115be8c
7
- data.tar.gz: 9c45447661d104ac5432f2b3fe6dc0de3765b12cc65df199c957460917bf029e00481b94404b8b4e78a7f6a12395c424d5b9c75f0b435b8d08780ad0be7ed9ff
6
+ metadata.gz: da265f43d7300c8664384f83f31d2b9389b9cb1141ef3cce871e77c6e44e97bfe8f9d336398db5c60d0de659d8298dd9161a9c39129ad5cdb5f2043165e8e200
7
+ data.tar.gz: f288819b67edf4700bc05d50392097ef9611e2f2293e23651a58aee3e98a63cf304415471b513389b524db96c23c608bb1d352dde2b2fda228cfa8f5d272620c
@@ -1,16 +1,57 @@
1
- name: Ruby
2
-
3
- on: [push,pull_request]
4
-
1
+ name: Release and Publish
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
5
6
  jobs:
6
7
  build:
7
8
  runs-on: ubuntu-latest
8
9
  steps:
9
- - uses: actions/checkout@v2
10
- - name: Set up Ruby
11
- uses: ruby/setup-ruby@v1
12
- with:
13
- ruby-version: 3.0.2
14
- bundler-cache: true
15
- - name: Run the default task
16
- run: bundle exec rake
10
+ - name: Wait for tests to succeed
11
+ uses: lewagon/wait-on-check-action@v1.0.0
12
+ with:
13
+ ref: ${{ github.ref }}
14
+ check-name: 'Run tests'
15
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
16
+ wait-interval: 10
17
+ - uses: GoogleCloudPlatform/release-please-action@v2
18
+ id: release
19
+ with:
20
+ release-type: ruby
21
+ package-name: rails-interactive
22
+ version-file: 'lib/rails_interactive/version.rb'
23
+ - uses: actions/checkout@v2
24
+ if: ${{ steps.release.outputs.release_created }}
25
+ - name: Set up Ruby
26
+ uses: ruby/setup-ruby@v1
27
+ if: ${{ steps.release.outputs.release_created }}
28
+ with:
29
+ ruby-version: 3.0.2
30
+ bundler-cache: true
31
+ - name: Bundle Install
32
+ run: bundle install
33
+ if: ${{ steps.release.outputs.release_created }}
34
+ - name: Set Credentials
35
+ run: |
36
+ mkdir -p $HOME/.gem
37
+ touch $HOME/.gem/credentials
38
+ chmod 0600 $HOME/.gem/credentials
39
+ printf -- "---\n:github: Bearer ${GITHUB_TOKEN}\n" > $HOME/.gem/credentials
40
+ printf -- "---\n:rubygems_api_key: ${RUBYGEMS_TOKEN}\n" > $HOME/.gem/credentials
41
+ if: ${{ steps.release.outputs.release_created }}
42
+ env:
43
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
44
+ RUBYGEMS_TOKEN: '${{secrets.RUBYGEMS_TOKEN}}'
45
+ - name: Publish to GitHub Packages
46
+ run: |
47
+ export OWNER=$( echo ${{ github.repository }} | cut -d "/" -f 1 )
48
+ gem build *.gemspec
49
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
50
+ gem push *.gem
51
+ if: ${{ steps.release.outputs.release_created }}
52
+ - name: Publish to RubyGems
53
+ run: |
54
+ gem build *.gemspec
55
+ gem push --host https://rubygems.pkg.github.com/${OWNER} *.gem
56
+ gem push *.gem
57
+ if: ${{ steps.release.outputs.release_created }}
@@ -0,0 +1,17 @@
1
+ name: Run tests
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ name: Run tests
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v2
11
+ - name: Set up Ruby
12
+ uses: ruby/setup-ruby@v1
13
+ with:
14
+ ruby-version: 3.0.2
15
+ bundler-cache: true
16
+ - name: Run the default task
17
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -7,6 +7,12 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  .DS_Store
10
-
10
+ /Gemfile.lock
11
+ *.bundle
12
+ *.so
13
+ *.o
14
+ *.a
15
+ mkmf.log
16
+ *.gem
11
17
  # rspec failure tracking
12
18
  .rspec_status
data/Gemfile CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- # Specify your gem's dependencies in rails-interactive.gemspec
5
+ # Specify your gem's dependencies in rails_interactive.gemspec
6
6
  gemspec
7
7
 
8
8
  gem "rails"
@@ -13,6 +13,4 @@ gem "rspec", "~> 3.0"
13
13
 
14
14
  gem "rubocop", "~> 1.7"
15
15
 
16
- gem "byebug", "~> 11.1.2"
17
-
18
16
  gem "tty-prompt"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails-interactive (0.1.0)
4
+ rails-interactive (0.1.3)
5
5
  tty-prompt
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,28 +1,19 @@
1
- # Rails::Interactive
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rails/interactive`. To experiment with that code, run `bin/console` for an interactive prompt.
1
+ ![render1647134864886](https://user-images.githubusercontent.com/15168877/158041125-2ba863cf-ab17-4c8e-a603-7ccb0494938b.gif)
4
2
 
5
- TODO: Delete this and the text above, and describe your gem
3
+ # Rails::Interactive
4
+ [![Gem Version](https://badge.fury.io/rb/rails-interactive.svg)](https://badge.fury.io/rb/rails-interactive)
6
5
 
7
6
  ## Installation
8
7
 
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'rails-interactive'
8
+ ```bash
9
+ $ gem install rails-interactive
13
10
  ```
14
11
 
15
- And then execute:
16
-
17
- $ bundle install
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install rails-interactive
22
-
23
12
  ## Usage
24
13
 
25
- TODO: Write usage instructions here
14
+ ```bash
15
+ $ rails-interactive new
16
+ ```
26
17
 
27
18
  ## Development
28
19
 
@@ -32,7 +23,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
23
 
33
24
  ## Contributing
34
25
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rails-interactive. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/rails-interactive/blob/master/CODE_OF_CONDUCT.md).
26
+ Bug reports and pull requests are welcome on GitHub at https://github.com/oguzsh/rails-interactive. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/oguzsh/rails-interactive/blob/master/CODE_OF_CONDUCT.md).
36
27
 
37
28
  ## License
38
29
 
@@ -40,4 +31,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
40
31
 
41
32
  ## Code of Conduct
42
33
 
43
- Everyone interacting in the Rails::Interactive project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/rails-interactive/blob/master/CODE_OF_CONDUCT.md).
34
+ Everyone interacting in the Rails::Interactive project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/oguzsh/rails-interactive/blob/master/CODE_OF_CONDUCT.md).
data/bin/console CHANGED
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "bundler/setup"
5
- require "interactive"
5
+ require "rails_interactive"
6
6
 
7
7
  # You can add fixtures and/or initialization code here to make experimenting
8
8
  # with your gem easier. You can also use a different console, if you like.
@@ -2,6 +2,6 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "bundler/setup"
5
- require "interactive"
5
+ require "rails_interactive"
6
6
 
7
- Interactive::CLI.new.perform(ARGV.first)
7
+ RailsInteractive::CLI.new.perform(ARGV.first)
data/bin/setup CHANGED
@@ -2,6 +2,6 @@
2
2
  set -euo pipefail
3
3
  IFS=$'\n\t'
4
4
  set -vx
5
- chmod u+x bin/interactive
5
+ chmod u+x bin/rails-interactive
6
6
 
7
7
  bundle install
@@ -2,12 +2,12 @@
2
2
 
3
3
  require "colorize"
4
4
 
5
- module Interactive
5
+ module RailsInteractive
6
6
  # Utils class for the interactive CLI module
7
7
  class Message
8
8
  def self.greet
9
9
  render_ascii
10
- puts "Welcome to Rails Interactive CLI - #{Interactive::VERSION}".colorize(:yellow)
10
+ puts "Welcome to Rails Interactive CLI".colorize(:yellow)
11
11
  end
12
12
 
13
13
  def self.help
@@ -32,10 +32,7 @@ module Interactive
32
32
  def self.prepare
33
33
  puts ""
34
34
  puts "Project created successfully ✅".colorize(:green)
35
- puts "Go to your project folder and run :".colorize(:green)
36
- puts "> bundle install && yarn".colorize(:yellow)
37
- puts "After that, ready to go 🎉".colorize(:green)
38
-
35
+ puts "Go to your project folder and ready to go 🎉".colorize(:green)
39
36
  rails_commands
40
37
  end
41
38
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "tty/prompt"
4
4
 
5
- module Interactive
5
+ module RailsInteractive
6
6
  # Prompt class for commands
7
7
  class Prompt
8
8
  # Create a new instance
@@ -30,6 +30,8 @@ module Interactive
30
30
  @prompt.ask(@msg, required: @required)
31
31
  when "select"
32
32
  @prompt.select(@msg, @options, required: @required)
33
+ when "multi_select"
34
+ @prompt.multi_select(@msg, @options)
33
35
  else
34
36
  puts "Invalid parameter"
35
37
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ run "bundle add devise"
4
+ Bundler.with_unbundled_env { run "bundle install" }
5
+
6
+ rails_command "generate devise:install"
7
+
8
+ run "rails generate devise User"
9
+ run "rails db:create"
10
+ run "rails db:migrate"
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsInteractive
4
+ VERSION = "0.1.4"
5
+ end
@@ -1,9 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "interactive/prompt"
4
- require "interactive/message"
3
+ require "rails_interactive/prompt"
4
+ require "rails_interactive/message"
5
+ require "fileutils"
5
6
 
6
- module Interactive
7
+ module RailsInteractive
7
8
  # CLI class for the interactive CLI module
8
9
  class CLI
9
10
  def initialize
@@ -31,6 +32,9 @@ module Interactive
31
32
  database_types = { "PostgreSQL" => "-d postgresql", "MySQL" => "-d mysql", "SQLite" => "" }
32
33
  @inputs[:database] = Prompt.new("Choose project's database: ", "select", database_types, required: true).perform
33
34
 
35
+ features = %w[devise]
36
+ @inputs[:features] = Prompt.new("Choose project features: ", "multi_select", features).perform
37
+
34
38
  create
35
39
  end
36
40
 
@@ -39,6 +43,15 @@ module Interactive
39
43
  system("bin/setup")
40
44
  # Create project
41
45
  system(setup)
46
+
47
+ copy_templates_to_project
48
+
49
+ # Move to project folder and install gems
50
+ Dir.chdir "./#{@inputs[:name]}"
51
+ @inputs[:features].each do |feature|
52
+ system("bin/rails app:template LOCATION=templates/setup_#{feature}.rb")
53
+ end
54
+
42
55
  # Prepare project requirements and give instructions
43
56
  Message.prepare
44
57
  end
@@ -51,5 +64,9 @@ module Interactive
51
64
 
52
65
  "#{base} #{cmd}".strip!
53
66
  end
67
+
68
+ def copy_templates_to_project
69
+ FileUtils.cp_r "#{__dir__}/rails_interactive/templates", "./#{@inputs[:name]}"
70
+ end
54
71
  end
55
72
  end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "lib/interactive/version"
3
+ require_relative "lib/rails_interactive/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "rails-interactive"
7
- spec.version = Interactive::VERSION
7
+ spec.version = RailsInteractive::VERSION
8
8
  spec.authors = ["Oguzhan Ince"]
9
9
  spec.email = ["oguzhan824@gmail.com"]
10
10
 
@@ -17,21 +17,23 @@ Gem::Specification.new do |spec|
17
17
  spec.metadata["source_code_uri"] = "https://github.com/oguzsh/rails-interactive"
18
18
  spec.metadata["changelog_uri"] = "https://github.com/oguzsh/rails-interactive/blob/main/CHANGELOG.md"
19
19
 
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
22
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
21
23
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
22
24
  end
23
- spec.executables << "interactive"
25
+ spec.executables = spec.files.grep(%r{\Abin/}) { |f| File.basename(f) }
24
26
  spec.require_paths = ["lib"]
25
27
 
26
28
  # Uncomment to register a new dependency of your gem
27
- spec.add_development_dependency "bundler", "~> 2.3.9"
29
+ spec.add_development_dependency "bundler"
28
30
  spec.add_development_dependency "byebug", "~> 11.1.2"
29
- spec.add_development_dependency "colorize", "~> 0.8.1"
30
- spec.add_development_dependency "rake", "~> 13.0"
31
- spec.add_development_dependency "rspec", "~> 3.0"
32
- spec.add_development_dependency "rubocop", "~> 1.7"
31
+ spec.add_development_dependency "colorize"
32
+ spec.add_development_dependency "rake"
33
+ spec.add_development_dependency "rspec"
34
+ spec.add_development_dependency "rubocop"
33
35
 
34
- spec.add_dependency "tty-prompt", "~> 0.23.1"
36
+ spec.add_dependency "tty-prompt"
35
37
 
36
38
  # For more information and examples about making a new gem, checkout our
37
39
  # guide at: https://bundler.io/guides/creating_gem.html
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-interactive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oguzhan Ince
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-13 00:00:00.000000000 Z
11
+ date: 2022-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 2.3.9
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 2.3.9
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -42,81 +42,84 @@ dependencies:
42
42
  name: colorize
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 0.8.1
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.8.1
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '13.0'
61
+ version: '0'
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: '13.0'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '3.0'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '3.0'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rubocop
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '1.7'
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '1.7'
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: tty-prompt
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 0.23.1
103
+ version: '0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 0.23.1
110
+ version: '0'
111
111
  description:
112
112
  email:
113
113
  - oguzhan824@gmail.com
114
114
  executables:
115
- - interactive
115
+ - console
116
+ - rails-interactive
117
+ - setup
116
118
  extensions: []
117
119
  extra_rdoc_files: []
118
120
  files:
119
121
  - ".github/workflows/main.yml"
122
+ - ".github/workflows/rspec_rubocop.yml"
120
123
  - ".gitignore"
121
124
  - ".rspec"
122
125
  - ".rubocop.yml"
@@ -128,13 +131,13 @@ files:
128
131
  - README.md
129
132
  - Rakefile
130
133
  - bin/console
131
- - bin/interactive
134
+ - bin/rails-interactive
132
135
  - bin/setup
133
- - lib/interactive.rb
134
- - lib/interactive/ascii.txt
135
- - lib/interactive/message.rb
136
- - lib/interactive/prompt.rb
137
- - lib/interactive/version.rb
136
+ - lib/rails_interactive.rb
137
+ - lib/rails_interactive/message.rb
138
+ - lib/rails_interactive/prompt.rb
139
+ - lib/rails_interactive/templates/setup_devise.rb
140
+ - lib/rails_interactive/version.rb
138
141
  - rails-interactive.gemspec
139
142
  homepage: https://github.com/oguzsh/rails-interactive
140
143
  licenses:
File without changes
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Interactive
4
- VERSION = "0.1.0"
5
- end