gradients 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ pkg
2
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ # A sample Gemfile
2
+ source "http://rubygems.org"
3
+
4
+ gemspec
data/Rakefile CHANGED
@@ -21,6 +21,4 @@ Rake::RDocTask.new do |rd|
21
21
  rd.rdoc_dir = 'rdoc'
22
22
  end
23
23
 
24
- require 'ext/gem_rake'
25
-
26
24
  Bundler::GemHelper.install_tasks
@@ -20,17 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.rubyforge_project = 'gradients'
21
21
 
22
22
  # dependencies
23
- s.add_development_dependency 'rspec'
23
+ s.add_development_dependency 'rspec', "~> 1.3.0"
24
24
  s.add_development_dependency 'rake'
25
-
26
- if s.respond_to? :specification_version then
27
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
28
- s.specification_version = 3
29
-
30
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
31
- else
32
- end
33
- else
34
- end
35
25
  end
36
26
 
@@ -4,7 +4,7 @@ class Gradients
4
4
  def self.parse(val)
5
5
  case val
6
6
  when /^#?[0-9a-f]{6}$/i
7
- new(*val[-6, 6].map{|a|a.scan(/../).map{|b|(b.hex.to_f / 255)}}.flatten)
7
+ new(*val[-6, 6].scan(/../).map{|b|(b.hex.to_f / 255)})
8
8
  end
9
9
  end
10
10
 
@@ -1,3 +1,3 @@
1
1
  class Gradients
2
- VERSION = '0.0.1'.freeze
2
+ VERSION = '0.0.2'
3
3
  end
@@ -1,4 +1,5 @@
1
- require 'spec_helper'
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
2
3
  describe "Gradients" do
3
4
  context "should calculate a gradient of two colors" do
4
5
  before(:each) do
@@ -1,3 +1,3 @@
1
1
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- require 'rubygems'
2
+
3
3
  require 'gradients'
metadata CHANGED
@@ -1,63 +1,50 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gradients
3
- version: !ruby/object:Gem::Version
4
- hash: 29
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 0
9
- - 1
10
- version: 0.0.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Joshua Hull
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2010-07-31 00:00:00 -07:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2010-07-31 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: rspec
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70348829703140 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.3.0
33
22
  type: :development
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: rake
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70348829703140
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ requirement: &70348829701060 !ruby/object:Gem::Requirement
39
28
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
47
33
  type: :development
48
- version_requirements: *id002
49
- description: Colours! Colours! The creeping chaos fucks my mind. Generate gradients because colors are fun.
34
+ prerelease: false
35
+ version_requirements: *70348829701060
36
+ description: Colours! Colours! The creeping chaos fucks my mind. Generate gradients
37
+ because colors are fun.
50
38
  email: joshbuddy@gmail.com
51
39
  executables: []
52
-
53
40
  extensions: []
54
-
55
- extra_rdoc_files:
41
+ extra_rdoc_files:
56
42
  - README.rdoc
57
- files:
43
+ files:
44
+ - .gitignore
45
+ - Gemfile
58
46
  - README.rdoc
59
47
  - Rakefile
60
- - ext/gem_rake.rb
61
48
  - gradients.gemspec
62
49
  - lib/gradients.rb
63
50
  - lib/gradients/color.rb
@@ -65,41 +52,36 @@ files:
65
52
  - spec/gradients_spec.rb
66
53
  - spec/spec.opts
67
54
  - spec/spec_helper.rb
68
- has_rdoc: true
69
55
  homepage: http://github.com/joshbuddy/gradients
70
56
  licenses: []
71
-
72
57
  post_install_message:
73
- rdoc_options:
58
+ rdoc_options:
74
59
  - --charset=UTF-8
75
- require_paths:
60
+ require_paths:
76
61
  - lib
77
- required_ruby_version: !ruby/object:Gem::Requirement
62
+ required_ruby_version: !ruby/object:Gem::Requirement
78
63
  none: false
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- hash: 3
83
- segments:
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ segments:
84
69
  - 0
85
- version: "0"
86
- required_rubygems_version: !ruby/object:Gem::Requirement
70
+ hash: 184871271486172111
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
72
  none: false
88
- requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- hash: 3
92
- segments:
93
- - 0
94
- version: "0"
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
95
77
  requirements: []
96
-
97
78
  rubyforge_project: gradients
