bicycle 0.1.1 → 0.3.0

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: 34e1044dedfece0a7e24f503286c9b4009bb922b
4
+ data.tar.gz: 7b7891eecdd547e8dc07c0713cfca1ae117dcb75
5
+ SHA512:
6
+ metadata.gz: 2755eb67f65b683b6f70225e56a4e44109713ea612c84b30f1f24eedca0aa44097c677b4bbe10e3680640754085dcacb40427d8f2dd6926e2dc046859700ed9f
7
+ data.tar.gz: 3c4ce74e80e316ee6990442b33fc1f53e46fedf41f0cc9c4213098c5b725b383017050570b9072c4a5614cc6fc44714577ce56d68604a1d758362642149b5a94
data/Gemfile CHANGED
@@ -6,8 +6,9 @@ source "http://rubygems.org"
6
6
  # Add dependencies to develop your gem here.
7
7
  # Include everything needed to run rake, tests, features, etc.
8
8
  group :development do
9
- gem "minitest", ">= 0"
10
- gem "yard", "~> 0.6.0"
11
9
  gem "bundler"
12
- gem "jeweler", "~> 1.6.4"
10
+ gem "jeweler"
11
+ gem "minitest"
12
+ gem "turn"
13
+ gem "yard"
13
14
  end
@@ -1,20 +1,71 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- git (1.2.5)
5
- jeweler (1.6.4)
6
- bundler (~> 1.0)
4
+ addressable (2.5.1)
5
+ public_suffix (~> 2.0, >= 2.0.2)
6
+ ansi (1.5.0)
7
+ builder (3.2.3)
8
+ descendants_tracker (0.0.4)
9
+ thread_safe (~> 0.3, >= 0.3.1)
10
+ faraday (0.9.2)
11
+ multipart-post (>= 1.2, < 3)
12
+ git (1.3.0)
13
+ github_api (0.11.3)
14
+ addressable (~> 2.3)
15
+ descendants_tracker (~> 0.0.1)
16
+ faraday (~> 0.8, < 0.10)
17
+ hashie (>= 1.2)
18
+ multi_json (>= 1.7.5, < 2.0)
19
+ nokogiri (~> 1.6.0)
20
+ oauth2
21
+ hashie (3.5.5)
22
+ highline (1.7.8)
23
+ jeweler (2.3.3)
24
+ builder
25
+ bundler (>= 1.0)
7
26
  git (>= 1.2.5)
27
+ github_api (~> 0.11.0)
28
+ highline (>= 1.6.15)
29
+ nokogiri (>= 1.5.10)
30
+ psych (~> 2.2)
8
31
  rake
9
- minitest (3.0.1)
10
- rake (0.9.2.2)
11
- yard (0.6.8)
32
+ rdoc
33
+ semver2
34
+ jwt (1.5.6)
35
+ mini_portile2 (2.1.0)
36
+ minitest (4.7.5)
37
+ multi_json (1.12.1)
38
+ multi_xml (0.6.0)
39
+ multipart-post (2.0.0)
40
+ nokogiri (1.6.8.1)
41
+ mini_portile2 (~> 2.1.0)
42
+ oauth2 (1.3.1)
43
+ faraday (>= 0.8, < 0.12)
44
+ jwt (~> 1.0)
45
+ multi_json (~> 1.3)
46
+ multi_xml (~> 0.5)
47
+ rack (>= 1.2, < 3)
48
+ psych (2.2.4)
49
+ public_suffix (2.0.5)
50
+ rack (2.0.1)
51
+ rake (12.0.0)
52
+ rdoc (5.1.0)
53
+ semver2 (3.4.2)
54
+ thread_safe (0.3.6)
55
+ turn (0.9.7)
56
+ ansi
57
+ minitest (~> 4)
58
+ yard (0.9.8)
12
59
 
13
60
  PLATFORMS
14
61
  ruby
15
62
 
16
63
  DEPENDENCIES
