Code Monkey home page Code Monkey logo

gt4ruby's Introduction

Glamorous Toolkit for Ruby

How to parse and import ASTs:

GtRubyImporter new parseDirectory: '/home/brant/Downloads/'

How to generate classes:

GtRubyImporter new buildClassesFromDirectory: '/home/brant/Downloads/'

gt4ruby's People

Contributors

j-brant avatar girba avatar refactoringdr avatar chisandrei avatar syrel avatar akgrant43 avatar jurajkubelka avatar

Stargazers

Tomas Ruzicka avatar Guess avatar masukomi (a.k.a. Kay Rhodes) avatar

Watchers

 avatar  avatar  avatar James Cloos avatar  avatar  avatar George Ganea avatar  avatar  avatar  avatar

gt4ruby's Issues

Instance of GtRubyModule did not understand #superInheritances

Trying to analyze a Rails codebase following the example in the Lepiter notebook that comes with Glamorous.

Error happens sending #createActiveRecordLinksAndAttributes to the imported model.

The code that causes the error is as follows:

rootDirectory := 'example' asFileReference ensureDeleteAll.
repository := IceRepositoryCreator new
  remote: (IceGitRemote url: '[email protected]:example/example.git');
  location: rootDirectory;
  createRepository.
rootDirectory

rootDirectory := 'example' asFileReference.
importer := GtSmaCCRubyImporter new.
model := importer
	importASTs: (importer parseDirectory: rootDirectory).

model createForeignKeys.
model createActiveRecordLinksAndAttributes.

Backtrace:

