Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.sass-cache
testrepo/
chromedriver.log
chromedriver.log
config.yml
2 changes: 2 additions & 0 deletions config.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
repo_path: ~/Code/my-project
branch: issues
32 changes: 31 additions & 1 deletion lib/gaskit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,44 @@ def self.root
@root ||= Pathname(File.expand_path('../..', __FILE__))
end

def self.repo_path
@root_path ||= root.to_s
end

def self.repo_path= path
@root_path = File.expand_path(path)
end

def self.env
@env ||= ActiveSupport::StringInquirer.new(ENV['RACK_ENV'] || 'development')
end

def self.repo
@repo ||= env.test? ? Grit::Repo.init(root.join('testrepo').to_s) : Grit::Repo.new(root.to_s)
@repo ||= env.test? ? Grit::Repo.init(Pathname(repo_path).join('testrepo').to_s) : Grit::Repo.new(repo_path.to_s)
end

def self.branch
@branch ||= 'gaskit'
end

def self.load_config!
file = File.expand_path('../../config.yml', __FILE__)
return false unless File.exist? file

require 'yaml'
@config = YAML.load_file(file)
@config.each_pair do |key, value|
Gaskit.public_send "#{key}=", value
end
end

class << self
attr_writer :root_path, :branch

end
end

Gaskit.load_config!

require 'gaskit/story'
require 'gaskit/user'
2 changes: 1 addition & 1 deletion lib/gaskit/story.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Story
include Toy::Store
self.include_root_in_json = false

store :git, Gaskit.repo, :branch => 'gaskit', :path => 'stories'
store :git, Gaskit.repo, :branch => Gaskit.branch, :path => 'stories'

attribute :description, String
attribute :type, String, :default => 'feature'
Expand Down
2 changes: 1 addition & 1 deletion lib/gaskit/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def initialize(attrs = {})
end

def self.adapter
Adapter[:git].new(Gaskit.repo, :branch => 'gaskit')
Adapter[:git].new(Gaskit.repo, :branch => Gaskit.branch)
end

def self.all
Expand Down