17
64
  bundler
18
- jeweler (~> 1.6.4)
65
+ jeweler
19
66
  minitest
20
- yard (~> 0.6.0)
67
+ turn
68
+ yard
69
+
70
+ BUNDLED WITH
71
+ 1.14.6
data/README.md CHANGED
@@ -1,10 +1,13 @@
1
1
  bicycle
2
- =======
2
+ -------
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/bicycle.svg)](http://badge.fury.io/rb/bicycle)
5
+ [![Build Status](https://travis-ci.org/sleepingstu/bicycle.svg?branch=master)](https://travis-ci.org/sleepingstu/bicycle)
3
6
 
4
7
  A convenience gem for cycling through a set of values, ported from the ['cycle'](http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#method-i-cycle) functionality found in Rails. It is independent of which framework you use so will run in Sinatra, Padrino or straight up Ruby itself.
5
8
 
6
- Installation:
7
- -------------
9
+ Installation
10
+ ============
8
11
 
9
12
  ```
10
13
  gem install bicycle
@@ -17,7 +20,7 @@ gem 'bicycle'
17
20
  ```
18
21
 
19
22
  Usage
20
- -----
23
+ =====
21
24
 
22
25
  Add the following to your app.rb file:
23
26
 
@@ -72,7 +75,7 @@ For example:
72
75
  ```
73
76
 
74
77
  Contributing to bicycle
75
- -----------------------
78
+ =======================
76
79
 
77
80
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
78
81
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
@@ -83,8 +86,8 @@ Contributing to bicycle
83
86
  * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
84
87
 
85
88
  Copyright
86
- ---------
89
+ =========
87
90
 
88
- Copyright (c) 2012 [Stuart Chinery](http://www.headlondon.com/who-we-are#stuart-chinery) and [Dave Hrycyszyn](http://www.headlondon.com/who-we-are#david-hrycyszyn), [headlondon.com](http://www.headlondon.com). See LICENSE.txt for
89
- further details.
91
+ Copyright (c) 2012 [Stuart Chinery](http://www.headlondon.com/who-we-are#stuart-chinery) and [Dave Hrycyszyn](http://www.headlondon.com/who-we-are#david-hrycyszyn) - [headlondon.com](http://www.headlondon.com).
90
92
 
93
+ See LICENSE.txt for further details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.3.0
@@ -3,9 +3,10 @@
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
+
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "bicycle"
8
- s.version = "0.1.1"
9
+ s.version = File.read("VERSION").split("\n").first
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
12
  s.authors = ["Stuart Chinery", "Dave Hrycyszyn"]
@@ -39,21 +40,21 @@ Gem::Specification.new do |s|
39
40
  s.specification_version = 3
40
41
 
41
42
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
42
- s.add_development_dependency(%q<minitest>, [">= 0"])
43
- s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
44
- s.add_development_dependency(%q<bundler>, [">= 0"])
45
- s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
43
+ s.add_development_dependency(%q<minitest>, ["~> 0"])
44
+ s.add_development_dependency(%q<yard>, ["~> 0.6"])
45
+ s.add_development_dependency(%q<bundler>, ["~> 0"])
46
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6"])
46
47
  else
47
- s.add_dependency(%q<minitest>, [">= 0"])
48
- s.add_dependency(%q<yard>, ["~> 0.6.0"])
49
- s.add_dependency(%q<bundler>, [">= 0"])
50
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
48
+ s.add_dependency(%q<minitest>, ["~> 0"])
49
+ s.add_dependency(%q<yard>, ["~> 0.6"])
50
+ s.add_dependency(%q<bundler>, ["~> 0"])
51
+ s.add_dependency(%q<jeweler>, ["~> 1.6"])
51
52
  end
52
53
  else
53
- s.add_dependency(%q<minitest>, [">= 0"])
54
- s.add_dependency(%q<yard>, ["~> 0.6.0"])
55
- s.add_dependency(%q<bundler>, [">= 0"])
56
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
54
+ s.add_dependency(%q<minitest>, ["~> 0"])
55
+ s.add_dependency(%q<yard>, ["~> 0.6"])
56
+ s.add_dependency(%q<bundler>, ["~> 0"])
57
+ s.add_dependency(%q<jeweler>, ["~> 1.6"])
57
58
  end
58
59
  end
59
60
 
@@ -1,96 +1,7 @@
1
- module Bicycle
2
-
3
- # Creates a Cycle object whose _to_s_ method cycles through elements of an
4
- # array every time it is called. This can be used for example, to alternate
5
- # classes for table rows. You can use named cycles to allow nesting in loops.
6
- # Passing a Hash as the last parameter with a <tt>:name</tt> key will create a
7
- # named cycle. The default name for a cycle without a +:name+ key is
8
- # <tt>"default"</tt>. You can manually reset a cycle by calling reset_cycle
9
- # and passing the name of the cycle. The current cycle string can be obtained
10
- # anytime using the current_cycle method.
11
- #
12
- def cycle(*values)
13
- if (values.last.instance_of? Hash)
14
- params = values.pop
15
- name = params[:name]
16
- else
17
- name = "default"
18
- end
19
-
20
- cycle = get_cycle(name)
21
- unless cycle && cycle.values == values
22
- cycle = set_cycle(name, Cycle.new(values))
23
- end
24
- cycle.to_s
25
- end
26
-
27
- # Returns the current cycle string after a cycle has been started. Useful
28
- # for complex table highlighting or any other design need which requires
29
- # the current cycle string in more than one place.
30
- #
31
- def current_cycle(name = "default")
32
- cycle = get_cycle(name)
33
- cycle.current_value if cycle
34
- end
35
-
36
- # Resets a cycle so that it starts from the first element the next time
37
- # it is called. Pass in +name+ to reset a named cycle.
38
- #
39
- def reset_cycle(name = "default")
40
- cycle = get_cycle(name)
41
- cycle.reset if cycle
42
- end
43
-
44
- class Cycle #:nodoc:
45
- attr_reader :values
46
-
47
- def initialize(values)
48
- @values = values
49
- reset
50
- end
51
-
52
- def reset
53
- @index = 0
54
- end
1
+ require "bicycle/methods"
55
2
 
56
- def current_value
57
- @values[previous_index].to_s
58
- end
59
-
60
- def to_s
61
- value = @values[@index].to_s
62
- @index = next_index
63
- return value
64
- end
65
-
66
- private
67
-
68
- def next_index
69
- step_index(1)
70
- end
71
-
72
- def previous_index
73
- step_index(-1)
74
- end
75
-
76
- def step_index(n)
77
- (@index + n) % @values.size
78
- end
79
- end
80
-
81
- private
82
-
83
- # The cycle helpers need to store the cycles in a place that is
84
- # guaranteed to be reset every time a page is rendered, so it
85
- # uses an instance variable of ActionView::Base.
86
- def get_cycle(name)
87
- @_cycles = Hash.new unless defined?(@_cycles)
88
- return @_cycles[name]
89
- end
3
+ module Bicycle
90
4
 
91
- def set_cycle(name, cycle_object)
92
- @_cycles = Hash.new unless defined?(@_cycles)
93
- @_cycles[name] = cycle_object
94
- end
5
+ include Bicycle::Methods
95
6
 
96
7
  end
@@ -8,11 +8,12 @@ rescue Bundler::BundlerError => e
8
8
  exit e.status_code
9
9
  end
10
10
 
11
- require 'minitest/spec'
11
+ require 'minitest/autorun'
12
12
 
13
13
  $LOAD_PATH.unshift(File.dirname(__FILE__))
14
14
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
15
15
  require 'bicycle'
16
+ begin; require 'turn/autorun'; rescue LoadError; end
16
17
 
17
18
  class MiniTest::Unit::TestCase
18
19
 
metadata CHANGED
@@ -1,94 +1,83 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: bicycle
3
- version: !ruby/object:Gem::Version
4
- hash: 25
5
- prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Stuart Chinery
14
8
  - Dave Hrycyszyn
15
9
  autorequire:
16
10
  bindir: bin
17
11
  cert_chain: []
18
-
19
- date: 2012-06-06 00:00:00 Z
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- type: :development
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
32
- version_requirements: *id001
12
+ date: 2012-06-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
33
15
  name: minitest
34
- prerelease: false
35
- - !ruby/object:Gem::Dependency
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
36
21
  type: :development
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- none: false
39
- requirements:
40
- - - ~>
41
- - !ruby/object:Gem::Version
42
- hash: 7
43
- segments:
44
- - 0
45
- - 6
46
- - 0
47
- version: 0.6.0
48
- version_requirements: *id002
49
- name: yard
50
22
  prerelease: false
51
- - !ruby/object:Gem::Dependency
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: yard
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '0.6'
52
35
  type: :development
53
- requirement: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 0
61
- version: "0"
62
- version_requirements: *id003
63
- name: bundler
64
36
  prerelease: false
65
- - !ruby/object:Gem::Dependency
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '0.6'
42
+ - !ruby/object:Gem::Dependency
43
+ name: bundler
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
66
49
  type: :development
67
- requirement: &id004 !ruby/object:Gem::Requirement
68
- none: false
69
- requirements:
70
- - - ~>
71
- - !ruby/object:Gem::Version
72
- hash: 7
73
- segments:
74
- - 1
75
- - 6
76
- - 4
77
- version: 1.6.4
78
- version_requirements: *id004
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
79
57
  name: jeweler
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '1.6'
63
+ type: :development
80
64
  prerelease: false
81
- description: A convenience gem for cycling through a set of values, ported from the 'cycle' functionality found in Rails. It is independent of which framework you use so will run in Sinatra, Padrino or straight up Ruby itself.
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '1.6'
70
+ description: A convenience gem for cycling through a set of values, ported from the
71
+ 'cycle' functionality found in Rails. It is independent of which framework you use
72
+ so will run in Sinatra, Padrino or straight up Ruby itself.
82
73
  email: stuart.chinery@headlondon.com
83
74
  executables: []
84
-
85
75
  extensions: []
86
-
87
- extra_rdoc_files:
76
+ extra_rdoc_files:
88
77
  - LICENSE.txt
89
78
  - README.md
90
- files:
91
- - .document
79
+ files:
80
+ - ".document"
92
81
  - Gemfile
93
82
  - Gemfile.lock
94
83
  - LICENSE.txt
@@ -100,37 +89,27 @@ files:
100
89
  - test/helper.rb
101
90
  - test/test_bicycle.rb
102
91
  homepage: http://github.com/sleepingstu/bicycle
103
- licenses:
92
+ licenses:
104
93
  - MIT
94
+ metadata: {}
105
95
  post_install_message:
106
96
  rdoc_options: []
107
-
108
- require_paths:
97
+ require_paths:
109
98
  - lib
110
- required_ruby_version: !ruby/object:Gem::Requirement
111
- none: false
112
- requirements:
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
113
101
  - - ">="
114
- - !ruby/object:Gem::Version
115
- hash: 3
116
- segments:
117
- - 0
118
- version: "0"
119
- required_rubygems_version: !ruby/object:Gem::Requirement
120
- none: false
121
- requirements:
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
122
106
  - - ">="
123
- - !ruby/object:Gem::Version
124
- hash: 3
125
- segments:
126
- - 0
127
- version: "0"
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
128
109
  requirements: []
129
-
130
110
  rubyforge_project:
131
- rubygems_version: 1.8.19
111
+ rubygems_version: 2.6.8
132
112
  signing_key:
133
113
  specification_version: 3
134
114
  summary: Why walk when you can cycle
135
115
  test_files: []
136
-