GtRubyModule(Object)>>doesNotUnderstand: #superInheritances
FMMultivalueLink class>>on:update:from:to:
FAMIXInheritance>>subclass:
[ :each | 
			each rubyActiveRecordClass isNil
				ifTrue: [ | rubyClassName class inheritance |
					rubyClassName := self
						rubyClassNameFrom: each name
						removePluralization: true.
					class := self ensureClassNamed: rubyClassName.
					inheritance := FAMIXInheritance new
						superclass: self ensureActiveRecordBaseClass;
						subclass: class.
					class isStub: true.
					mooseModel add: inheritance.
					each rubyActiveRecordClass: class.
					self createActiveRecordLinkBetweenClass: class andTable: each ] ] in GtSmaCCRubyImporter(GtRubyImporter)>>createStubClassesFromTables in Block: [ :each | ...
Dictionary>>valuesDo:
Dictionary>>do:
GtSmaCCRubyImporter(GtRubyImporter)>>createStubClassesFromTables
UndefinedObject(a subclass of UndefinedObject)>>DoIt
GtPharoSnippetCoder(GtPharoSourceCoder)>>primitiveEvaluate:inContext:onFailDo:
[ 
		self
			primitiveEvaluate: aDecoratedSourceString
			inContext: aSourceCoderEvaluationContext
			onFailDo: [
				| aResultWithSyntaxError |

				aResultWithSyntaxError := GtSourceCoderEvaluationResultWithSyntaxError new
					evaluationContext: aSourceCoderEvaluationContext.
				aThenBlock cull: aResultWithSyntaxError.
				^ aResultWithSyntaxError ] ] in GtPharoSnippetCoder(GtSourceCoder)>>evaluate:decorated:inContext:thenDo: in Block: [ ...
FullBlockClosure(BlockClosure)>>on:do:
GtPharoSnippetCoder(GtSourceCoder)>>evaluateBlock:onErrorDo:
GtPharoSnippetCoder(GtSourceCoder)>>evaluate:decorated:inContext:thenDo:
GtPharoSnippetCoder(GtSourceCoder)>>evaluate:inContext:thenDo:
GtPharoSnippetCoder(GtSourceCoder)>>doItAndGoInContext:
GtPharoSnippetCoderViewModel(GtSourceCoderViewModel)>>doItAndGoAll
GtPharoSnippetCoderViewModel(GtSourceCoderViewModel)>>doItAndGo
[ self coderViewModel perform: action ] in GtCoderCodeExecutor>>execute in Block: [ self coderViewModel perform: action ]
[ activeProcess
			psValueAt: index
			put: anObject.
		aBlock value ] in GtCoderExecutionContextVariable(DynamicVariable)>>value:during: in Block: [ activeProcess...
FullBlockClosure(BlockClosure)>>ensure:
GtCoderExecutionContextVariable(DynamicVariable)>>value:during:
GtCoderExecutionContextVariable class(DynamicVariable class)>>value:during:
GtCoderExecutionContextVariable class>>element:do:
GtCoderCodeExecutor>>execute
[ :aCoderUIModel :anElement | 
			GtCoderCodeExecutor doItAndGo
				coderViewModel: aCoderUIModel;
				element: anElement;
				execute ] in GtPharoSnippetCoder>>initializeAddOns: in Block: [ :aCoderUIModel :anElement | ...
FullBlockClosure(BlockClosure)>>valueWithPossibleArgs:
FullBlockClosure(BlockClosure)>>glamourValueWithArgs:
[ aGtCoderAction action
								glamourValueWithArgs:
									{self textualCoderViewModel.
									aButtonElement} ] in [ [ aGtCoderAction action
								glamourValueWithArgs:
									{self textualCoderViewModel.
									aButtonElement} ]
								ensure: [ self enqueueEnableButton: aButtonElement action: aGtCoderAction ] ] in [ aButtonElement
				enqueueTask:
					(BlTaskAction new
						action: [ [ aGtCoderAction action
								glamourValueWithArgs:
									{self textualCoderViewModel.
									aButtonElement} ]
								ensure: [ self enqueueEnableButton: aButtonElement action: aGtCoderAction ] ]) ] in GtCoderActionsElement>>handleButton:action:onEvent: in Block: [ aGtCoderAction action...
FullBlockClosure(BlockClosure)>>ensure:
[ [ aGtCoderAction action
								glamourValueWithArgs:
									{self textualCoderViewModel.
									aButtonElement} ]
								ensure: [ self enqueueEnableButton: aButtonElement action: aGtCoderAction ] ] in [ aButtonElement
				enqueueTask:
					(BlTaskAction new
						action: [ [ aGtCoderAction action
								glamourValueWithArgs:
									{self textualCoderViewModel.
									aButtonElement} ]
								ensure: [ self enqueueEnableButton: aButtonElement action: aGtCoderAction ] ]) ] in GtCoderActionsElement>>handleButton:action:onEvent: in Block: [ [ aGtCoderAction action...
FullBlockClosure(BlockClosure)>>cull:
BlTaskAction>>run
[ aTask run ] in [ BlTaskExecutionSignal for: aTask block: [ aTask run ] ] in [ :aTask |
			aTask setExecuting.
			BlFrameTelemetry
				timeSync: [ 'Run task {1} ({2})' format: { aTask class name . aTask } ]
				during: [ BlTaskExecutionSignal for: aTask block: [ aTask run ] ].
			self onTaskExecuted: aTask.
			aTask requeueTaskAfterExecution ifTrue: 
				[ self requeue: aTask ]
			ifFalse:
				[ aTask setComplete ] ] in BlSpaceTaskQueue(BlTaskQueue)>>runOn: in Block: [ aTask run ]
BlTaskExecutionSignal class>>for:block:
[ BlTaskExecutionSignal for: aTask block: [ aTask run ] ] in [ :aTask |
			aTask setExecuting.
			BlFrameTelemetry
				timeSync: [ 'Run task {1} ({2})' format: { aTask class name . aTask } ]
				during: [ BlTaskExecutionSignal for: aTask block: [ aTask run ] ].
			self onTaskExecuted: aTask.
			aTask requeueTaskAfterExecution ifTrue: 
				[ self requeue: aTask ]
			ifFalse:
				[ aTask setComplete ] ] in BlSpaceTaskQueue(BlTaskQueue)>>runOn: in Block: [ BlTaskExecutionSignal for: aTask block: [ aTask ...etc...
NullTelemetry>>time:during:
BlSpaceTelemetry>>time:during:
BlFrameTelemetry(BaseProcessTelemetry)>>time:during:
BlFrameTelemetry(BaseProcessTelemetry)>>timeSync:during:
BlFrameTelemetry class(BaseProcessTelemetry class)>>timeSync:during:
[ :aTask |
			aTask setExecuting.
			BlFrameTelemetry
				timeSync: [ 'Run task {1} ({2})' format: { aTask class name . aTask } ]
				during: [ BlTaskExecutionSignal for: aTask block: [ aTask run ] ].
			self onTaskExecuted: aTask.
			aTask requeueTaskAfterExecution ifTrue: 
				[ self requeue: aTask ]
			ifFalse:
				[ aTask setComplete ] ] in BlSpaceTaskQueue(BlTaskQueue)>>runOn: in Block: [ :aTask |...
OrderedCollection>>do:
BlSpaceTaskQueue(BlTaskQueue)>>runOn:
GtWorld(BlSpace)>>runTasks
[ :theSpace | theSpace runTasks ] in BlSpaceFrameTaskPhase>>runOn: in Block: [ :theSpace | theSpace runTasks ]
FullBlockClosure(BlockClosure)>>cull:
GtWorld(BlSpace)>>dispatchTimeEvent:during:
BlSpaceFrameTaskPhase>>runOn:
[ self currentPhase runOn: aSpace ] in BlSpaceFrame>>runCurrentPhaseOn: in Block: [ self currentPhase runOn: aSpace ]
NullTelemetry>>time:during:
BlSpaceTelemetry>>time:during:
BlFrameTelemetry(BaseProcessTelemetry)>>time:during:
BlFrameTelemetry class(BaseProcessTelemetry class)>>time:during:
BlSpaceFrame>>runCurrentPhaseOn:
BlSpaceFrame>>runOn:
[ self frame runOn: self ] in [			
			BlFrameTelemetry
				reset;
				time: [ 'Frame' ]
					during: [ self frame runOn: self ];
				emit ] in BlSpace>>processPulse in Block: [ self frame runOn: self ]
NullTelemetry>>time:during:
BlSpaceTelemetry>>time:during:
BlFrameTelemetry(BaseProcessTelemetry)>>time:during:
BlFrameTelemetry class(BaseProcessTelemetry class)>>time:during:
[			
			BlFrameTelemetry
				reset;
				time: [ 'Frame' ]
					during: [ self frame runOn: self ];
				emit ] in BlSpace>>processPulse in Block: [			...
FullBlockClosure(BlockClosure)>>ensure:
BlFrameTelemetry class>>withSpace:andTelemetry:do:
GtWorld(BlSpace)>>processPulse
GtWorld(BlSpace)>>pulse
[ :eachSpace | eachSpace pulse ] in BlParallelUniverse>>pulseSynchronously in Block: [ :eachSpace | eachSpace pulse ]
Array(SequenceableCollection)>>do:
BlSpaceManager>>do:
[
		self tryToRunDeferredActions.
		spaceManager do: [ :eachSpace | eachSpace pulse ]
	] in BlParallelUniverse>>pulseSynchronously in Block: [...
FullBlockClosure(BlockClosure)>>ensure:
BlParallelUniverse>>pulseSynchronously
[
		self pulseSynchronously
	] in BlParallelUniverse>>pulse in Block: [...
FullBlockClosure(BlockClosure)>>ensure:
BlParallelUniverse>>pulse
BlHostPulseLoop>>firePulse
[ [ self firePulse.
	loopProcess == Processor activeProcess ] whileTrue ] in BlHostPulseLoop>>createLoopTask in Block: [ [ self firePulse....
[self value.
			Processor terminateActive] in FullBlockClosure(BlockClosure)>>newProcess in Block: [self value....

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.