gogogo 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (8) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +5 -0
  3. data/Guardfile +7 -0
  4. data/README.md +40 -0
  5. data/gogogo +24 -0
  6. data/gogogo.gemspec +29 -0
  7. data/gogogo.rb +82 -0
  8. metadata +134 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e7ad12869e0c0aec28a88fdfbf884ef01317f24712b2a6cb8221608c0dabb66d
4
+ data.tar.gz: f1edd2b0631e1d54005b0f4b6a74307bba0a3624e8a14a4134721409ee1d570b
5
+ SHA512:
6
+ metadata.gz: 477dbd5ffae17680b6c511d9c7b74140d08cad2ed60e12942fcd5df5e566e1b5ef8bae11351a450079684ba9738394e738c2ac6cf6b5b79aebf2bb18c7afecf5
7
+ data.tar.gz: 83c84f8b79474e57d8e988c13d82f456e0baa6afc93a98ac52e388deb52dec81bc3e6945dfcb91b73b365f7f3c8f6f9d61b9873eccb327fef79ce0178685b5fa
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ guard :shell do
4
+ watch /(.*)/ do
5
+ system "ruby ./gogogo.rb"
6
+ end
7
+ end
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # GoGoGo
2
+ GoGoGo creates a single, workflow-friendly Ruby file to quickly test your ideas.
3
+
4
+ ### Great for
5
+ * Fast iterations at interviews
6
+ * Quickly testing gem ideas
7
+ * Starting a barebones project
8
+
9
+ ### Features
10
+
11
+ * Write your library and test code on the same file.
12
+ * Super fast feedback loops by auto-running tests when you save your files.
13
+ * Comes with pry so that you can poke around your code when needed.
14
+
15
+ ### Usage
16
+
17
+ Run the `gogogo` command and pass it the project name.
18
+
19
+ `$ gogogo my_project`
20
+
21
+ This will create the following file structure:
22
+
23
+ ```
24
+ my_project/
25
+ ├── .rspec
26
+ ├── Gemfile
27
+ ├── Guardfile
28
+ └── my_project.rb
29
+ ```
30
+
31
+ Then run `bundle install` and `bundle exec guard` to auto-run tests on save.
32
+
33
+ ```
34
+ $ bundle install
35
+ $ bundle exec guard
36
+ ```
37
+
38
+ Then begin writing code with blazingly fast feedback loops, all in one file: `my_project.rb`.
39
+
40
+ #### Forked from [rubynew](https://github.com/napcs/rubynew)
data/gogogo ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "gogogo.rb"
4
+
5
+ folder = ARGV[0]
6
+
7
+ if folder.nil?
8
+ puts <<~HELP
9
+ Specify a folder and I'll create a Ruby project in that folder.
10
+
11
+ Example:
12
+ gogogo my_project
13
+ HELP
14
+ else
15
+ if File.exists?(folder)
16
+ puts "This folder already exists. Please specify a folder that doesn't exist."
17
+ else
18
+ project = GoGoGo::Project.new(folder)
19
+ project.create!
20
+
21
+ puts "\nCreated new Ruby project in #{folder}.\n\n"
22
+ puts "To use this project, type: \n\n\tcd #{folder}\n\nInstall dependencies with\n\n\tbundle install\n\nand auto-run tests with\n\n\tbundle exec guard"
23
+ end
24
+ end
data/gogogo.gemspec ADDED
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "gogogo"
5
+ spec.version = "0.0.1"
6
+ spec.authors = ["Matias Fernandez"]
7
+ spec.email = ["matiasfmolinari@gmail.com"]
8
+ spec.summary = %q{Generate one super-charged Ruby file to quickly test ideas.}
9
+ spec.homepage = "https://github.com/MatiasFMolinari/gogogo"
10
+ spec.license = "MIT"
11
+
12
+ spec.files = [
13
+ "gogogo",
14
+ "gogogo.rb",
15
+ "Guardfile",
16
+ "Gemfile",
17
+ "README.md",
18
+ "gogogo.gemspec",
19
+ ]
20
+
21
+ spec.executables = spec.files.grep(%r{^/}) { |f| File.basename(f) }
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.6"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec", '>= 3.3'
26
+ spec.add_development_dependency "pry"
27
+ spec.add_development_dependency "guard"
28
+ spec.add_development_dependency "guard-shell"
29
+ end
data/gogogo.rb ADDED
@@ -0,0 +1,82 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rspec/autorun"
4
+ require "pry"
5
+
6
+ require "erb"
7
+ require "fileutils"
8
+ require "pathname"
9
+
10
+ module GoGoGo
11
+ class Project
12
+ def initialize(name)
13
+ @name = name
14
+ @underscored_name = @name.tr("-", "_")
15
+ @constant_name =
16
+ @name.
17
+ gsub(/-[_-]*(?![_-]|$)/) { "::" }.
18
+ gsub(/([_-]+|(::)|^)(.|$)/) { $2.to_s + $3.upcase }
19
+ end
20
+
21
+ def create!
22
+ template_path = File.expand_path("../template", __FILE__)
23
+
24
+ # copy the template
25
+ FileUtils.cp_r template_path, @name
26
+
27
+ # rename the files
28
+ FileUtils.mv(
29
+ File.join(@name, "app.rb"),
30
+ File.join(@name, "#{@underscored_name}.rb")
31
+ )
32
+
33
+ # apply templates
34
+ [
35
+ File.join(@name, "Guardfile"),
36
+ File.join(@name, "#{@underscored_name}.rb"),
37
+ ].each { |file| render_template_to_file file, binding }
38
+ end
39
+
40
+ private
41
+
42
+ def render_template_to_file(template, context)
43
+ t = File.read(template)
44
+
45
+ File.open(template, "w") do |f|
46
+ f << ERB.new(t, nil, "-").result(context)
47
+ end
48
+ end
49
+ end
50
+ end
51
+
52
+ describe "GoGoGo" do
53
+ before :each do
54
+ @folder = "my_project"
55
+ end
56
+
57
+ after :each do
58
+ FileUtils.rm_rf @folder
59
+ end
60
+
61
+ describe "::create" do
62
+ it "creates project directory" do
63
+ GoGoGo::Project.new(@folder).create!
64
+
65
+ expect(
66
+ File.exist?(File.join(@folder, ".rspec"))
67
+ ).to be true
68
+
69
+ expect(
70
+ File.exist?(File.join(@folder, "my_project.rb"))
71
+ ).to be true
72
+
73
+ expect(
74
+ File.exist?(File.join(@folder, "Gemfile"))
75
+ ).to be true
76
+
77
+ expect(
78
+ File.exist?(File.join(@folder, "Guardfile"))
79
+ ).to be true
80
+ end
81
+ end
82
+ end
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gogogo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Matias Fernandez
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-11-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '3.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '3.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: guard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard-shell
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description:
98
+ email:
99
+ - matiasfmolinari@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - Gemfile
105
+ - Guardfile
106
+ - README.md
107
+ - gogogo
108
+ - gogogo.gemspec
109
+ - gogogo.rb
110
+ homepage: https://github.com/MatiasFMolinari/gogogo
111
+ licenses:
112
+ - MIT
113
+ metadata: {}
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ requirements: []
129
+ rubyforge_project:
130
+ rubygems_version: 2.7.6
131
+ signing_key:
132
+ specification_version: 4
133
+ summary: Generate one super-charged Ruby file to quickly test ideas.
134
+ test_files: []