greasyfork-org / greasyfork

An online repository of user scripts.
https://greasyfork.org
GNU General Public License v3.0
1.47k stars 441 forks source link

Config samples #141

Closed Oreolek closed 10 years ago

Oreolek commented 10 years ago

Can you provide config samples? I'm not a Rails programmer.

JasonBarnabe commented 10 years ago

As in... how to set up to run Greasy Fork locally?

Oreolek commented 10 years ago

Yes.

JasonBarnabe commented 10 years ago

First shot at https://github.com/JasonBarnabe/greasyfork/wiki/Running-Greasy-Fork-locally . Let me know how it goes.

Oreolek commented 10 years ago

Thank you! It didn't end well, sadly (Debian wheezy, ruby 1.9.3):

$ bundle exec rake db:migrate
<...>
==  AddScriptIdToDiscussions: migrating =======================================
-- execute("ALTER TABLE GDN_Discussion ADD COLUMN ScriptID int NULL")
rake aborted!
An error has occurred, all later migrations canceled:

Mysql2::Error: Table 'greasyfork.GDN_Discussion' doesn't exist: ALTER TABLE GDN_Discussion ADD COLUMN ScriptID int NULL/var/lib/gems/1.9.1/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:287:in `query'

$ bundle exec rake ts:config
rake aborted!
Don't know how to build task 'ts:config'

Also, I think that the passenger and nginx stuff is optional, rails server works fine (except for complaining about pending migrations)

UPD: loading db/structure.sql fixed everything, and the site is up on my local machine. Thanks.

JasonBarnabe commented 10 years ago

The error you received is the forum stuff. I've added https://github.com/JasonBarnabe/greasyfork/wiki/Running-Greasy-Fork-locally#forum

Glad to hear you got it working, and I hope to see some pull requests soon :)

jixunmoe commented 10 years ago

Package libmysqlclient-dev was required to install gem mysql2 in Ubuntu. I'll try the rest tomorrow... Time to sleep :3

JasonBarnabe commented 10 years ago

Added that info.

jixunmoe commented 10 years ago
#1067 - Invalid default value for 'RegardingID'

Changed default NULL to 0, get another error:

 #1064 - You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right syntax to use near 
'(`DiscussionID`), KEY `IX_Discussion_Type` (`Type`), KEY `IX_Discussion_Fo'
at line 29

MySQL Version:

$ mysql --version
mysql  Ver 14.14 Distrib 5.5.37, for debian-linux-gnu (x86_64) using readline 6.3

Don't really know how to fix, so I decided to remove those key, and it worked.

CREATE TABLE `GDN_Discussion` (
  `DiscussionID` int(11) NOT NULL AUTO_INCREMENT,
  `Type` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ForeignID` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
  `CategoryID` int(11) NOT NULL,
  `InsertUserID` int(11) NOT NULL,
  `UpdateUserID` int(11) DEFAULT NULL,
  `FirstCommentID` int(11) DEFAULT NULL,
  `LastCommentID` int(11) DEFAULT NULL,
  `Name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `Body` text COLLATE utf8_unicode_ci NOT NULL,
  `Format` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Tags` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `CountComments` int(11) NOT NULL DEFAULT '0',
  `CountBookmarks` int(11) DEFAULT NULL,
  `CountViews` int(11) NOT NULL DEFAULT '1',
  `Closed` tinyint(4) NOT NULL DEFAULT '0',
  `Announce` tinyint(4) NOT NULL DEFAULT '0',
  `Sink` tinyint(4) NOT NULL DEFAULT '0',
  `DateInserted` datetime NOT NULL,
  `DateUpdated` datetime DEFAULT NULL,
  `InsertIPAddress` varchar(39) COLLATE utf8_unicode_ci DEFAULT NULL,
  `UpdateIPAddress` varchar(39) COLLATE utf8_unicode_ci DEFAULT NULL,
  `DateLastComment` datetime DEFAULT NULL,
  `LastCommentUserID` int(11) DEFAULT NULL,
  `Score` float DEFAULT NULL,
  `Attributes` text COLLATE utf8_unicode_ci,
  `RegardingID` int(11) DEFAULT 0,
  PRIMARY KEY (`DiscussionID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

Not sure if it have any side-effects to this modification.

jixunmoe commented 10 years ago

/scripts throws error because there aren't enough site.

# :35
dt = @by_sites[i]['display_text'] # @by_sites[i] is nil

That's it, really.

JasonBarnabe commented 10 years ago

I'm going to suggest doing what @Oreolek did and just run db/structure.sql. That way, you get all the Vanilla tables too.

@JixunMoe - I'll put in a fix for that. Of course I haven't had that scenario in a while :)