summaryrefslogtreecommitdiffstats
path: root/rubygem-typhoeus.spec
blob: 27a2bdc7e71800be2f49fdea3d5cdbc64bd167ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
%global ruby_sitearch %(ruby -rrbconfig -e 'puts Config::CONFIG["sitearchdir"] ')
%global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
%global gemname typhoeus
%global geminstdir %{gemdir}/gems/%{gemname}-%{version}
%global rubyabi 1.8 

Summary: A library for interacting with web services at blinding speed
Name: rubygem-%{gemname}
Version: 0.1.31
Release: 3%{?dist}
Group: Development/Languages
License: MIT
URL: http://github.com/pauldix/typhoeus
Source0: http://gems.rubyforge.org/gems/%{gemname}-%{version}.gem
Patch0: %{name}-gcc-flags-fix.patch
Requires: rubygems
Requires: ruby(abi) = %{rubyabi}
Requires: rubygem(rack)
BuildRequires: ruby(abi) = %{rubyabi} 
BuildRequires: rubygems
BuildRequires: rubygem(rspec)
BuildRequires: rubygem(rake)
BuildRequires: rubygem(rack)
BuildRequires: rubygem(diff-lcs)
BuildRequires: rubygem(json)
BuildRequires: ruby-devel
BuildRequires: libcurl-devel
Provides: rubygem(%{gemname}) = %{version}

%description
Like a modern code version of the mythical beast with 100 serpent heads,
Typhoeus runs HTTP requests in parallel while cleanly encapsulating handling
logic.

%package doc
Summary: Documentation for %{name}
Group: Documentation
Requires:%{name} = %{version}-%{release}

%description doc
Documentation for %{name}

%prep
%setup -q -c -T 
mkdir -p ./%{gemdir}
export CONFIGURE_ARGS="--with-cflags='%{optflags}'"
gem install \
	--local \
	--install-dir ./%{gemdir} \
	-V --force --rdoc \
	%{SOURCE0}
pushd .%{geminstdir}
%patch0
popd

%build
pushd .%{geminstdir}/ext/%{gemname}
(%_bindir/ruby extconf.rb && make clean all)
popd

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{gemdir}
cp -a ./%{gemdir}/* %{buildroot}%{gemdir}
mkdir -p %{buildroot}%{ruby_sitearch}/%{gemname}
mv -f %{buildroot}%{geminstdir}/ext/%{gemname}/*.so %{buildroot}%{ruby_sitearch}/%{gemname}
rm -rf %{buildroot}%{geminstdir}/ext
find %{buildroot}/%{geminstdir} -name .gitignore | xargs rm -f

# remove all shebang, set permission to 0644 (mtasaka)
for f in $(find %{buildroot}%{geminstdir} -name \*.rb)
do
	sed -i -e '/^#!/d' $f
	chmod 0644 $f
done

%check
pushd .%{geminstdir}
ln -sf %{buildroot}%{ruby_sitearch}/%{gemname}/native.so lib/%{gemname}/native.so

NEEDSKIP=""
for needskip in \
  spec/%{gemname}/request_spec.rb \
  spec/%{gemname}/hydra_spec.rb \
  spec/%{gemname}/remote_spec.rb \
  spec/%{gemname}/multi_spec.rb \
  spec/%{gemname}/easy_spec.rb \
  spec/%{gemname}/remote_proxy_object_spec.rb
do
  NEEDSKIP="$NEEDSKIP $needskip"
done

for needskip in $NEEDSKIP
do
  mv $needskip ${needskip}.save
done

rake spec --trace

for needskip in $NEEDSKIP
do
  mv ${needskip}.save $needskip
done

rm -f lib/%{gemname}/native.so

popd

%clean
rm -rf %{buildroot}

%files
%defattr(-, root, root, -)
%dir %{geminstdir}
%dir %{ruby_sitearch}/%{gemname}
%{geminstdir}/lib
%{ruby_sitearch}/%{gemname}/*.so
%doc %{geminstdir}/VERSION
%doc %{geminstdir}/README.textile
%doc %{geminstdir}/CHANGELOG.markdown
%{gemdir}/cache/%{gemname}-%{version}.gem
%{gemdir}/specifications/%{gemname}-%{version}.gemspec

%files doc
%defattr(-, root, root, -)
%{geminstdir}/Rakefile
%{geminstdir}/spec
%{geminstdir}/benchmarks
%{geminstdir}/examples
%{geminstdir}/profilers
%{geminstdir}/%{gemname}.gemspec
%{gemdir}/doc/%{gemname}-%{version}

%changelog
* Thu Oct 14 2010 Michal Fojtik <mfojtik@redhat.com> - 0.1.31-3
- Preserved failing test files (thx. to mtasaka)
- Fixed macros usage
- Replaced path with macro
- Removed libcurl from requires

* Wed Oct 13 2010 Michal Fojtik <mfojtik@redhat.com> - 0.1.31-2
- Fixed License to MIT
- Fixed libcurl BuildRequire
- Gem now recompiles with correct GCC flags
- Directory issues should be fixed
- Removed -devel subpackage
- Added tests


* Wed Oct 06 2010 Michal Fojtik <mfojtik@redhat.com> - 0.1.31-1
- Initial package