This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PATH | |
remote: . | |
specs: | |
solidus (2.3.0.alpha) | |
solidus_api (= 2.3.0.alpha) | |
solidus_backend (= 2.3.0.alpha) | |
solidus_core (= 2.3.0.alpha) | |
solidus_frontend (= 2.3.0.alpha) | |
solidus_sample (= 2.3.0.alpha) | |
solidus_api (2.3.0.alpha) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rake build # Build lani-0.0.1.gem into the pkg directory | |
rake install # Build and install lani-0.0.1.gem into system gems | |
rake racc:clean # It regenerates the parser.rb file | |
rake release # Create tag v0.0.1 and build and push lani-0.0.1.gem t... | |
rake rexical:clean # It regenerates the lexer.rb file | |
rake test # Run RSpec code examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/gem_tasks" | |
require 'rspec/core/rake_task' | |
RSpec::Core::RakeTask.new(:test) | |
namespace :rexical do | |
task :clean do | |
`rm lib/lani/parser/lexer.rb` | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/gem_tasks" | |
task :clean do | |
`rm lib/lani/parser/lexer.rb` | |
end | |
task :regenerate do | |
has_rexical = `gem which rexical` | |
if has_rexical |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe Lani::Parser, '#parse' do | |
def parse(tokens) | |
Lani::Parser.new.parse(tokens) | |
end | |
it 'tests for addition' do | |
expect(parse("2 + 2")).to eq([ | |
4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Lani::Parser | |
macro | |
BLANK [\ \t]+ | |
rule | |
BLANK # no action | |
\d+ { [:INTEGER, text.to_i] } | |
\+ { [:ADD, text] } | |
inner | |
# here we put any ruby code we want to extend our lexer with. | |
# for example, our own tokenize method. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test "should destroy resource if user is admin" do | |
#given user is admin | |
u = User.create(:name => "nicole", :email => "nicole@me.com", :admin => true) | |
resource = Resource.create!(:id => "1", :title => "hi", :link => "http://hallo.com", :summary => "hi") | |
#when they click 'destroy resource' | |
delete :destroy, id: @resource.id | |
#then they destroy the resource | |
assert resource.link == nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ChangeColumn < ActiveRecord::Migration | |
def change | |
def up | |
change_column :resources, :summary, :text | |
end | |
def down | |
change_column :resources, :summary, :string | |
end | |
end |