arpry 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: 713eb737c63335766be6ccbb0d3ef319ea352dffd5d3cd606c79ac12ad69dafc
4
+ data.tar.gz: e887dc4bdffecdff5f591fdc6b0b660149c7bf188ac5bb59a30e60c8c8d32708
5
+ SHA512:
6
+ metadata.gz: 81e5d8e3c5badcc837451064dd6acbe10b6beda3f0ad99ee953d7775a19692d1251adb3a971b331fcba88407846502110cfd211466123efac3886bac4e3a530d
7
+ data.tar.gz: 89dd849304ba6402168881bde1fe32f6f1afc223b7026aad44e6b8e218eba1917f2f6d2f7278dc56abc55589f99418acbe07aa2c55a0776ce1931d6460568ef6
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,6 @@
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 arpry.gemspec
6
+ gemspec
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Arpry
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/arpry`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'arpry'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install arpry
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ 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).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/pocke/arpry.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/arpry.gemspec ADDED
@@ -0,0 +1,39 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "arpry/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "arpry"
8
+ spec.version = Arpry::VERSION
9
+ spec.authors = ["Masataka Pocke Kuwabara"]
10
+ spec.email = ["kuwabara@pocke.me"]
11
+
12
+ spec.summary = %q{Explore database without Rails}
13
+ spec.description = %q{Explore database without Rails}
14
+ spec.homepage = "https://github.com/pocke/arpry"
15
+
16
+ if spec.respond_to?(:metadata)
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
19
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against " \
22
+ "public gem pushes."
23
+ end
24
+
25
+ # Specify which files should be added to the gem when it is released.
26
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
28
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ spec.add_runtime_dependency 'activerecord', '< 6', '>= 5'
35
+ spec.add_runtime_dependency 'pry'
36
+
37
+ spec.add_development_dependency "bundler", "~> 1.17"
38
+ spec.add_development_dependency "rake", "~> 10.0"
39
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "arpry"
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
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -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
data/exe/arpry ADDED
@@ -0,0 +1,5 @@
1
+ #!ruby
2
+
3
+ require 'arpry'
4
+
5
+ exit Arpry::CLI.new(ARGV).run
data/lib/arpry.rb ADDED
@@ -0,0 +1,14 @@
1
+ require 'active_record'
2
+ require 'pry'
3
+
4
+ require "arpry/version"
5
+ require 'arpry/cli'
6
+ require 'arpry/application_record'
7
+
8
+ module Arpry
9
+ class Error < StandardError; end
10
+
11
+ # Namespace for automatically generated classes
12
+ module Namespace
13
+ end
14
+ end
@@ -0,0 +1,4 @@
1
+ module Arpry
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ end
4
+ end
data/lib/arpry/cli.rb ADDED
@@ -0,0 +1,40 @@
1
+ module Arpry
2
+ class CLI
3
+ def initialize(argv)
4
+ @argv = argv
5
+ @database = nil
6
+ @adapter = nil
7
+ end
8
+
9
+ def run
10
+ parse_options
11
+
12
+ ApplicationRecord.establish_connection(
13
+ adapter: @adapter,
14
+ database: @database,
15
+ )
16
+
17
+ generate_classes
18
+
19
+ binding.pry(Namespace)
20
+
21
+ return 0
22
+ end
23
+
24
+ private
25
+
26
+ # TODO
27
+ def parse_options
28
+ @database = @argv[0]
29
+ @adapter = 'sqlite3'
30
+ end
31
+
32
+ def generate_classes
33
+ ApplicationRecord.connection.tables.each do |table|
34
+ Namespace.const_set(table.classify, Class.new(ApplicationRecord) do
35
+ self.table_name = table
36
+ end)
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,3 @@
1
+ module Arpry
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: arpry
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Masataka Pocke Kuwabara
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-12-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '5'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '6'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '5'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '6'
33
+ - !ruby/object:Gem::Dependency
34
+ name: pry
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.17'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.17'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '10.0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '10.0'
75
+ description: Explore database without Rails
76
+ email:
77
+ - kuwabara@pocke.me
78
+ executables:
79
+ - arpry
80
+ extensions: []
81
+ extra_rdoc_files: []
82
+ files:
83
+ - ".gitignore"
84
+ - Gemfile
85
+ - README.md
86
+ - Rakefile
87
+ - arpry.gemspec
88
+ - bin/console
89
+ - bin/setup
90
+ - exe/arpry
91
+ - lib/arpry.rb
92
+ - lib/arpry/application_record.rb
93
+ - lib/arpry/cli.rb
94
+ - lib/arpry/version.rb
95
+ homepage: https://github.com/pocke/arpry
96
+ licenses: []
97
+ metadata:
98
+ homepage_uri: https://github.com/pocke/arpry
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubygems_version: 3.0.1
115
+ signing_key:
116
+ specification_version: 4
117
+ summary: Explore database without Rails
118
+ test_files: []