gorails 0.1.1 → 0.1.2

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: 7405b120eabf5b2ace5c2e122ab57b456567e1c985471f45582ad538e5a48345
4
- data.tar.gz: a08c99241ad71f5dcd87af57867c9e6644dd8bf02fed5a5a9909941f9870f673
3
+ metadata.gz: ceb227d76224d717af596ca69a9b7f670823bd20ae69e2225e21f4cccd4d349b
4
+ data.tar.gz: a836f4816f8c0d4b5db9e6dcb7c53005cd53f107f945d7efe611282f1e4a5137
5
5
  SHA512:
6
- metadata.gz: 624969edaed32a320bfeec953e44e291dc1620b83f15fed11d5a45dd9d31362be1b6a4679198c55e8c2ea6b3fc52243c71dcdad51172a1fa89d65e45909405eb
7
- data.tar.gz: 5d31c6e7e0be210a8b6f4bf81f62f7dd0f8e1899233cfaac86376b2d2d0dd3f6c72576100faaa5176253d13507b63080b6ee26f1d0d28d518677f848b50d5652
6
+ metadata.gz: '0541289f21a733a8af0168d9360fe50e5bd3c7a5d3a68261e2b293b2ac10e60f600dd04d6cb8167babe3908275abae1d6821da37dbd242d95e43ce6eced8b62d'
7
+ data.tar.gz: 659d2cb41d4fca9c4ff76dc4e10f72429547cce50a256af8832f716fae3fcb8e4a6d5a6ac11ff04faa4eb16640ea30c70bebb41b65bba549ad8e525d2f8186d0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gorails (0.1.1)
4
+ gorails (0.1.2)
5
5
  cli-kit (~> 4.0.0)
6
6
  cli-ui (~> 1.5.1)
7
7
 
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Gorails
1
+ # GoRails CLI
2
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/gorails`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![Gem Version](https://badge.fury.io/rb/gorails.svg)](https://badge.fury.io/rb/gorails)
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ An interactive CLI for [GoRails](https://gorails.com), [Railsbytes](https://railsbytes.com), [Jumpstart](https://github.com/excid3/jumpstart), [Ruby on Rails jobs](https://jobs.gorails.com), and more.
6
6
 
7
7
  ## Installation
8
8
 
@@ -12,27 +12,56 @@ Add this line to your application's Gemfile:
12
12
  gem 'gorails'
13
13
  ```
14
14
 
15
- And then execute:
15
+ And then run
16
16
 
17
- $ bundle install
17
+ ```bash
18
+ gorails
19
+ ```
20
+
21
+ ## Usage
18
22
 
19
- Or install it yourself as:
23
+ #### GoRails episodes
20
24
 
21
- $ gem install gorails
25
+ To see a list of the recent GoRails screencasts, you can run:
22
26
 
23
- ## Usage
27
+ ```sh
28
+ gorails episodes
29
+ ```
30
+
31
+ #### Ruby on Rails Jobs
32
+
33
+ To see a list of Ruby on Rails job posts, you can run:
34
+
35
+ ```sh
36
+ gorails jobs
37
+ ```
38
+
39
+ #### Railsbytes
40
+
41
+ To see a list of Railsbytes.com templates, you can run:
42
+
43
+ ```sh
44
+ gorails railsbytes
45
+ gorails railsbytes x7msKX
46
+ ```
47
+
48
+ #### Jumpstart
24
49
 
25
- TODO: Write usage instructions here
50
+ To create a Ruby on Rails app using the [Jumpstart template](https://github.com/excid3/jumpstart), you can run:
51
+
52
+ ```sh
53
+ gorails jumpstart myapp
54
+ ```
26
55
 
27
56
  ## Development
28
57
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
58
+ After checking out the repo, run `bundle` to install dependencies. Then, run `rake test` to run the tests. You can also run `exe/gorails` to test the gem.
30
59
 
31
60
  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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
61
 
33
62
  ## Contributing
34
63
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gorails. 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]/gorails/blob/main/CODE_OF_CONDUCT.md).
64
+ Bug reports and pull requests are welcome on GitHub at https://github.com/excid3/gorails-ruby. 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/excid3/gorails-ruby/blob/master/CODE_OF_CONDUCT.md).
36
65
 
37
66
  ## License
38
67
 
@@ -40,4 +69,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
40
69
 
41
70
  ## Code of Conduct
42
71
 
43
- Everyone interacting in the Gorails project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/gorails/blob/main/CODE_OF_CONDUCT.md).
72
+ Everyone interacting in the GoRails project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/excid3/gorails-ruby/blob/master/CODE_OF_CONDUCT.md).
@@ -5,7 +5,24 @@ require "json"
5
5
  module Gorails
6
6
  module Commands
7
7
  class Railsbytes < Gorails::Command
8
- def call(_args, _name)
8
+ def call(args, _name)
9
+ if args.none?
10
+ list
11
+ else
12
+ apply(args.first)
13
+ end
14
+ end
15
+
16
+ def self.help
17
+ <<~EOF
18
+ View the latest Railsbytes templates or load a template by ID.
19
+ Usage:
20
+ {{command:#{Gorails::TOOL_NAME} railsbytes}}
21
+ {{command:#{Gorails::TOOL_NAME} railsbytes x7msKX}}
22
+ EOF
23
+ end
24
+
25
+ def list
9
26
  bytes = JSON.parse Net::HTTP.get(URI("https://railsbytes.com/public/templates.json"))
10
27
 
11
28
  CLI::UI::Frame.open("Railsbytes") do
@@ -18,8 +35,32 @@ module Gorails
18
35
  end
19
36
  end
20
37
 
21
- def self.help
22
- "View the latest Railsbytes templates.\nUsage: {{command:#{Gorails::TOOL_NAME} railsbytes}}"
38
+ def apply(id)
39
+ byte = JSON.parse Net::HTTP.get(URI("https://railsbytes.com/public/templates/#{id}.json"))
40
+
41
+ CLI::UI::Frame.open("Railsbyte") do
42
+ puts CLI::UI.fmt "{{green:#{byte["name"]}}} by #{byte["created_by"]}"
43
+ puts byte["short_description"]
44
+ puts
45
+
46
+ CLI::UI::Prompt.ask("What would you like to do?") do |handler|
47
+ handler.option("View source") do |selection|
48
+ puts
49
+ puts byte["script"]
50
+ end
51
+
52
+ handler.option("Apply Railsbyte") do |selection|
53
+ puts
54
+ puts "Running Railsbyte..."
55
+
56
+ Bundler.with_original_env do
57
+ system "rails app:template LOCATION=\"https://railsbytes.com/script/#{id}\""
58
+ end
59
+ end
60
+
61
+ handler.option("exit") { |selection| exit 0 }
62
+ end
63
+ end
23
64
  end
24
65
  end
25
66
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gorails
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gorails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubygems_version: 3.3.5
106
+ rubygems_version: 3.3.7
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: GoRails rubygem