Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while trying to run rake task #104

Open
luizs81 opened this issue Feb 3, 2016 · 15 comments
Open

Error while trying to run rake task #104

luizs81 opened this issue Feb 3, 2016 · 15 comments

Comments

@luizs81
Copy link

luizs81 commented Feb 3, 2016

ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
Rails 4.1.11

rake diagram:all --trace
** Invoke diagram:all (first_time)
** Invoke diagram:setup:create_new_doc_folder_if_needed (first_time)
** Execute diagram:setup:create_new_doc_folder_if_needed
** Invoke diagram:models:complete (first_time)
** Execute diagram:models:complete
Generating /Users/luiz/prott-api/doc/models_complete.svg
railroady -lamM | sed -E 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | dot -Tsvg > /Users/luiz/prott-api/doc/models_complete.svg
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-rewrite-1.5.0/lib/rack/rewrite/rule.rb:172: warning: duplicated key at line 173 ignored: "Content-Type"
Error: <stdin>: syntax error in line 1 near 'W'
Warning: syntax ambiguity - badly delimited number '-03T' in line 1 of <stdin> splits into two tokens
Warning: syntax ambiguity - badly delimited number '-03T' in line 2 of <stdin> splits into two tokens
rake aborted!
Command failed with status (1): [railroady -lamM | sed -E 's/\x1B\[([0-9]{1...]
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/file_utils.rb:66:in `block in create_shell_runner'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/file_utils.rb:57:in `call'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/file_utils.rb:57:in `sh'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/file_utils_ext.rb:37:in `sh'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railroady-1.4.2/tasks/railroady.rake:64:in `block (3 levels) in <top (required)>'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:240:in `call'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:240:in `block in execute'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:235:in `each'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:235:in `execute'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:201:in `block in invoke_prerequisites'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:199:in `each'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:199:in `invoke_prerequisites'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:178:in `block in invoke_with_call_chain'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/task.rb:165:in `invoke'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:150:in `invoke_task'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:106:in `block (2 levels) in top_level'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:106:in `each'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:106:in `block in top_level'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:115:in `run_with_threads'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:100:in `top_level'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:78:in `block in run'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/usr/local/var/rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:75:in `run'
/usr/local/var/rbenv/versions/2.2.2/bin/rake:33:in `<main>'
Tasks: TOP => diagram:all => diagram:models:complete
@preston
Copy link
Owner

preston commented Feb 3, 2016

Could you try running the command string manually from the command line and see if that helps to troubleshoot? This doesn't look familiar.

@tuexss
Copy link

tuexss commented Jun 22, 2016

I'm getting the same, even from directly triggering it:

railroady -lamM | sed -E 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | dot -Tsvg > /somepath/doc/models_complete.svg
Error: <stdin>: syntax error in line 1 near '
Warning: syntax ambiguity - badly delimited number '1m' in line 1 of <stdin> splits into two tokens
Warning: syntax ambiguity - badly delimited number '36m' in line 1 of <stdin> splits into two tokens
Warning: syntax ambiguity - badly delimited number '1.2m' in line 1 of <stdin> splits into two tokens
Warning: syntax ambiguity - badly delimited number '0m' in line 1 of <stdin> splits into two tokens
...

Graphviz doesn't like digits in the beginning.

@lastobelus
Copy link

I am getting similar errors (using brew graphviz 2.38.0_1)

rake diagram:all --trace
bundle exec rake diagram:all --trace:
** Invoke diagram:all (first_time)
** Invoke diagram:setup:create_new_doc_folder_if_needed (first_time)
** Execute diagram:setup:create_new_doc_folder_if_needed
** Invoke diagram:models:complete (first_time)
** Execute diagram:models:complete
Generating /Users/lasto/clients/webify/teesforthepeople-api/doc/models_complete.svg
railroady -lamM | sed -E 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | dot -Tsvg > /Users/lasto/clients/webify/teesforthepeople-api/doc/models_complete.svg
/Users/lasto/clients/webify/teesforthepeople-api/app/models/lab_color.rb:3: warning: already initialized constant LabColor
/Users/lasto/clients/webify/teesforthepeople-api/app/models/lab_color.rb:3: warning: previous definition of LabColor was here
Error: <stdin>: syntax error in line 1 near 'D'
Warning: syntax ambiguity - badly delimited number '-28T' in line 1 of <stdin> splits into two tokens
rake aborted!
Command failed with status (1): [railroady -lamM | sed -E 's/\x1B\[([0-9]{1...]
/Users/lasto/.rvm/gems/ruby-2.2.5@tees/gems/rake-11.2.2/lib/rake/file_utils.rb:69:in `block in create_shell_runner'
/Users/lasto/.rvm/gems/ruby-2.2.5@tees/gems/rake-11.2.2/lib/rake/file_utils.rb:59:in `call'
/Users/lasto/.rvm/gems/ruby-2.2.5@tees/gems/rake-11.2.2/lib/rake/file_utils.rb:59:in `sh'
/Users/lasto/.rvm/gems/ruby-2.2.5@tees/gems/rake-11.2.2/lib/rake/file_utils_ext.rb:37:in `sh'
/Users/lasto/.rvm/gems/ruby-2.2.5@tees/gems/railroady-1.5.1/tasks/railroady.rake:64:in `block (3 levels) in <top (required)>'

@mattlindsey
Copy link

Also on:
ruby-2.3.1
rails 4.2.6

rake diagram:all_with_engines
Generating /Users/mattlindsey/Documents/github/redeemify/doc/models_complete.svg
railroady -ilamzM | sed -E 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | dot -Tsvg > /Users/mattlindsey/Documents/github/redeemify/doc/models_complete.svg
Error: <stdin>: syntax error in line 1 near '
Warning: syntax ambiguity - badly delimited number '1m' in line 1 of <stdin> splits into two tokens
Warning: syntax ambiguity - badly delimited number '36m' in line 1 of <stdin> splits into two tokens

@tansaku
Copy link

tansaku commented Nov 1, 2016

I see this too - funny - it works for me in some rails projects but not others ... here's me splitting the command into three components:

tansaku@Samuels-MacBook-Pro:~/Documents/GitHub/StrawberryCanyon/redeemify (master)]$ 
→ railroady -lamM
  ActiveRecord::SchemaMigration Load (0.3ms)  SELECT "schema_migrations".* FROM "schema_migrations"
digraph models_diagram {
    graph[overlap=false, splines=true, bgcolor="none"]
    _diagram_info [shape="plaintext", label="Models diagram\lDate: Nov 01 2016 - 17:46\lMigration version: 20161030143818\lGenerated by RailRoady 1.5.1\lhttp://railroady.prestonlee.com\l", fontsize=13]
    "AdminUser" [shape=Mrecord, label="{AdminUser|updated_at :timestamp without time zone\lemail :character varying\lencrypted_password :character varying\lreset_password_token :character varying\lreset_password_sent_at :timestamp without time zone\lremember_created_at :timestamp without time zone\lsign_in_count :integer\lcurrent_sign_in_at :timestamp without time zone\llast_sign_in_at :timestamp without time zone\lcurrent_sign_in_ip :character varying\llast_sign_in_ip :character varying\lcreated_at :timestamp without time zone\lid :integer\l}"]
    "Provider" [shape=Mrecord, label="{Provider|removedCodes :integer\lname :character varying\lhistory :character varying\lprovider :character varying\lemail :character varying\lcreated_at :timestamp without time zone\lupdated_at :timestamp without time zone\lusedCodes :integer\luploadedCodes :integer\lunclaimCodes :integer\lid :integer\l}"]
    "RedeemifyCode" [shape=Mrecord, label="{RedeemifyCode|email :character varying\lname :character varying\lcode :character varying\luser_id :integer\lprovider_id :integer\lcreated_at :timestamp without time zone\lupdated_at :timestamp without time zone\luser_name :character varying\lid :integer\l}"]
    "User" [shape=Mrecord, label="{User|email :character varying\lprovider :character varying\luid :character varying\lname :character varying\lcreated_at :timestamp without time zone\lupdated_at :timestamp without time zone\lcode :character varying\lid :integer\l}"]
    "Vendor" [shape=Mrecord, label="{Vendor|removedCodes :integer\lname :character varying\luid :character varying\lprovider :character varying\ldescription :character varying\lcreated_at :timestamp without time zone\lupdated_at :timestamp without time zone\lemail :character varying\lhistory :character varying\lwebsite :character varying\linstruction :character varying\lhelpLink :character varying\lcashValue :character varying\lexpiration :character varying\lusedCodes :integer\luploadedCodes :integer\lunclaimCodes :integer\lid :integer\l}"]
    "VendorCode" [shape=Mrecord, label="{VendorCode|email :character varying\lcode :character varying\lvendor :character varying\lcreated_at :timestamp without time zone\lupdated_at :timestamp without time zone\lvendor_id :integer\luser_id :integer\lname :character varying\luser_name :character varying\lid :integer\l}"]
    "Provider" -> "RedeemifyCode" [arrowtail=odot, arrowhead=crow, dir=both color="#DBBD5C"]
    "User" -> "VendorCode" [arrowtail=odot, arrowhead=crow, dir=both color="#14C14F"]
    "Vendor" -> "VendorCode" [arrowtail=odot, arrowhead=crow, dir=both color="#332BBB"]
}
[tansaku@Samuels-MacBook-Pro:~/Documents/GitHub/StrawberryCanyon/redeemify (master)]$ 
→ railroady -lamM | sed -E 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g'
  ActiveRecord::SchemaMigration Load (0.4ms)  SELECT "schema_migrations".* FROM "schema_migrations"
digraph models_diagram {
    graph[overlap=false, splines=true, bgcolor="none"]
    _diagram_info [shape="plaintext", label="Models diagram\lDate: Nov 01 2016 - 17:47\lMigration version: 20161030143818\lGenerated by RailRoady 1.5.1\lhttp://railroady.prestonlee.com\l", fontsize=13]
    "AdminUser" [shape=Mrecord, label="{AdminUser|updated_at :timestamp without time zone\lemail :character varying\lencrypted_password :character varying\lreset_password_token :character varying\lreset_password_sent_at :timestamp without time zone\lremember_created_at :timestamp without time zone\lsign_in_count :integer\lcurrent_sign_in_at :timestamp without time zone\llast_sign_in_at :timestamp without time zone\lcurrent_sign_in_ip :character varying\llast_sign_in_ip :character varying\lcreated_at :timestamp without time zone\lid :integer\l}"]
    "Provider" [shape=Mrecord, label="{Provider|removedCodes :integer\lname :character varying\lhistory :character varying\lprovider :character varying\lemail :character varying\lcreated_at :timestamp without time zone\lupdated_at :timestamp without time zone\lusedCodes :integer\luploadedCodes :integer\lunclaimCodes :integer\lid :integer\l}"]
    "RedeemifyCode" [shape=Mrecord, label="{RedeemifyCode|email :character varying\lname :character varying\lcode :character varying\luser_id :integer\lprovider_id :integer\lcreated_at :timestamp without time zone\lupdated_at :timestamp without time zone\luser_name :character varying\lid :integer\l}"]
    "User" [shape=Mrecord, label="{User|email :character varying\lprovider :character varying\luid :character varying\lname :character varying\lcreated_at :timestamp without time zone\lupdated_at :timestamp without time zone\lcode :character varying\lid :integer\l}"]
    "Vendor" [shape=Mrecord, label="{Vendor|removedCodes :integer\lname :character varying\luid :character varying\lprovider :character varying\ldescription :character varying\lcreated_at :timestamp without time zone\lupdated_at :timestamp without time zone\lemail :character varying\lhistory :character varying\lwebsite :character varying\linstruction :character varying\lhelpLink :character varying\lcashValue :character varying\lexpiration :character varying\lusedCodes :integer\luploadedCodes :integer\lunclaimCodes :integer\lid :integer\l}"]
    "VendorCode" [shape=Mrecord, label="{VendorCode|email :character varying\lcode :character varying\lvendor :character varying\lcreated_at :timestamp without time zone\lupdated_at :timestamp without time zone\lvendor_id :integer\luser_id :integer\lname :character varying\luser_name :character varying\lid :integer\l}"]
    "Provider" -> "RedeemifyCode" [arrowtail=odot, arrowhead=crow, dir=both color="#D3E424"]
    "User" -> "VendorCode" [arrowtail=odot, arrowhead=crow, dir=both color="#695F0C"]
    "Vendor" -> "VendorCode" [arrowtail=odot, arrowhead=crow, dir=both color="#D4B48C"]
}
[tansaku@Samuels-MacBook-Pro:~/Documents/GitHub/StrawberryCanyon/redeemify (master)]$ 
→ railroady -lamM | sed -E 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | dot -Tsvg
Error: <stdin>: syntax error in line 1 near '
Warning: syntax ambiguity - badly delimited number '1m' in line 1 of <stdin> splits into two tokens
Warning: syntax ambiguity - badly delimited number '36m' in line 1 of <stdin> splits into two tokens
Warning: syntax ambiguity - badly delimited number '0.4m' in line 1 of <stdin> splits into two tokens
Warning: syntax ambiguity - badly delimited number '0m' in line 1 of <stdin> splits into two tokens
Warning: syntax ambiguity - badly delimited number '1m' in line 1 of <stdin> splits into two tokens
Warning: syntax ambiguity - badly delimited number '0m' in line 1 of <stdin> splits into two tokens```

funny thing is that the tokens it is complaining about don't appear in the last stage of the output ...

@mattlindsey
Copy link

Clue. Something in the Railroady code seems to be outputting this line first, which causes dot to fail:

^[[1m^[[36mActiveRecord::SchemaMigration Load (0.6ms)^[[0m  ^[[1mSELECT "schema_migrations".* FROM "schema_migrations"^[[0m

@marnen
Copy link

marnen commented May 3, 2017

#116 should fix this.

@roeintense
Copy link

I am running in to this issue as well. Some work, some don't, like @tansaku says.

@marnen
Copy link

marnen commented May 16, 2017

@roeintense Right, it depends on Rails logging and maybe some other settings. Try the fork in #116 (could we please get that merged?).

@joelvh
Copy link

joelvh commented May 27, 2017

Seems this all relates to ActiveRecord logging. Simple solution that worked for me was to set the ActiveRecord logger to nil in config/environments/development.rb when running railroady:

Rails.application.configure do

  config.log_level = :debug

  config.active_record.logger = Logger.new(STDOUT)
  config.active_record.logger.level = config.log_level

  if $0 =~ /(rake|railroady|erd)$/
    config.active_record.logger = nil
  end

end

@marnen
Copy link

marnen commented May 28, 2017

@joelvh Please see #116, which essentially does the same thing without resorting to parsing the command line.

@joelvh
Copy link

joelvh commented May 28, 2017

@marnen once that's merged, it may help. However, if there is an AR logger and the log level is debug, there will still be artifacts interfering with the output piped to the other commands.

@marnen
Copy link

marnen commented May 29, 2017

@joelvh Are you saying that AR logging in Rails doesn't necessarily come through the Rails logger? That's the only case I could think of in which your last comment would be accurate.

@preston
Copy link
Owner

preston commented May 30, 2017

Are folks ok with merging in PR #116?

@kimroen
Copy link

kimroen commented May 31, 2017

Output from logging is what is tripping it up for me as well, so silencing the logger seems like an okay solution.

preston added a commit that referenced this issue Jun 6, 2017
Silence logger when getting schema. [#104]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants