<commit_before># Hive Mind

## Device Engines

For a device called 'mydevice' create a device engine with:

```
rails plugin new hive_mind_mydevice --full --dummy-path=spec/dummy
cd hive_mind_mydevice
```

**Optional:** To use rspec for unit tests see the section below.

Ensure that the tables created for the engine are correctly namespaced by
editing `lib/hive\_mind\_mydevice/engine.rb`:

```
module HiveMindMydevice
  class Engine < ::Rails::Engine
    isolate_namespace HiveMindMydevice
  end
end
```

Create a new model `Plugin` with relevant attributes:

```
rails generate model plugin <attributes>
```

Modify the `app/model/hive\_mind\_mydevice/plugin.rb` model:

```
module HiveMindMydevice
  class Plugin < ActiveRecord::Base

    has_one :device, as: :plugin

    def name
      # Method for creating the devices name
      # Required
    end

    def self.plugin_params params
      # Return valid parameters from the input list. For example,
      params.permit(:attribute_one, attribute_two)
    end
  end
end
```

### Using rspec to with engines

To use rspec for unit tests add `--skip-test-unit` to the
`rails plugin new` command so that it is:

```
rails plugin new hive_mind_mydevice --full --dummy-path=spec/dummy --skip-test-unit
```

Then add the following line to the file `hive\_mind\_mydevice.gemspec`:

```
s.add_development_dependency 'rspec-rails'
```

Edit the `lib/hive\_mind\_mydevice/engine.rb` file to include rspec:

```
module HiveMindMydevice
  class Engine < ::Rails::Engine
    config.generators do |g|
      g.test_framework :rspec
    end
  end
end
```

Set up rspec with:

```
bundle install
rails generate rails:install
```

Finally, edit the `spec/rails\_helper.rb` file to find the environment for the
dummy Rails:

```
require File.expand_path('../dummy/config/environment', __FILE__)
```

## License

Hive Mind is available to everyone under the terms of the MIT open source licence.
Take a look at the LICENSE file in the code.

Copyright (c) 2015 BBC<commit_msg>Remove unnecessary escape characters<commit_after># Hive Mind

## Device Engines

For a device called 'mydevice' create a device engine with:

```
rails plugin new hive_mind_mydevice --full --dummy-path=spec/dummy
cd hive_mind_mydevice
```

**Optional:** To use rspec for unit tests see the section below.

Ensure that the tables created for the engine are correctly namespaced by
editing `lib/hive_mind_mydevice/engine.rb`:

```
module HiveMindMydevice
  class Engine < ::Rails::Engine
    isolate_namespace HiveMindMydevice
  end
end
```

Create a new model `Plugin` with relevant attributes:

```
rails generate model plugin <attributes>
```

Modify the `app/model/hive_mind_mydevice/plugin.rb` model:

```
module HiveMindMydevice
  class Plugin < ActiveRecord::Base

    has_one :device, as: :plugin

    def name
      # Method for creating the devices name
      # Required
    end

    def self.plugin_params params
      # Return valid parameters from the input list. For example,
      params.permit(:attribute_one, attribute_two)
    end
  end
end
```

### Using rspec to with engines

To use rspec for unit tests add `--skip-test-unit` to the
`rails plugin new` command so that it is:

```
rails plugin new hive_mind_mydevice --full --dummy-path=spec/dummy --skip-test-unit
```

Then add the following line to the file `hive_mind_mydevice.gemspec`:

```
s.add_development_dependency 'rspec-rails'
```

Edit the `lib/hive_mind_mydevice/engine.rb` file to include rspec:

```
module HiveMindMydevice
  class Engine < ::Rails::Engine
    config.generators do |g|
      g.test_framework :rspec
    end
  end
end
```

Set up rspec with:

```
bundle install
rails generate rails:install
```

Finally, edit the `spec/rails_helper.rb` file to find the environment for the
dummy Rails:

```
require File.expand_path('../dummy/config/environment', __FILE__)
```

## License

Hive Mind is available to everyone under the terms of the MIT open source licence.
Take a look at the LICENSE file in the code.

Copyright (c) 2015 BBC
{'fraction_non_alphanumeric': 0.0957920792079208, 'fraction_numerical': 0.0019801980198019802, 'mean_word_length': 3.9461444308445532, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '6971753', 'n_tokens_mistral': 1316, 'n_tokens_neox': 1225, 'n_words': 454}