bodega-shopify 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a9a57c9aec549e887c631c76407c1d95d0321bb3
4
+ data.tar.gz: ca4041319ed4862e1c37c45e56d2874e763dc7bb
5
+ SHA512:
6
+ metadata.gz: b7f66a21d96f135f9abf9d3b045c2837fafe62948caa5fc23fd514883b107c3b876ceca079dac34bab1c4e85eec875b11ac1f7f81c96a691cc000ff4e60c088b
7
+ data.tar.gz: bffb484c9a5b538ecb676b316c35e3933e5d01209bd89d7842bb0e9971ac9db4f277f88edd7339222e0070e6d63818692e0876d2d8ad62d27069b04e7f08eb7b
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ /assets
16
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in stencil.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Michael Dijkstra
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,55 @@
1
+ # Bodega — A Shopify Workflow Gem
2
+
3
+ Bodega makes it easier for developers and designers to develop themes and deploy stores on Shopify.
4
+
5
+ ## Benefits
6
+
7
+ + Use your text editor of choice to edit theme files
8
+ + Automatically keep theme files in sync
9
+ + Manage multiple shops and themes at once
10
+ + Easily switch between multiple themes/stores
11
+
12
+ ## Features
13
+
14
+ 1. Sync local theme files with live Shopify stores using the [Shopify Theme gem](https://github.com/Shopify/shopify_theme/)
15
+ 2. Deploy your theme to development and production stores
16
+
17
+ ## Planned Features
18
+
19
+ + Copy products, collections, pages, blogs and articles between Shopify stores
20
+
21
+ ## Installation
22
+
23
+ ```
24
+ gem install bodega-shopify
25
+ ```
26
+
27
+ ## The Bodega Workflow
28
+
29
+ 1. `cd` into your theme folder
30
+ 2. Run `$ bodega bootstrap`
31
+ 4. Setup your bodega config file ([See instructions](https://github.com/XXIX/bodega/wiki/Theme-and-Store-Requirements))
32
+ 5. Replace your development store with your theme by running: `$ bodega replace_theme`
33
+ 6. Watch and sync your theme folder by running: `$ bodega watch`
34
+ 7. Edit your theme files
35
+ 8. Sync updates with production by running: `$ bodega sync_theme production`
36
+
37
+ ## Building Locally
38
+
39
+ 1. Clone it
40
+ 2. Run `bundle`
41
+ 3. Run `rake install`
42
+
43
+ ## Publishing
44
+
45
+ 1. Update the version number in `lib/bodega-shopify/version.rb`
46
+ 2. Run `gem build bodega-shopify.gemspec`
47
+ 3. Run `gem push bodega-shopify-0.0.X.gem`
48
+
49
+ ## Contributing
50
+
51
+ 1. Fork it ( https://github.com/xxix/bodega-gem/fork )
52
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
53
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
54
+ 4. Push to the branch (`git push origin my-new-feature`)
55
+ 5. Create a new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bodega-shopify'
4
+
5
+ def help
6
+ %Q(
7
+ Usage: bodega [COMMAND]
8
+
9
+ Commands:
10
+ bootstrap, bootstrap [FOLDER] Setup folder with default files
11
+ sync_theme [ENVIRONMENT] Push files modified since last sync to Shopify
12
+ replace_theme [ENVIRONMENT] Replace theme on Shopify
13
+ watch [ENVIRONMENT] Watch for changes and push to Shopify
14
+ help Prints this help document
15
+ version Prints the bodega shopify gem version
16
+
17
+ Options:
18
+ -h, --help Prints this help document
19
+ -v, --version Prints the bodega shopify gem version
20
+
21
+ See https://github.com/xxix/bodega-shopify-gem for additional documentation.
22
+ )
23
+ end
24
+
25
+ def bootstrap folder=nil
26
+ builder = BodegaShopify::Builder.new
27
+ builder.setup folder
28
+ end
29
+
30
+ def replace_theme environment='development'
31
+ config = BodegaShopify::Configuration.new environment: environment
32
+ syncer = BodegaShopify::Syncer.new(config: config)
33
+ syncer.replace!
34
+ end
35
+
36
+ def sync_theme environment='development'
37
+ config = BodegaShopify::Configuration.new environment: environment
38
+ syncer = BodegaShopify::Syncer.new(config: config)
39
+ syncer.sync!
40
+ end
41
+
42
+ def watch environment='development'
43
+ config = BodegaShopify::Configuration.new environment: environment
44
+ syncer = BodegaShopify::Syncer.new(config: config)
45
+ syncer.watch
46
+ end
47
+
48
+ case ARGV[0]
49
+ when '-v', '--version', 'version'
50
+ puts BodegaShopify::VERSION
51
+ when '-h', '--help', 'help'
52
+ puts help
53
+ when 'bootstrap'
54
+ bootstrap ARGV[1]
55
+ when 'replace_theme'
56
+ replace_theme ARGV[1]
57
+ when 'sync_theme'
58
+ sync_theme ARGV[1]
59
+ when 'watch'
60
+ watch ARGV[1]
61
+ else
62
+ puts "`#{ARGV[0]}` command not found.\n"
63
+ puts help
64
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bodega-shopify/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bodega-shopify"
8
+ spec.version = BodegaShopify::VERSION
9
+ spec.authors = ["Michael Dijkstra"]
10
+ spec.email = ["michael@xxix.co"]
11
+ spec.summary = "A Shopify workflow gem"
12
+ spec.description = "Bodega makes it easier for developers and designers to develop themes and deploy stores on Shopify."
13
+ spec.homepage = "https://github.com/xxix/bodega-gem"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = ['bodega']
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency "shopify_theme", '~> 0.0'
22
+ spec.add_runtime_dependency "shopify_api", '~> 3.2'
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.7"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.3"
27
+ end
@@ -0,0 +1,9 @@
1
+ libdir = File.dirname(__FILE__)
2
+ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
3
+
4
+ require "bodega-shopify/version"
5
+ require "bodega-shopify/constants"
6
+ require "bodega-shopify/configuration"
7
+ require "bodega-shopify/logger"
8
+ require "bodega-shopify/builder"
9
+ require "bodega-shopify/syncer"
@@ -0,0 +1,47 @@
1
+ require 'yaml'
2
+
3
+ module BodegaShopify
4
+ class Builder
5
+ attr_accessor :folder
6
+
7
+ def initialize
8
+ end
9
+
10
+ def setup folder=nil
11
+ self.folder = "#{folder.chomp("/").reverse.chomp("/").reverse}/" if folder
12
+ setup_directory folder_path
13
+ setup_config
14
+ end
15
+
16
+ def folder_path
17
+ "#{ROOT}/#{folder}"
18
+ end
19
+
20
+ private
21
+
22
+ def src_directory
23
+ spec = Gem::Specification.find_by_name("bodega-shopify")
24
+ "#{spec.gem_dir}/src/"
25
+ end
26
+
27
+ def create_src_file source, destination
28
+ unless File.exists?(destination)
29
+ contents = File.open("#{src_directory}#{source}").read
30
+ File.open(destination, 'w') { |file| file.write(contents) }
31
+ BodegaShopify.logger.info "created #{destination}"
32
+ end
33
+ end
34
+
35
+ def setup_directory path
36
+ unless File.exists?(path)
37
+ Dir.mkdir(path)
38
+ SmallVictories.logger.info "created #{path}"
39
+ end
40
+ end
41
+
42
+ def setup_config
43
+ create_src_file('bodega.yml', File.join(folder_path, '_bodega.yml'))
44
+ create_src_file('config.yml', File.join(folder_path, 'config.yml'))
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,54 @@
1
+ require 'yaml'
2
+
3
+ module BodegaShopify
4
+ class Configuration
5
+ attr_accessor :shopify_config, :environment, :config
6
+
7
+ def initialize params={}
8
+ self.environment = (params[:environment] || DEFAULT_ENVIRONMENT).to_sym
9
+ self.config = File.exists?(CONFIG_FILE) ? YAML.load(File.read(CONFIG_FILE)) || {} : {}
10
+ self.shopify_config = File.exists?(SHOPIFY_CONFIG_FILE) ? YAML.load(File.read(SHOPIFY_CONFIG_FILE)) || {} : {}
11
+ BodegaShopify.logger.info "Configured #{environment} store #{store}"
12
+ save_shopify_config
13
+ end
14
+
15
+ def config_file key
16
+ config[key.to_s].to_s.chomp("/").reverse.chomp("/").reverse if config.has_key?(key.to_s)
17
+ end
18
+
19
+ def api_key
20
+ config[environment][:api_key]
21
+ end
22
+
23
+ def password
24
+ config[environment][:password]
25
+ end
26
+
27
+ def store
28
+ config[environment][:store]
29
+ end
30
+
31
+ def ignore_files
32
+ (shopify_config[:ignore_files] || []).compact.map { |r| Regexp.new(r) }
33
+ end
34
+
35
+ def last_sync_at
36
+ config[environment][:last_sync_at] ||= Time.parse('2000-01-01 00:00:00')
37
+ end
38
+
39
+ def last_sync_at= last_sync_at
40
+ config[environment][:last_sync_at] = last_sync_at
41
+ end
42
+
43
+ def save
44
+ File.open(CONFIG_FILE, 'w') {|f| f.write config.to_yaml }
45
+ end
46
+
47
+ def save_shopify_config
48
+ shopify_config[:api_key] = api_key
49
+ shopify_config[:password] = password
50
+ shopify_config[:store] = store
51
+ File.open(SHOPIFY_CONFIG_FILE, 'w') {|f| f.write shopify_config.to_yaml }
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,6 @@
1
+ module BodegaShopify
2
+ CONFIG_FILE = '_bodega.yml'
3
+ SHOPIFY_CONFIG_FILE = 'config.yml'
4
+ DEFAULT_ENVIRONMENT = :development
5
+ ROOT = Dir.pwd
6
+ end
@@ -0,0 +1,25 @@
1
+ require 'logger'
2
+
3
+ module BodegaShopify
4
+ class << self
5
+ attr_writer :logger
6
+
7
+ def logger
8
+ @logger ||= Logger.new($stdout).tap do |log|
9
+ log.progname = self.name
10
+ log.formatter = proc do |severity, datetime, progname, msg|
11
+ string = "Bodega: "
12
+ case severity
13
+ when 'INFO'
14
+ string.concat("👍 ")
15
+ when 'WARN'
16
+ string.concat("⚠️ ")
17
+ when 'ERROR'
18
+ string.concat("🔥 ")
19
+ end
20
+ string.concat("#{msg}\n")
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,43 @@
1
+ require 'shopify_theme'
2
+ require 'shopify_theme/cli'
3
+
4
+ module BodegaShopify
5
+ class Syncer
6
+ attr_accessor :config
7
+
8
+ def initialize params={}
9
+ self.config = params[:config]
10
+ end
11
+
12
+ def cli
13
+ @cli ||= ShopifyTheme::Cli.new
14
+ end
15
+
16
+ def files
17
+ Dir["**/*"]
18
+ end
19
+
20
+ def modified_files
21
+ files.select{ |file| !(config.ignore_files.any? { |ignore| file =~ /^#{ignore}/ } || File.directory?(file) || File.mtime(file).to_i < config.last_sync_at.to_time.to_i) }
22
+ end
23
+
24
+ def replace!
25
+ cli.replace
26
+ cli.upload 'config/settings_data.json'
27
+ end
28
+
29
+ def save_config
30
+ config.last_sync_at = Time.now
31
+ config.save
32
+ end
33
+
34
+ def sync!
35
+ modified_files.each { |file| cli.upload file }
36
+ save_config
37
+ end
38
+
39
+ def watch
40
+ cli.watch
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,3 @@
1
+ module BodegaShopify
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe BodegaShopify do
4
+ let(:builder) { BodegaShopify::Builder.new }
5
+
6
+ context 'with folder' do
7
+ it 'sets up default files' do
8
+ builder.setup 'spec/fixtures/new'
9
+ expect(File.exists?('fixtures/new/_bodega.yml')).to eq true
10
+ expect(File.exists?('fixtures/new/config.yml')).to eq true
11
+ end
12
+
13
+ after do
14
+ %w(fixtures/new/_bodega.yml fixtures/new/config.yml).each { |path| clean_file(path) }
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,65 @@
1
+ require 'spec_helper'
2
+
3
+ describe BodegaShopify do
4
+ let(:configuration) { BodegaShopify::Configuration.new }
5
+
6
+ context 'with config file' do
7
+ before do
8
+ FileUtils.cp('fixtures/_bodega.yml', './')
9
+ end
10
+
11
+ it 'defaults to development environment' do
12
+ expect(configuration.environment).to eq :development
13
+ end
14
+
15
+ it 'loads development api key' do
16
+ expect(configuration.api_key).to eq 'dev-api-key'
17
+ end
18
+
19
+ it 'loads development password' do
20
+ expect(configuration.password).to eq 'dev-password'
21
+ end
22
+
23
+ it 'loads development store' do
24
+ expect(configuration.store).to eq 'dev-store'
25
+ end
26
+
27
+ context 'with shopify config file' do
28
+ before do
29
+ FileUtils.cp('fixtures/config.yml', './')
30
+ end
31
+
32
+ it 'sets api key' do
33
+ expect(configuration.shopify_config[:api_key]).to eq configuration.api_key
34
+ end
35
+
36
+ it 'sets password' do
37
+ expect(configuration.shopify_config[:password]).to eq configuration.password
38
+ end
39
+
40
+ it 'sets store' do
41
+ expect(configuration.shopify_config[:store]).to eq configuration.store
42
+ end
43
+ end
44
+
45
+ context 'for production' do
46
+ let(:production_configuration) { BodegaShopify::Configuration.new environment: :production }
47
+
48
+ it 'defaults to development environment' do
49
+ expect(production_configuration.environment).to eq :production
50
+ end
51
+
52
+ it 'loads production api key' do
53
+ expect(production_configuration.api_key).to eq 'prod-api-key'
54
+ end
55
+
56
+ it 'loads production password' do
57
+ expect(production_configuration.password).to eq 'prod-password'
58
+ end
59
+
60
+ it 'loads production store' do
61
+ expect(production_configuration.store).to eq 'prod-store'
62
+ end
63
+ end
64
+ end
65
+ end
File without changes
@@ -0,0 +1,9 @@
1
+ ---
2
+ :production:
3
+ :api_key: prod-api-key
4
+ :password: prod-password
5
+ :store: prod-store
6
+ :development:
7
+ :api_key: dev-api-key
8
+ :password: dev-password
9
+ :store: dev-store
@@ -0,0 +1,6 @@
1
+ ---
2
+ :ignore_files:
3
+ - config/settings_data.json
4
+ - README.md
5
+ - bodega.yml
6
+ - config.yml
@@ -0,0 +1,18 @@
1
+ require 'bundler/setup'
2
+ Bundler.setup
3
+
4
+ require 'bodega-shopify'
5
+
6
+ RSpec.configure do |config|
7
+ config.before do
8
+ FileUtils.cd File.dirname(__FILE__)
9
+ end
10
+
11
+ config.after do
12
+ %w(./_bodega.yml ./config.yml).each { |path| clean_file(path) }
13
+ end
14
+ end
15
+
16
+ def clean_file path
17
+ FileUtils.rm(path) if File.exists?(path)
18
+ end
@@ -0,0 +1,9 @@
1
+ ---
2
+ :production:
3
+ :api_key:
4
+ :password:
5
+ :store:
6
+ :development:
7
+ :api_key:
8
+ :password:
9
+ :store:
@@ -0,0 +1,7 @@
1
+ ---
2
+ :ignore_files:
3
+ - _/**/*
4
+ - config/settings_data.json
5
+ - README.md
6
+ - _bodega.yml
7
+ - config.yml
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bodega-shopify
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Michael Dijkstra
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: shopify_theme
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: shopify_api
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.3'
83
+ description: Bodega makes it easier for developers and designers to develop themes
84
+ and deploy stores on Shopify.
85
+ email:
86
+ - michael@xxix.co
87
+ executables:
88
+ - bodega
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - ".gitignore"
93
+ - Gemfile
94
+ - Gemfile.lock
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - bin/bodega
99
+ - bodega-shopify.gemspec
100
+ - lib/bodega-shopify.rb
101
+ - lib/bodega-shopify/builder.rb
102
+ - lib/bodega-shopify/configuration.rb
103
+ - lib/bodega-shopify/constants.rb
104
+ - lib/bodega-shopify/logger.rb
105
+ - lib/bodega-shopify/syncer.rb
106
+ - lib/bodega-shopify/version.rb
107
+ - spec/builder_spec.rb
108
+ - spec/configuration_spec.rb
109
+ - spec/fixtures/.gitkeep
110
+ - spec/fixtures/_bodega.yml
111
+ - spec/fixtures/config.yml
112
+ - spec/spec_helper.rb
113
+ - src/bodega.yml
114
+ - src/config.yml
115
+ homepage: https://github.com/xxix/bodega-gem
116
+ licenses:
117
+ - MIT
118
+ metadata: {}
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 2.4.5
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: A Shopify workflow gem
139
+ test_files:
140
+ - spec/builder_spec.rb
141
+ - spec/configuration_spec.rb
142
+ - spec/fixtures/.gitkeep
143
+ - spec/fixtures/_bodega.yml
144
+ - spec/fixtures/config.yml
145
+ - spec/spec_helper.rb