<commit_before># Sitespec
Generate static site from your rack application & test files.

* Provides the same way to create both dynamic & static website
* Generates static website from your existing dynamic website
* Sitespec can be executable specification, good documentation, and well-tested implementation

## Usage
### Add sitespec into your Gemfile
```rb
# Gemfile
gem "sitespec"
```

### Require sitespec/rspec in your specs
```rb
# spec/spec_helper.rb
require "sitespec/rspec"
```

### Write request-specs with `:sitespec` metadata
Note: [rack/test](https://github.com/brynary/rack-test) is automatically enabled
in the example groups that have `:sitespec`.

```rb
# spec/site_spec.rb
describe "Sitespec" do
  let(:app) do
    MyRackApp
  end

  %w[
    /2000/01/01/hello.html
    /2000/01/02/world.html
    /feed.xml
    /images/favicon.ico
    /index.html
    /stylesheets/all.css
  ].each do |path|
    describe "GET #{path}", :sitespec do
      it "returns 200" do
        expect(get(path).status).to eq 200
      end
    end
  end
end
```

### Run rspec to build static files
Note: only successful examples generate static files.

```
$ bundle exec rspec

Example application
  GET /2000-01-01-hello.html
    returns 200
  GET /index.html
    returns 200
  GET /stylesheets/all.css
    returns 200

Finished in 0.08302 seconds (files took 0.79161 seconds to load)
3 examples, 0 failures
```

## Configuration
- `Sitespec.configuration.build_path` - Where to locate files (default: `"build"`)
- `Sitespec.configuration.enabled` - Flag to enable sitespec (default: `true`)

## Advanced topics<commit_msg>Number usage sections to know it's steps<commit_after># Sitespec
Generate static site from your rack application & test files.

* Provides the same way to create both dynamic & static website
* Generates static website from your existing dynamic website
* Sitespec can be executable specification, good documentation, and well-tested implementation

## Usage
### 1. Add sitespec into your Gemfile
```rb
# Gemfile
gem "sitespec"
```

### 2. Require sitespec/rspec in your specs
```rb
# spec/spec_helper.rb
require "sitespec/rspec"
```

### 3. Write request-specs with `:sitespec` metadata
Note: [rack/test](https://github.com/brynary/rack-test) is automatically enabled
in the example groups that have `:sitespec`.

```rb
# spec/site_spec.rb
describe "Sitespec" do
  let(:app) do
    MyRackApp
  end

  %w[
    /2000/01/01/hello.html
    /2000/01/02/world.html
    /feed.xml
    /images/favicon.ico
    /index.html
    /stylesheets/all.css
  ].each do |path|
    describe "GET #{path}", :sitespec do
      it "returns 200" do
        expect(get(path).status).to eq 200
      end
    end
  end
end
```

### 4. Run rspec to build static files
Note: only successful examples generate static files.

```
$ bundle exec rspec

Example application
  GET /2000-01-01-hello.html
    returns 200
  GET /index.html
    returns 200
  GET /stylesheets/all.css
    returns 200

Finished in 0.08302 seconds (files took 0.79161 seconds to load)
3 examples, 0 failures
```

## Configuration
- `Sitespec.configuration.build_path` - Where to locate files (default: `"build"`)
- `Sitespec.configuration.enabled` - Flag to enable sitespec (default: `true`)

## Advanced topics
{'fraction_non_alphanumeric': 0.10981951667176507, 'fraction_numerical': 0.0336494340776996, 'mean_word_length': 3.5479833101529903, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1480045', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1001, 'n_words': 351}