98
- rubygems_version: 1.3.7
79
+ rubygems_version: 1.8.15
99
80
  signing_key:
100
81
  specification_version: 3
101
- summary: Colours! Colours! The creeping chaos fucks my mind. Generate gradients because colors are fun.
102
- test_files:
82
+ summary: Colours! Colours! The creeping chaos fucks my mind. Generate gradients because
83
+ colors are fun.
84
+ test_files:
103
85
  - spec/gradients_spec.rb
104
86
  - spec/spec.opts
105
87
  - spec/spec_helper.rb
@@ -1,126 +0,0 @@
1
- module Bundler
2
- class GemHelper
3
-
4
- def self.install_tasks
5
- dir = caller.find{|c| /Rakefile:/}[/^(.*?)\/Rakefile:/, 1]
6
- GemHelper.new(dir).install
7
- end
8
-
9
- attr_reader :spec_path, :base, :name
10
-
11
- def initialize(base, name = nil)
12
- @base = base
13
- @name = name || interpolate_name
14
- @spec_path = File.join(@base, "#{@name}.gemspec")
15
- end
16
-
17
- def install
18
- desc 'Build your gem into the pkg directory'
19
- task 'build' do
20
- build_gem
21
- end
22
-
23
- desc 'Install your gem into the pkg directory'
24
- task 'install' do
25
- install_gem
26
- end
27
-
28
- desc 'Push your gem to rubygems'
29
- task 'push' do
30
- push_gem
31
- end
32
- end
33
-
34
- def build_gem
35
- file_name = nil
36
- sh("gem build #{spec_path}") {
37
- file_name = File.basename(built_gem_path)
38
- FileUtils.mkdir_p(File.join(base, 'pkg'))
39
- FileUtils.mv(built_gem_path, 'pkg')
40
- }
41
- File.join(base, 'pkg', file_name)
42
- end
43
-
44
- def install_gem
45
- built_gem_path = build_gem
46
- sh("gem install #{built_gem_path}")
47
- end
48
-
49
- def push_gem
50
- guard_clean
51
- guard_already_tagged
52
- tag_version {
53
- git_push
54
- rubygem_push(build_gem)
55
- }
56
- end
57
-
58
- protected
59
- def rubygem_push(path)
60
- sh("gem push #{path}")
61
- end
62
-
63
- def built_gem_path
64
- Dir[File.join(base, "#{name}-*.gem")].sort_by{|f| File.mtime(f)}.last
65
- end
66
-
67
- def interpolate_name
68
- gemspecs = Dir[File.join(base, "*.gemspec")]
69
- raise "Unable to determine name from existing gemspec." unless gemspecs.size == 1
70
-
71
- File.basename(gemspecs.first)[/^(.*)\.gemspec$/, 1]
72
- end
73
-
74
- def git_push
75
- sh "git push --all"
76
- sh "git push --tags"
77
- end
78
-
79
- def guard_already_tagged
80
- sh('git tag').split(/\n/).include?(current_version_tag) and raise("This tag has already been committed to the repo.")
81
- end
82
-
83
- def guard_clean
84
- clean? or raise("There are files that need to be committed first.")
85
- end
86
-
87
- def clean?
88
- sh("git ls-files -dm").split("\n").size.zero?
89
- end
90
-
91
- def tag_version
92
- sh "git tag #{current_version_tag}"
93
- yield if block_given?
94
- rescue
95
- sh "git tag -d #{current_version_tag}"
96
- raise
97
- end
98
-
99
- def current_version
100
- raise("Version file could not be found at #{version_file_path}") unless File.exist?(version_file_path)
101
- File.read(version_file_path)[/V(ERSION|ersion)\s*=\s*(["'])(.*?)\2/, 3]
102
- end
103
-
104
- def version_file_path
105
- File.join(base, 'lib', name, 'version.rb')
106
- end
107
-
108
- def current_version_tag
109
- "v#{current_version}"
110
- end
111
-
112
- def sh(cmd, &block)
113
- output, code = sh_with_code(cmd, &block)
114
- code == 0 ? output : raise(output)
115
- end
116
-
117
- def sh_with_code(cmd, &block)
118
- output = ''
119
- Dir.chdir(base) {
120
- output = `#{cmd}`
121
- block.call if block and $? == 0
122
- }
123
- [output, $?]
124
- end
125
- end
126
- end