blueprint-generators-rails 0.0.2

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
+ SHA1:
3
+ metadata.gz: d36515fb9547c5d8c43c5ee39243fe0a2f6261bd
4
+ data.tar.gz: f3275e659caa52ca5d0dd204faeb68e93142ea1d
5
+ SHA512:
6
+ metadata.gz: e9eda7d6f010ab3317f93fef4f8136d60231fc6fc0ace5cf094eb386f265cd07311f92a23edb120d01049e3a164b6cb32e7b12168f4052303d5f42e369ce96bb
7
+ data.tar.gz: ede89d54e83177d8a89c9a2bc039c7cef191f8d4c82f641e99b3085ff9cdbdc62a0a833a75ae06ed97751d9202bad0f7e9a4abe862208b6e57b4718f7bc9a02b
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # Ignore IDE-specific files
12
+ /.idea
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in blueprint-generators-rails.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Blueprint::Generators::Rails
2
+
3
+ The Blueprint Generators gem provides various Rake tasks for creating blueprints of your software.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'blueprint-generators-rails'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install blueprint-generators-rails
20
+
21
+ ## Usage
22
+
23
+ Create a Conceptual Model by doing this;
24
+
25
+ ```ruby
26
+ rake blueprint:cm
27
+ ```
28
+
29
+ And then cut-and-paste the Pogoscript output into the Blueprint [Scratchpad](http://blooming-waters-9183.herokuapp.com/scratchpad)
30
+
31
+ ## Development
32
+
33
+ After checking out the repo, run `bin/setup` to install dependencies. Then, 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` to 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
+ 1. Fork it ( https://github.com/[my-github-username]/blueprint-generators-rails/fork )
40
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
41
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
42
+ 4. Push to the branch (`git push origin my-new-feature`)
43
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "blueprint/generators/rails"
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
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'blueprint/generators/rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "blueprint-generators-rails"
8
+ spec.version = Blueprint::Generators::Rails::VERSION
9
+ spec.authors = ["benjii"]
10
+ spec.email = ["ben.deany@gmail.com"]
11
+
12
+ spec.summary = %q{Blueprint PogoScript generators for diagrams.}
13
+ spec.homepage = "http://blooming-waters-9183.herokuapp.com"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.bindir = "exe"
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.8"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+ end
@@ -0,0 +1,3 @@
1
+ module BlueprintGeneratorsRails
2
+ require 'blueprint/generators/rails/railtie' if defined?(Rails)
3
+ end
@@ -0,0 +1,12 @@
1
+ require 'blueprint/generators/rails'
2
+ require 'rails'
3
+
4
+ module BlueprintGeneratorsRails
5
+ class Railtie < Rails::Railtie
6
+ railtie_name :blueprint_generators_rails
7
+
8
+ rake_tasks do
9
+ load "tasks/blueprint.rake"
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,7 @@
1
+ module Blueprint
2
+ module Generators
3
+ module Rails
4
+ VERSION = "0.0.2"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,42 @@
1
+ namespace :blueprint do
2
+
3
+ desc 'Generate a Conceptual Model diagram for the current Rails project'
4
+ task :cm => :environment do
5
+ Rails.application.eager_load!
6
+
7
+ pogo = "conceptual model for \"" + Rails.application.class.parent_name + "\""
8
+
9
+ models = ActiveRecord::Base.descendants
10
+ models.each { |m|
11
+ pogo << "\n concept \"" + m.name + "\"\n"
12
+
13
+ associations = m.reflect_on_all_associations
14
+ associations.each { |a|
15
+
16
+ # TODO this is an OK solution but has some shortcomings - we need to figure out how to get the actual
17
+ # TODO associated model name (not the macro name which we then singularize and capitalize)
18
+
19
+ case a.macro
20
+ when :belongs_to, :has_one
21
+ pogo << " has one \"" + a.name.to_s.singularize.capitalize + "\"\n"
22
+ when :has_many
23
+ pogo << " has many \"" + a.name.to_s.singularize.capitalize + "\"\n"
24
+ else
25
+ # TODO error condition
26
+ end
27
+ }
28
+ }
29
+
30
+ puts ''
31
+ puts 'Navigate to the link below and paste the provided script into the editor'
32
+ puts ''
33
+ puts ' http://blooming-waters-9183.herokuapp.com/scratchpad/'
34
+ puts ''
35
+ puts '==== * START * ===='
36
+ puts pogo
37
+ puts '==== * END * ===='
38
+ puts ''
39
+ puts ''
40
+ end
41
+
42
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blueprint-generators-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - benjii
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-03-11 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.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description:
42
+ email:
43
+ - ben.deany@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - README.md
51
+ - Rakefile
52
+ - bin/console
53
+ - bin/setup
54
+ - blueprint-generators-rails.gemspec
55
+ - lib/blueprint/generators/rails.rb
56
+ - lib/blueprint/generators/rails/railtie.rb
57
+ - lib/blueprint/generators/rails/version.rb
58
+ - lib/tasks/blueprint.rake
59
+ homepage: http://blooming-waters-9183.herokuapp.com
60
+ licenses: []
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.2.2
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Blueprint PogoScript generators for diagrams.
82
+ test_files: []